Make controller input best-effort and harden OTA rollback.
Accel/tap use fire-and-forget ESP-NOW with a 10 ms FreeRTOS-safe cadence, OTA recovers from seq gaps and auto-reboots after success, and bootloader app rollback confirms after a stable boot. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+11
-3
@@ -2,6 +2,7 @@
|
||||
#include "cmd_handler.h"
|
||||
#include "esp_log.h"
|
||||
#include "uart.h"
|
||||
#include "uart_messages.pb.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -87,9 +88,16 @@ void host_rx_bytes(const uint8_t *data, size_t len) {
|
||||
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
if (parse_uart_byte(data[i], &s_rx_packet)) {
|
||||
ESP_LOGI(TAG, "received message cmd=0x%02x len=%u",
|
||||
s_rx_packet.len > 0 ? s_rx_packet.payload[0] : 0,
|
||||
(unsigned)s_rx_packet.len);
|
||||
uint8_t cmd =
|
||||
s_rx_packet.len > 0 ? s_rx_packet.payload[0] : 0;
|
||||
/* OTA payloads are high-rate; avoid INFO spam starving the dispatcher. */
|
||||
if (cmd == (uint8_t)alox_MessageType_OTA_PAYLOAD) {
|
||||
ESP_LOGD(TAG, "received message cmd=0x%02x len=%u", cmd,
|
||||
(unsigned)s_rx_packet.len);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "received message cmd=0x%02x len=%u", cmd,
|
||||
(unsigned)s_rx_packet.len);
|
||||
}
|
||||
host_enqueue_packet(s_rx_packet.payload, s_rx_packet.len);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user