Add CACHE_STATUS UART poll and dashboard live stream.

Combine cached accel and tap in one low-overhead master command for ~16 ms
host polling. The dashboard uses a single live-stream toggle plus per-slave
accel-stream controls; fix live_stream state so polling is not cleared every
slow client refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 20:57:54 +02:00
co-authored by Cursor
parent a8d4d42920
commit f512936d97
21 changed files with 764 additions and 377 deletions
-34
View File
@@ -38,13 +38,6 @@ type tapEventView struct {
AgeMs uint32 `json:"age_ms"`
}
type tapReceiveAPIResponse struct {
ClientID uint32 `json:"client_id"`
Enabled bool `json:"enabled"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
func mountTapAPI(mux *http.ServeMux, link *managedSerial, hub *wsHub, tapCtl *tapNotifyCtl) {
mux.HandleFunc("GET /api/clients/{clientID}/tap-notify", func(w http.ResponseWriter, r *http.Request) {
clientID, err := parsePathClientID(r)
@@ -62,15 +55,6 @@ func mountTapAPI(mux *http.ServeMux, link *managedSerial, hub *wsHub, tapCtl *ta
}
serveClientTapNotifyPut(w, r, clientID, link, hub, tapCtl)
})
mux.HandleFunc("PUT /api/clients/{clientID}/tap-receive", func(w http.ResponseWriter, r *http.Request) {
clientID, err := parsePathClientID(r)
if err != nil {
writeJSON(w, http.StatusBadRequest, tapReceiveAPIResponse{Error: err.Error()})
return
}
serveClientTapReceivePut(w, r, clientID, hub)
})
mux.HandleFunc("/api/tap-notify", func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case http.MethodGet:
@@ -181,24 +165,6 @@ func serveTapNotifyPost(w http.ResponseWriter, r *http.Request, link *managedSer
writeJSON(w, status, out)
}
func serveClientTapReceivePut(w http.ResponseWriter, r *http.Request, clientID uint32, hub *wsHub) {
var body struct {
Enable bool `json:"enable"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
writeJSON(w, http.StatusBadRequest, tapReceiveAPIResponse{Error: "invalid JSON"})
return
}
if hub != nil {
hub.patchClientTapReceive(clientID, body.Enable)
}
writeJSON(w, http.StatusOK, tapReceiveAPIResponse{
ClientID: clientID,
Enabled: body.Enable,
Success: true,
})
}
func applyTapNotifyAll(link *managedSerial, hub *wsHub, tapCtl *tapNotifyCtl, single, doubleTap, triple bool) (uint32, error) {
resp, err := link.TapNotify(&pb.TapNotifyRequest{
Write: true,