Add selectable ESP-NOW send path for accel/tap input.
Expose best_effort/fast/wait/reliable via UART, dashboard, and CLI so loss vs latency can be compared under real multi-pod load. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
pb "powerpod/gotool/pb"
|
||||
)
|
||||
|
||||
func runInputSendModeCmd(h hostConn, args []string) error {
|
||||
fs := flag.NewFlagSet("input-send-mode", flag.ExitOnError)
|
||||
write := fs.Bool("set", false, "write mode to slave(s)")
|
||||
mode := fs.Uint("mode", 0, "0=best_effort 1=fast 2=wait 3=reliable")
|
||||
clientID := fs.Uint("client", 0, "slave client_id (required unless -all)")
|
||||
all := fs.Bool("all", false, "apply to every registered slave")
|
||||
_ = fs.Parse(args)
|
||||
|
||||
req := &pb.InputSendModeRequest{
|
||||
Write: *write,
|
||||
Mode: pb.InputSendMode(*mode),
|
||||
ClientId: uint32(*clientID),
|
||||
AllClients: *all,
|
||||
}
|
||||
if *write && !*all && *clientID == 0 {
|
||||
return fmt.Errorf("need -client N or -all when using -set")
|
||||
}
|
||||
if *write && *mode > uint(pb.InputSendMode_INPUT_SEND_RELIABLE) {
|
||||
return fmt.Errorf("mode must be 0..3")
|
||||
}
|
||||
|
||||
r, err := hostInputSendMode(h, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("input-send-mode: success=%v mode=%d (%s) client_id=%d slaves_updated=%d\n",
|
||||
r.GetSuccess(), r.GetMode(), inputSendModeName(r.GetMode()), r.GetClientId(),
|
||||
r.GetSlavesUpdated())
|
||||
if *write && !r.GetSuccess() {
|
||||
return fmt.Errorf("input-send-mode rejected")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user