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:
@@ -18,6 +18,7 @@ enum MessageType {
|
||||
OTA_END = 18;
|
||||
OTA_STATUS = 19;
|
||||
OTA_START_ESPNOW = 20;
|
||||
OTA_SLAVE_PROGRESS = 21;
|
||||
}
|
||||
|
||||
message UartMessage {
|
||||
@@ -36,6 +37,8 @@ message UartMessage {
|
||||
AccelDeadzoneResponse accel_deadzone_response = 12;
|
||||
EspNowUnicastTestRequest espnow_unicast_test_request = 13;
|
||||
EspNowUnicastTestResponse espnow_unicast_test_response = 14;
|
||||
OtaSlaveProgressRequest ota_slave_progress_request = 15;
|
||||
OtaSlaveProgressResponse ota_slave_progress_response = 16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,10 +122,32 @@ message OtaPayload {
|
||||
message OtaEndPayload {}
|
||||
|
||||
// Device → host status (also used as ACK after each 4 KiB written).
|
||||
// status: 1=preparing, 2=ready, 3=block_ack, 4=success, 5=failed
|
||||
// status: 1=preparing, 2=ready, 3=block_ack, 4=success, 5=failed, 6=distributing
|
||||
message OtaStatusPayload {
|
||||
uint32 status = 1;
|
||||
uint32 bytes_written = 2;
|
||||
uint32 target_slot = 3;
|
||||
uint32 error = 4;
|
||||
}
|
||||
|
||||
// Host → master: query ESP-NOW slave OTA progress (client_id 0 = all slaves in session).
|
||||
message OtaSlaveProgressRequest {
|
||||
uint32 client_id = 1;
|
||||
}
|
||||
|
||||
message OtaSlaveProgressEntry {
|
||||
uint32 client_id = 1;
|
||||
uint32 bytes_written = 2;
|
||||
uint32 total_bytes = 3;
|
||||
/** 0=idle, 1=preparing, 2=ready, 3=distributing, 4=success, 5=failed */
|
||||
uint32 status = 4;
|
||||
uint32 error = 5;
|
||||
}
|
||||
|
||||
message OtaSlaveProgressResponse {
|
||||
bool active = 1;
|
||||
uint32 total_bytes = 2;
|
||||
uint32 aggregate_bytes = 3;
|
||||
uint32 slave_count = 4;
|
||||
repeated OtaSlaveProgressEntry slaves = 5 [(nanopb).max_count = 16];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user