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
+19
View File
@@ -7,12 +7,23 @@ import (
"strings"
)
// UARTConfig holds serial paths for gotool commands and per-node reset (USB console).
type UARTConfig struct {
// Baud for uart.master (default 921600).
Baud uint `json:"baud,omitempty"`
// Master command UART (external adapter on GPIO2/3), e.g. /dev/ttyUSB0.
Master string `json:"master"`
// Master USB console / JTAG serial for esptool reset, e.g. /dev/ttyACM0.
MasterConsole string `json:"master_console,omitempty"`
}
// Config describes the bench: ESP-NOW network, master MAC, and known slaves.
type Config struct {
ID string `json:"id"`
Description string `json:"description,omitempty"`
Network uint `json:"network"`
MasterMAC string `json:"master_mac"`
UART UARTConfig `json:"uart"`
Slaves []SlaveNode `json:"slaves"`
}
@@ -20,6 +31,8 @@ type SlaveNode struct {
ID string `json:"id"`
MAC string `json:"mac"`
ClientID *uint `json:"client_id,omitempty"`
// USB console port for esptool reset (optional), e.g. /dev/ttyACM1.
Console string `json:"console,omitempty"`
}
type Bench struct {
@@ -50,6 +63,12 @@ func NewBench(cfg Config) (*Bench, error) {
if cfg.Network < 1 || cfg.Network > 8 {
return nil, fmt.Errorf("config %q: network must be 18 (DIP / IO expander)", cfg.ID)
}
if cfg.UART.Master == "" {
return nil, fmt.Errorf("config %q: uart.master is required (gotool command port)", cfg.ID)
}
if cfg.UART.Baud == 0 {
cfg.UART.Baud = 921600
}
b := &Bench{Config: cfg, slaveByID: make(map[string]*SlaveNode)}
for i := range cfg.Slaves {