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:
@@ -192,6 +192,36 @@ func (m *managedSerial) tapNotifyVia(
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (m *managedSerial) readCacheStatusPoll() (*pb.CacheStatusResponse, error) {
|
||||
payload, err := m.exchangePoll(byte(pb.MessageType_CACHE_STATUS), "CACHE_STATUS")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return decodeCacheStatusPayload(payload)
|
||||
}
|
||||
|
||||
func decodeCacheStatusPayload(payload []byte) (*pb.CacheStatusResponse, error) {
|
||||
if len(payload) < 1 {
|
||||
return nil, fmt.Errorf("empty response payload")
|
||||
}
|
||||
if payload[0] != byte(pb.MessageType_CACHE_STATUS) {
|
||||
return nil, fmt.Errorf("unexpected command id 0x%02x (want 0x%02x)",
|
||||
payload[0], byte(pb.MessageType_CACHE_STATUS))
|
||||
}
|
||||
var msg pb.UartMessage
|
||||
if err := proto.Unmarshal(payload[1:], &msg); err != nil {
|
||||
return nil, fmt.Errorf("decode: %w", err)
|
||||
}
|
||||
if msg.GetType() != pb.MessageType_CACHE_STATUS {
|
||||
return nil, fmt.Errorf("unexpected type %v", msg.GetType())
|
||||
}
|
||||
r := msg.GetCacheStatusResponse()
|
||||
if r == nil {
|
||||
return nil, fmt.Errorf("missing cache_status_response")
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (m *managedSerial) readTapSnapshotPoll(clientID uint32) (*pb.TapSnapshotResponse, error) {
|
||||
msg := &pb.UartMessage{
|
||||
Type: pb.MessageType_TAP_SNAPSHOT,
|
||||
@@ -410,6 +440,14 @@ func (s *serialPort) TapNotify(req *pb.TapNotifyRequest) (*pb.TapNotifyResponse,
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (s *serialPort) readCacheStatus() (*pb.CacheStatusResponse, error) {
|
||||
payload, err := s.exchange(byte(pb.MessageType_CACHE_STATUS), "CACHE_STATUS")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return decodeCacheStatusPayload(payload)
|
||||
}
|
||||
|
||||
func (s *serialPort) readTapSnapshot(clientID uint32) (*pb.TapSnapshotResponse, error) {
|
||||
msg := &pb.UartMessage{
|
||||
Type: pb.MessageType_TAP_SNAPSHOT,
|
||||
|
||||
Reference in New Issue
Block a user