Skip to content

Commit 7c9d6ff

Browse files
committed
fix(build): Fix ESP_NOW and WiFi for IDF 5.3
1 parent 4fa08c5 commit 7c9d6ff

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

libraries/ESP_NOW/src/ESP32_NOW.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#include "esp32-hal.h"
1010
#include "esp_wifi.h"
1111

12+
#ifndef ESP_NOW_MAX_DATA_LEN_V2
13+
#define ESP_NOW_MAX_DATA_LEN_V2 1470
14+
#endif
15+
1216
static void (*new_cb)(const esp_now_recv_info_t *info, const uint8_t *data, int len, void *arg) = nullptr;
1317
static void *new_arg = nullptr; // * tx_arg = nullptr, * rx_arg = nullptr,
1418
static bool _esp_now_has_begun = false;

libraries/WiFi/examples/WiFiScan/WiFiScan.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ void loop() {
5858
Serial.println("-------------------------------------");
5959
Serial.println("Default wifi band mode scan:");
6060
Serial.println("-------------------------------------");
61+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
6162
WiFi.setBandMode(WIFI_BAND_MODE_AUTO);
63+
#endif
6264
ScanWiFi();
6365
#if CONFIG_SOC_WIFI_SUPPORT_5G
6466
// Wait a bit before scanning again.

libraries/WiFi/src/WiFiGeneric.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ bool WiFiGenericClass::setBandMode(wifi_band_mode_t band_mode) {
823823
#endif
824824
}
825825

826+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
826827
/**
827828
* get the current enabled wifi band mode
828829
* @return enum band mode
@@ -864,6 +865,7 @@ wifi_band_t WiFiGenericClass::getBand() {
864865
return WIFI_BAND_2G;
865866
#endif
866867
}
868+
#endif
867869

868870
/**
869871
* control wifi tx power

libraries/WiFi/src/WiFiGeneric.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ class WiFiGenericClass {
116116
bool setTxPower(wifi_power_t power);
117117
wifi_power_t getTxPower();
118118

119+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
119120
bool setBandMode(wifi_band_mode_t band_mode);
120121
wifi_band_mode_t getBandMode();
122+
#endif
121123
wifi_band_t getBand();
122124

123125
bool initiateFTM(uint8_t frm_count = 16, uint16_t burst_period = 2, uint8_t channel = 1, const uint8_t *mac = NULL);

0 commit comments

Comments
 (0)