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
+18 -1
View File
@@ -4,10 +4,20 @@
#include "esp_err.h"
#include "esp_now_messages.pb.h"
#include "esp_partition.h"
#include "uart_messages.pb.h"
#include <stdint.h>
typedef struct {
/** bytes_done, total_bytes, number of slaves targeted. */
void (*aggregate)(uint32_t bytes_done, uint32_t total_bytes,
uint8_t slave_count);
/** Per-slave block ACK (slave_id, bytes_written on that slave, total_bytes). */
void (*per_slave)(uint32_t slave_id, uint32_t bytes_done, uint32_t total_bytes);
} ota_espnow_progress_cbs_t;
/** Master: read staged image from partition and push to all available slaves. */
esp_err_t ota_espnow_distribute(const esp_partition_t *partition, uint32_t size);
esp_err_t ota_espnow_distribute(const esp_partition_t *partition, uint32_t size,
const ota_espnow_progress_cbs_t *progress);
/** Master: handle slave → master OTA status / block ACK. */
void ota_espnow_master_on_status(const uint8_t slave_mac[6],
@@ -20,4 +30,11 @@ void ota_espnow_slave_on_payload(const uint8_t master_mac[6],
const alox_EspNowOtaPayload *payload);
void ota_espnow_slave_on_end(const uint8_t master_mac[6]);
/**
* Fill UART OtaSlaveProgressResponse from tracked per-slave state.
* filter_client_id 0 = all slaves in the last/current distribution session.
*/
void ota_espnow_progress_query(uint32_t filter_client_id,
alox_OtaSlaveProgressResponse *out);
#endif