Files
powerpods/goTool/cmd_accel_stream.go
T
skrueckenandCursor 92a13d7fd0 Add BLE host transport selectable via DIP8 alongside UART.
Master can speak the same framed protobuf protocol over NimBLE or UART; goTool gains -ble, ble-rtt, and ble-stream timing checks for ESP-NOW coexistence.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 16:11:10 +02: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 8–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
}