From 7e50bd56890303ad6b06c801f8ad3e012ae83b62 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Wed, 12 Aug 2026 09:29:41 +0200 Subject: [PATCH] fix: ESPNowBridge recv callback signature breaks build on RISC-V ESP32 (C3/C6) esp_now_recv_cb_t expects a plain 'int' for the data-length parameter. On Xtensa targets int32_t happens to be typedef'd as int, so it built fine, but on RISC-V targets (e.g. ESP32-C3) int32_t is 'long int' -- a distinct type from 'int' even though both are 32-bit -- so the function pointer conversion is rejected outright. --- src/helpers/bridges/ESPNowBridge.cpp | 4 ++-- src/helpers/bridges/ESPNowBridge.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helpers/bridges/ESPNowBridge.cpp b/src/helpers/bridges/ESPNowBridge.cpp index 3c094e7c90..b610bcf68b 100644 --- a/src/helpers/bridges/ESPNowBridge.cpp +++ b/src/helpers/bridges/ESPNowBridge.cpp @@ -9,7 +9,7 @@ ESPNowBridge *ESPNowBridge::_instance = nullptr; // Static callback wrappers -void ESPNowBridge::recv_cb(const uint8_t *mac, const uint8_t *data, int32_t len) { +void ESPNowBridge::recv_cb(const uint8_t *mac, const uint8_t *data, int len) { if (_instance) { _instance->onDataRecv(mac, data, len); } @@ -100,7 +100,7 @@ void ESPNowBridge::xorCrypt(uint8_t *data, size_t len) { } } -void ESPNowBridge::onDataRecv(const uint8_t *mac, const uint8_t *data, int32_t len) { +void ESPNowBridge::onDataRecv(const uint8_t *mac, const uint8_t *data, int len) { // Ignore packets that are too small to contain header + checksum if (len < (BRIDGE_MAGIC_SIZE + BRIDGE_CHECKSUM_SIZE)) { BRIDGE_DEBUG_PRINTLN("RX packet too small, len=%d\n", len); diff --git a/src/helpers/bridges/ESPNowBridge.h b/src/helpers/bridges/ESPNowBridge.h index 431a036b09..29d2a38fb6 100644 --- a/src/helpers/bridges/ESPNowBridge.h +++ b/src/helpers/bridges/ESPNowBridge.h @@ -42,7 +42,7 @@ class ESPNowBridge : public BridgeBase { private: static ESPNowBridge *_instance; - static void recv_cb(const uint8_t *mac, const uint8_t *data, int32_t len); + static void recv_cb(const uint8_t *mac, const uint8_t *data, int len); static void send_cb(const uint8_t *mac, esp_now_send_status_t status); /** @@ -90,7 +90,7 @@ class ESPNowBridge : public BridgeBase { * @param data Received data * @param len Length of received data */ - void onDataRecv(const uint8_t *mac, const uint8_t *data, int32_t len); + void onDataRecv(const uint8_t *mac, const uint8_t *data, int len); /** * ESP-NOW send callback