Add per-slave ESP-NOW OTA progress over UART and fix dashboard updates.

Expose OTA_SLAVE_PROGRESS on the master, track per-slave state during
distribution, run ESP-NOW OTA in a background task so the host can poll
while slaves update, and show master/slave progress in the dashboard
with table layout and faster WebSocket refresh during uploads.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-19 21:07:46 +02:00
co-authored by Cursor
parent 5a948a5c8c
commit a0f4a81a55
23 changed files with 1467 additions and 146 deletions
+6 -4
View File
@@ -28,6 +28,7 @@ go run . -port /dev/ttyUSB0 clients
| `test` | — | Run an automated scenario (JSON configs under `testdata/`) |
| `serve` | — | Web dashboard at `http://localhost:8080` (WebSocket live updates) |
| `ota` | 1619 | UART firmware upload to master; firmware then pushes to slaves via ESP-NOW |
| `ota-progress` | 21 | Query per-slave ESP-NOW OTA progress on the master (`-client N`, default all) |
`clients` requires slaves to have responded to master discover broadcasts first.
@@ -72,7 +73,7 @@ HTTP API (used by the web UI): `GET/POST /api/deadzone`, `POST /api/unicast-test
| UI / API | Behaviour |
|----------|-----------|
| Firmware OTA card | Same as `ota` CLI; progress via WebSocket `ota_progress` events |
| Firmware OTA card | Same as `ota` CLI; WebSocket `ota_progress` with `step` `master` (UART) then `slaves` (ESP-NOW) |
| `POST /api/ota` | Upload `.bin` to master only — slaves are updated by firmware over ESP-NOW after `OTA_END` |
```bash
@@ -96,8 +97,9 @@ clients (2):
## Regenerate protobuf
From repo root (needs `protoc`, `protoc-gen-go`, and for C also `pip install protobuf`):
```bash
protoc --go_out=./pb --go_opt=paths=source_relative \
--go_opt=Muart_messages.proto=powerpod/gotool/pb \
-I ../main/proto ../main/proto/uart_messages.proto
make gotool-proto # Go: goTool/pb/uart_messages.pb.go
make proto_generate # C: main/proto/*.pb.h, *.pb.c
```