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:
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func runCacheStatus(sp *serialPort) error {
|
||||
r, err := sp.readCacheStatus()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
accel := r.GetAccel()
|
||||
if len(accel) == 0 {
|
||||
fmt.Println("accel: (none — no slaves with accel stream enabled)")
|
||||
} else {
|
||||
for _, s := range accel {
|
||||
if !s.GetValid() {
|
||||
fmt.Printf("accel client %d: no sample yet\n", s.GetClientId())
|
||||
continue
|
||||
}
|
||||
fmt.Printf("accel client %d: x=%d y=%d z=%d (age %d ms)\n",
|
||||
s.GetClientId(), s.GetX(), s.GetY(), s.GetZ(), s.GetAgeMs())
|
||||
}
|
||||
}
|
||||
taps := r.GetTaps()
|
||||
if len(taps) == 0 {
|
||||
fmt.Println("tap: (none pending)")
|
||||
} else {
|
||||
for _, e := range taps {
|
||||
fmt.Printf("tap client %d: %s (age %d ms)\n",
|
||||
e.GetClientId(), tapKindLabel(e.GetKind()), e.GetAgeMs())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user