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 }