add some automation to pi side

This commit is contained in:
legop3
2025-11-11 21:04:04 -05:00
parent 3bc2921f25
commit 74a460a980
11 changed files with 278 additions and 17 deletions
+11 -2
View File
@@ -2,6 +2,7 @@ package roverd
import (
"encoding/base64"
"errors"
"fmt"
"io"
"log"
@@ -68,8 +69,12 @@ func (s *SerialAdapter) MotorPWM(main, side, vacuum int) error {
return s.write(payload)
}
func (s *SerialAdapter) StartSensorStream(group byte) error {
payload := []byte{148, 1, group}
func (s *SerialAdapter) StartSensorStream(packets []byte) error {
if len(packets) == 0 {
return errors.New("sensor stream requires packets")
}
payload := []byte{148, byte(len(packets))}
payload = append(payload, packets...)
return s.write(payload)
}
@@ -84,3 +89,7 @@ func (s *SerialAdapter) PauseSensorStream(pause bool) error {
func (s *SerialAdapter) SendRaw(raw []byte) error {
return s.write(raw)
}
func (s *SerialAdapter) SeekDock() error {
return s.write([]byte{143})
}