Split ESP-NOW into core/master/slave modules, block non-OTA UART traffic during updates, and hold the host serial port exclusively so dashboard polling cannot interleave with firmware uploads. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
587 B
C
26 lines
587 B
C
#include "ota_session.h"
|
|
#include "ota_espnow.h"
|
|
#include "ota_uart.h"
|
|
#include "uart_messages.pb.h"
|
|
|
|
bool ota_session_busy(void) {
|
|
return ota_uart_is_active() || ota_espnow_distribution_active();
|
|
}
|
|
|
|
bool ota_session_uart_cmd_allowed(uint16_t msg_id) {
|
|
if (!ota_session_busy()) {
|
|
return true;
|
|
}
|
|
|
|
switch ((alox_MessageType)msg_id) {
|
|
case alox_MessageType_OTA_START:
|
|
case alox_MessageType_OTA_PAYLOAD:
|
|
case alox_MessageType_OTA_END:
|
|
case alox_MessageType_OTA_START_ESPNOW:
|
|
case alox_MessageType_OTA_SLAVE_PROGRESS:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|