From b7dcc00c5e61e7ef79017dd642f83b1ff86cc502 Mon Sep 17 00:00:00 2001 From: salty Date: Sat, 14 Mar 2026 12:32:11 -0400 Subject: [PATCH] fix: ESP-NOW callback signature for new ESP-IDF, volatile qualifier --- esp32/uwb_anchor/src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esp32/uwb_anchor/src/main.cpp b/esp32/uwb_anchor/src/main.cpp index c208949..f9aa5f2 100644 --- a/esp32/uwb_anchor/src/main.cpp +++ b/esp32/uwb_anchor/src/main.cpp @@ -77,16 +77,16 @@ struct EspNowPacket { /* ISR ring buffer for ESP-NOW */ #define ESPNOW_Q_SIZE 8 -static volatile EspNowPacket g_enq[ESPNOW_Q_SIZE]; +static EspNowPacket g_enq[ESPNOW_Q_SIZE]; static volatile int g_en_head = 0, g_en_tail = 0; -static void IRAM_ATTR espnow_rx_cb(const uint8_t *mac, const uint8_t *data, int len) { +static void IRAM_ATTR espnow_rx_cb(const esp_now_recv_info_t *info, const uint8_t *data, int len) { if (len < (int)sizeof(EspNowPacket)) return; const EspNowPacket *p = (const EspNowPacket *)data; if (p->magic[0] != ESPNOW_MAGIC_0 || p->magic[1] != ESPNOW_MAGIC_1) return; int next = (g_en_head + 1) % ESPNOW_Q_SIZE; if (next == g_en_tail) return; - g_enq[g_en_head] = *p; + memcpy(&g_enq[g_en_head], p, sizeof(EspNowPacket)); g_en_head = next; }