Fix repeater build compile errors
This commit is contained in:
1 parent
f606ae9aeb
commit
4e63941c92
3 files changed
+19
-5
No files matched your search
@@ -9,11 +9,20 @@
|
||||
ESPNowBridge *ESPNowBridge::_instance = nullptr;
|
||||
|
||||
// Static callback wrappers
|
||||
void ESPNowBridge::recv_cb(const uint8_t *mac, const uint8_t *data, int32_t len) {
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
void ESPNowBridge::recv_cb(const esp_now_recv_info_t *info, const uint8_t *data, int len) {
|
||||
const uint8_t *mac = info != nullptr ? info->src_addr : nullptr;
|
||||
if (_instance) {
|
||||
_instance->onDataRecv(mac, data, len);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void ESPNowBridge::recv_cb(const uint8_t *mac, const uint8_t *data, int len) {
|
||||
if (_instance) {
|
||||
_instance->onDataRecv(mac, data, len);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ESPNowBridge::send_cb(const uint8_t *mac, esp_now_send_status_t status) {
|
||||
if (_instance) {
|
||||
@@ -100,7 +109,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);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "MeshCore.h"
|
||||
#include "esp_now.h"
|
||||
#include "esp_idf_version.h"
|
||||
#include "helpers/bridges/BridgeBase.h"
|
||||
|
||||
#ifdef WITH_ESPNOW_BRIDGE
|
||||
@@ -42,7 +43,11 @@
|
||||
class ESPNowBridge : public BridgeBase {
|
||||
private:
|
||||
static ESPNowBridge *_instance;
|
||||
static void recv_cb(const uint8_t *mac, const uint8_t *data, int32_t len);
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
static void recv_cb(const esp_now_recv_info_t *info, const uint8_t *data, int len);
|
||||
#else
|
||||
static void recv_cb(const uint8_t *mac, const uint8_t *data, int len);
|
||||
#endif
|
||||
static void send_cb(const uint8_t *mac, esp_now_send_status_t status);
|
||||
|
||||
/**
|
||||
@@ -90,7 +95,7 @@ private:
|
||||
* @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
|
||||
|
||||
Reference in new issue
Block a user