Expose MessageType 24 with protobuf response (success, x, y, z in raw LSB), firmware handler with mutex-safe I2C read, goTool `accel` CLI, and docs. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
315 B
Go
18 lines
315 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func runAccel(sp *serialPort) error {
|
|
r, err := sp.readAccel()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !r.GetSuccess() {
|
|
return fmt.Errorf("accel read failed (sensor not ready?)")
|
|
}
|
|
fmt.Printf("accel: x=%d y=%d z=%d (raw LSB, ±2g)\n", r.GetX(), r.GetY(), r.GetZ())
|
|
return nil
|
|
}
|