Skip to content

Commit 3ad17de

Browse files
SuGliderlucasssvazme-no-dev
authored
fix(build): make core compatible with IDF 5.3 (#11607)
* fix(uart): make it compatible with IDF 5.3 * fix(ci): Fix artifact names * fix(build): Fix ESP_NOW and WiFi for IDF 5.3 * fix(build): Fix NetworkClient for IDF 5.3 * fix(build): Fix WiFi for IDF 5.3 * fix(build): Fix WiFi Captive Portal for IDF 5.3 --------- Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Co-authored-by: me-no-dev <hristo@espressif.com>
1 parent 211a0ce commit 3ad17de

File tree

8 files changed

+28
-5
lines changed

8 files changed

+28
-5
lines changed

cores/esp32/esp32-hal-uart.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,12 @@ static esp_err_t _uartInternalSetPin(uart_port_t uart_num, int tx_io_num, int rx
389389
#endif
390390
if (tx_rx_same_io || !_uartTrySetIomuxPin(uart_num, rx_io_num, SOC_UART_RX_PIN_IDX)) {
391391
if (uart_num < SOC_UART_HP_NUM) {
392+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
392393
gpio_input_enable(rx_io_num);
394+
#else
395+
gpio_func_sel(rx_io_num, PIN_FUNC_GPIO);
396+
gpio_ll_input_enable(&GPIO, rx_io_num);
397+
#endif
393398
esp_rom_gpio_connect_in_signal(rx_io_num, UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX), 0);
394399
}
395400
#if SOC_LP_GPIO_MATRIX_SUPPORTED
@@ -422,8 +427,14 @@ static esp_err_t _uartInternalSetPin(uart_port_t uart_num, int tx_io_num, int rx
422427

423428
if (cts_io_num >= 0 && !_uartTrySetIomuxPin(uart_num, cts_io_num, SOC_UART_CTS_PIN_IDX)) {
424429
if (uart_num < SOC_UART_HP_NUM) {
430+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
425431
gpio_pullup_en(cts_io_num);
426432
gpio_input_enable(cts_io_num);
433+
#else
434+
gpio_func_sel(cts_io_num, PIN_FUNC_GPIO);
435+
gpio_set_pull_mode(cts_io_num, GPIO_PULLUP_ONLY);
436+
gpio_set_direction(cts_io_num, GPIO_MODE_INPUT);
437+
#endif
427438
esp_rom_gpio_connect_in_signal(cts_io_num, UART_PERIPH_SIGNAL(uart_num, SOC_UART_CTS_PIN_IDX), 0);
428439
}
429440
#if SOC_LP_GPIO_MATRIX_SUPPORTED

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/Network/src/NetworkClient.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@
2323
#include <lwip/netdb.h>
2424
#include <errno.h>
2525

26-
// It is already defined in IDF as:
27-
//#define IN6_IS_ADDR_V4MAPPED(a) ip6_addr_isipv4mappedipv6((ip6_addr_t*)(a))
28-
//#define ip6_addr_isipv4mappedipv6(ip6addr) (((ip6addr)->addr[0] == 0) && ((ip6addr)->addr[1] == 0) && (((ip6addr)->addr[2]) == PP_HTONL(0x0000FFFFUL)))
29-
// Keeping as a memory of the change.
30-
//#define _IN6_IS_ADDR_V4MAPPED(a) ((((__const uint32_t *)(a))[0] == 0) && (((__const uint32_t *)(a))[1] == 0) && (((__const uint32_t *)(a))[2] == htonl(0xffff)))
26+
#ifndef IN6_IS_ADDR_V4MAPPED
27+
#define IN6_IS_ADDR_V4MAPPED(a) ((((__const uint32_t *)(a))[0] == 0) && (((__const uint32_t *)(a))[1] == 0) && (((__const uint32_t *)(a))[2] == htonl(0xffff)))
28+
#endif
3129

3230
#define WIFI_CLIENT_DEF_CONN_TIMEOUT_MS (3000)
3331
#define WIFI_CLIENT_MAX_WRITE_RETRY (10)

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/AP.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ bool APClass::enableNAPT(bool enable) {
305305
return true;
306306
}
307307

308+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
308309
bool APClass::enableDhcpCaptivePortal() {
309310
esp_err_t err = ESP_OK;
310311
static char captiveportal_uri[32] = {
@@ -343,6 +344,7 @@ bool APClass::enableDhcpCaptivePortal() {
343344

344345
return true;
345346
}
347+
#endif
346348

347349
String APClass::SSID(void) const {
348350
if (!started()) {

libraries/WiFi/src/WiFiAP.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ class APClass : public NetworkInterface {
5353

5454
bool bandwidth(wifi_bandwidth_t bandwidth);
5555
bool enableNAPT(bool enable = true);
56+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
5657
bool enableDhcpCaptivePortal();
58+
#endif
5759

5860
String SSID(void) const;
5961
uint8_t stationCount();

libraries/WiFi/src/WiFiGeneric.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ wifi_ps_type_t WiFiGenericClass::getSleep() {
781781
return _sleepEnabled;
782782
}
783783

784+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
784785
/**
785786
* control wifi band mode
786787
* @param band_mode enum possible band modes
@@ -843,6 +844,7 @@ wifi_band_mode_t WiFiGenericClass::getBandMode() {
843844
return WIFI_BAND_MODE_2G_ONLY;
844845
#endif
845846
}
847+
#endif
846848

847849
/**
848850
* get the current active wifi band

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)