From 6dff1d2cb1f90b97e6e480291c92c59dca51696b Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 8 Feb 2026 03:25:20 +0100 Subject: [PATCH] more V4 vs V5 compatibility fixes --- platformio.ini | 3 ++- wled00/network.cpp | 13 ++++++++++++- wled00/src/dependencies/espalexa/Espalexa.h | 2 +- wled00/util.cpp | 4 ++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index a738e73f5..dc38103aa 100644 --- a/platformio.ini +++ b/platformio.ini @@ -14,7 +14,7 @@ default_envs = ; nodemcuv2 ; esp8266_2m ; esp01_1m_full - ; nodemcuv2_160 + nodemcuv2_160 ;; 8266 regression test build ; esp8266_2m_160 ; esp01_1m_full_160 ; nodemcuv2_compat @@ -513,6 +513,7 @@ build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_ -DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3 -D WLED_DISABLE_INFRARED ;; TODO: remove once we have updated for V5 -D WLED_USE_SHARED_RMT ;; TODO: disabled NeoEsp32RmtMethodIsr + -D WLED_USE_ETHERNET -D RLYPIN=-1 -D BTNPIN=-1 ;; TODO: this is just for testing - remove before merging to main lib_deps = ${esp32_idf_V4.lib_deps} lib_ignore = NeoESP32RmtHI ;; TODO: disabled NeoEsp32RmtMethodIsr diff --git a/wled00/network.cpp b/wled00/network.cpp index 1afceca93..1646dd4a6 100644 --- a/wled00/network.cpp +++ b/wled00/network.cpp @@ -231,7 +231,8 @@ bool initEthernet() } #endif - if (!ETH.begin( +#if defined(ESP_IDF_VERSION) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) + if (!ETH.begin( // parameter order in V5 has changed (eth_phy_type_t) es.eth_type, (int32_t) es.eth_address, (int) es.eth_mdc, @@ -239,6 +240,16 @@ bool initEthernet() (int) es.eth_power, (eth_clock_mode_t) es.eth_clk_mode )) { +#else + if (!ETH.begin( + (uint8_t) es.eth_address, + (int) es.eth_power, + (int) es.eth_mdc, + (int) es.eth_mdio, + (eth_phy_type_t) es.eth_type, + (eth_clock_mode_t) es.eth_clk_mode + )) { +#endif DEBUG_PRINTLN(F("initE: ETH.begin() failed")); // de-allocate the allocated pins for (managed_pin_type mpt : pinsToAllocate) { diff --git a/wled00/src/dependencies/espalexa/Espalexa.h b/wled00/src/dependencies/espalexa/Espalexa.h index b8fa2ea09..dae88d8f1 100644 --- a/wled00/src/dependencies/espalexa/Espalexa.h +++ b/wled00/src/dependencies/espalexa/Espalexa.h @@ -270,7 +270,7 @@ private: EA_DEBUGLN(body); }); #ifndef ESPALEXA_NO_SUBPAGE - serverAsync->on("/espalexa", HTTP_GET, [=](AsyncWebServerRequest *request){server = request; servePage();}); + serverAsync->on("/espalexa", HTTP_GET, [this](AsyncWebServerRequest *request){server = request; servePage();}); #endif serverAsync->on("/description.xml", HTTP_GET, [this](AsyncWebServerRequest *request){server = request; serveDescription();}); // fix: implicit capture of "this" serverAsync->begin(); diff --git a/wled00/util.cpp b/wled00/util.cpp index 834503a8c..b58a16bdb 100644 --- a/wled00/util.cpp +++ b/wled00/util.cpp @@ -13,6 +13,10 @@ #endif #include "mbedtls/sha1.h" // for SHA1 on ESP32 #include "esp_efuse.h" + #include "esp_chip_info.h" + #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) + #include // V5 requirement + #endif #endif