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
+23 -1
View File
@@ -207,6 +207,7 @@ Host and master speak nanopb-encoded `UartMessage` inside UART frames (byte 0 =
| 18 | `OTA_END` | Implemented — flush, `esp_ota_end`, push image to slaves via ESP-NOW, set boot |
| 19 | `OTA_STATUS` | Device → host (prepare/ready/block ACK/success/failed) |
| 20 | `OTA_START_ESPNOW` | Implemented — re-distribute staged image to slaves only |
| 21 | `OTA_SLAVE_PROGRESS` | Implemented (`cmd_ota_slave_progress.c`) — query per-slave ESP-NOW OTA progress |
Regenerate C code:
@@ -260,7 +261,28 @@ Host upload:
go run . -port /dev/ttyUSB0 ota build/powerpod.bin
```
`OtaStatusPayload.status`: `1` preparing, `2` ready, `3` block_ack, `4` success, `5` failed.
`OtaStatusPayload.status`: `1` preparing, `2` ready, `3` block_ack, `4` success, `5` failed, `6` distributing (`bytes_written` = progress, `target_slot` = slave count).
### OTA_SLAVE_PROGRESS command
**Request:** framed `15` (`0x15`) + optional `ota_slave_progress_request` (`client_id`; `0` = all slaves in the current/last distribution session).
**Response:** `ota_slave_progress_response`:
| Field | Meaning |
|-------|---------|
| `active` | ESP-NOW distribution running |
| `total_bytes` | Image size |
| `aggregate_bytes` | Overall bytes sent to all slaves |
| `slave_count` | Number of slaves in session |
| `slaves[]` | Per slave: `client_id`, `bytes_written`, `total_bytes`, `status`, `error` |
Per-slave `status`: `0` idle, `1` preparing, `2` ready, `3` block_ack/distributing, `4` success, `5` failed.
```bash
go run . -port /dev/ttyUSB0 ota-progress
go run . -port /dev/ttyUSB0 ota-progress -client 16
```
### ACCEL_DEADZONE command