Add bench UART ports and cold-start reset to goTool autotest.

Bench configs define command and console serial paths; scenarios can
reset nodes via esptool before tests. Smoke resets all nodes then waits
for ESP-NOW join.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-18 23:44:58 +02:00
co-authored by Cursor
parent d24b0cb5c3
commit 0299ba44fd
10 changed files with 268 additions and 45 deletions
+25 -17
View File
@@ -10,7 +10,8 @@ import (
const defaultBaud = 921600
func usage() {
fmt.Fprintf(os.Stderr, "usage: gotool -port /dev/ttyUSB0 <command>\n\n")
fmt.Fprintf(os.Stderr, "usage: gotool [-port /dev/ttyUSB0] <command>\n")
fmt.Fprintf(os.Stderr, " test uses uart.master from bench config when -port is omitted\n\n")
fmt.Fprintf(os.Stderr, "commands:\n")
fmt.Fprintf(os.Stderr, " version firmware version and git hash\n")
fmt.Fprintf(os.Stderr, " clients registered ESP-NOW slaves on the master\n")
@@ -25,31 +26,38 @@ func main() {
baud := flag.Int("baud", defaultBaud, "UART baud rate")
flag.Parse()
if *portName == "" || flag.NArg() < 1 {
if flag.NArg() < 1 {
usage()
os.Exit(2)
}
cmd := flag.Arg(0)
sp, err := openSerial(*portName, *baud)
if err != nil {
log.Fatalf("open serial: %v", err)
}
defer sp.Close()
var runErr error
switch cmd {
case "version":
runErr = runVersion(sp)
case "clients", "client-info":
runErr = runClients(sp)
case "deadzone", "accel-deadzone":
runErr = runDeadzone(sp, flag.Args()[1:])
case "unicast-test", "unicast_test":
runErr = runUnicastTest(sp, flag.Args()[1:])
case "test", "autotest":
runErr = runTest(sp, flag.Args()[1:])
runErr = runTest(*portName, *baud, flag.Args()[1:])
case "version", "clients", "client-info", "deadzone", "accel-deadzone", "unicast-test", "unicast_test":
if *portName == "" {
fmt.Fprintf(os.Stderr, "command %q requires -port\n\n", cmd)
usage()
os.Exit(2)
}
sp, err := openSerial(*portName, *baud)
if err != nil {
log.Fatalf("open serial: %v", err)
}
defer sp.Close()
switch cmd {
case "version":
runErr = runVersion(sp)
case "clients", "client-info":
runErr = runClients(sp)
case "deadzone", "accel-deadzone":
runErr = runDeadzone(sp, flag.Args()[1:])
case "unicast-test", "unicast_test":
runErr = runUnicastTest(sp, flag.Args()[1:])
}
default:
fmt.Fprintf(os.Stderr, "unknown command %q\n\n", cmd)
usage()