Files
powerpods/goTool/cmd_accel_stream.go
T
skrueckenandCursor 178ab46cec Make controller input best-effort and harden OTA rollback.
Accel/tap use fire-and-forget ESP-NOW with a 10 ms FreeRTOS-safe cadence, OTA recovers from seq gaps and auto-reboots after success, and bootloader app rollback confirms after a stable boot.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-01 22:16:28 +01:00

45 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import (
"flag"
"fmt"
pb "powerpod/gotool/pb"
)
func runAccelStreamCmd(h hostConn, args []string) error {
fs := flag.NewFlagSet("accel-stream", flag.ExitOnError)
clientID := fs.Uint("client", 0, "slave client id (0 with -all)")
all := fs.Bool("all", false, "all registered clients")
enable := fs.Bool("enable", true, "enable stream")
disable := fs.Bool("disable", false, "disable stream")
period := fs.Uint("period", 0, "BLE push period_ms 10–16 (0=leave/default)")
if err := fs.Parse(args); err != nil {
return err
}
on := *enable
if *disable {
on = false
}
if !*all && *clientID == 0 {
return fmt.Errorf("need -client ID or -all")
}
req := &pb.AccelStreamRequest{
Write: true,
Enable: on,
PeriodMs: uint32(*period),
}
if *all {
req.AllClients = true
} else {
req.ClientId = uint32(*clientID)
}
r, err := hostAccelStream(h, req)
if err != nil {
return err
}
fmt.Printf("accel-stream: success=%v enabled=%v client_id=%d slaves_updated=%d\n",
r.GetSuccess(), r.GetEnabled(), r.GetClientId(), r.GetSlavesUpdated())
return nil
}