From 428d63dcc9699c3e092f7251eca82e90d086ec25 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sat, 29 Nov 2025 23:16:43 +0100 Subject: [PATCH 1/4] bugfix for reboot loop affecting V3 "legacy" builds * ``-DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE`` caused a crash when mounting the filesystem * added "extends = " to MM legacy buildenvs * make sure that flash_mode is always well-defined --- platformio.ini | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index cd2e7e41..adf3a7ca 100644 --- a/platformio.ini +++ b/platformio.ini @@ -333,6 +333,7 @@ platform = espressif32@3.5.0 platform_packages = framework-arduinoespressif32 @ https://github.com/Aircoookie/arduino-esp32.git#1.0.6.4 build_unflags = ${common.build_unflags} -Wshadow=compatible-local ;; not supported by older compilers + ;; -D CORE_DEBUG_LEVEL=0 -DNDEBUG ;; enable core debugging build_flags = -g -Wno-unused-variable -Wno-unused-function ;; removes noise -DARDUINO_ARCH_ESP32 @@ -340,7 +341,8 @@ build_flags = -g -D CONFIG_ASYNC_TCP_TASK_STACK_SIZE=9472 ;; WLEDMM increase stack by 1.25Kb, as audioreactive needs bigger SETTINGS_STACK_BUF_SIZE -D CONFIG_ASYNC_TCP_STACK_SIZE=9472 -D LOROL_LITTLEFS ;; use LITTLEFS library by lorol in ESP32 core 1.x.x instead of built-in in 2.x.x - -DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE + ;; -D CORE_DEBUG_LEVEL=5 ;; enable core debug messages + ;; -DDEBUG -DWLED_DEBUG ;; enable WLED debug messages lib_deps = esp32async/AsyncTCP @ 3.4.7 ; https://github.com/lorol/LITTLEFS.git @@ -348,11 +350,12 @@ lib_deps = makuna/NeoPixelBus @ 2.7.5 ;; makuna/NeoPixelBus @ 2.7.9 ;; experimental ${env.lib_deps} +monitor_filters = esp32_exception_decoder board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs default_partitions = ${esp32.default_partitions} ;; backwards compatibility board_build.f_flash = 80000000L board_build.flash_mode = dout ;; avoid dio/quot/qio - these are broken in arduino-esp32 1.0.6.x - +;;board_build.flash_mode = dio ;; standard platform for esp32 [esp32] @@ -376,6 +379,8 @@ monitor_filters = esp32_exception_decoder AR_build_flags = ${common_mm.AR_build_flags} AR_lib_deps = ${common_mm.AR_lib_deps} ;; optimized version, 10% faster on -S2/-C3 board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs +board_build.f_flash = 80000000L +board_build.flash_mode = dio ;; WLEDMM begin @@ -449,6 +454,9 @@ lib_deps = ;; makuna/NeoPixelBus @ 2.7.9 ;; experimental ${env.lib_deps} board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs +monitor_filters = esp32_exception_decoder +board_build.f_flash = 80000000L +board_build.flash_mode = dio [esp32s2] ;; generic definitions for all ESP32-S2 boards @@ -637,6 +645,7 @@ extends = env:esp32_4MB_PSRAM_S ;; legacy build for OTA compatibility with upstream 0.15.x, slow but safe [env:esp32dev_compat] +extends = esp32_legacy board = esp32dev platform = ${esp32_legacy.platform} platform_packages = ${esp32_legacy.platform_packages} @@ -652,6 +661,7 @@ monitor_filters = esp32_exception_decoder ;; legacy build for OTA compatibility with upstream 0.15.x, faster due to qio mode [env:esp32dev_qio80_compat] +extends = esp32_legacy board = esp32dev platform = ${esp32_legacy.platform} platform_packages = ${esp32_legacy.platform_packages} @@ -686,6 +696,7 @@ extends = env:esp32_4MB_M_eth ;; legacy build for OTA compatibility with upstream 0.15.x ;; --> use [env:esp32_4MB_M_eth] (4MB) or [env:esp32_16MB_M_eth] [env:esp32_eth_compat] +extends = esp32_legacy board = esp32-poe platform = ${esp32_legacy.platform} platform_packages = ${esp32_legacy.platform_packages} @@ -1227,6 +1238,7 @@ lib_deps_XL = ; common defaults for all MM environments [esp32_4MB_S_base] +extends = esp32_legacy board = esp32dev ;; legacy V3 platform platform = ${esp32_legacy.platform} From 963b4075b86e61118e22e0956a4157ab17f9b356 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 30 Nov 2025 01:09:51 +0100 Subject: [PATCH 2/4] chip revision style: v. --- wled00/json.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index 599a0a4a..a27c147f 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -1133,12 +1133,12 @@ void serializeInfo(JsonObject root) root[F("e32code")] = (int)getRestartReason(); root[F("e32text")] = restartCode2Info(getRestartReason()); - static char msgbuf[32]; + static char msgbuf[42]; #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 3) // use the full revision if we can esp_chip_info_t chip_info; esp_chip_info(&chip_info); - snprintf(msgbuf, sizeof(msgbuf)-1, "%s rev%u.%u", + snprintf(msgbuf, sizeof(msgbuf)-1, "%s v%u.%u", ESP.getChipModel(), unsigned(chip_info.full_revision / 100), // full revision is in (major * 100 + minor) format unsigned(chip_info.full_revision % 100)); From e17e67f02d3b6e327355de5aee3833c0d5d30de8 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 30 Nov 2025 01:21:26 +0100 Subject: [PATCH 3/4] adding monitor_filters --- platformio.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index adf3a7ca..7981f38f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1297,7 +1297,7 @@ board_build.partitions = ${esp32.extended_partitions} ;; 1.65MB firmware, 700KB board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz) board_build.flash_mode = dio ; (dio = dual i/o; more compatible than qio = quad i/o) ;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; monitor_filters = esp32_exception_decoder ; used to show crash details +monitor_filters = esp32_exception_decoder ; used to show crash details [esp32_4MB_V4_M_base] extends = esp32_4MB_V4_S_base @@ -2189,6 +2189,7 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-inden lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M} ${common_mm.HUB75_lib_deps} ;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation +monitor_filters = esp32_exception_decoder board_build.partitions = tools/WLED_ESP32_8MB.csv ; RAM: [== ] 21.1% (used 69156 bytes from 327680 bytes) ; Flash: [======== ] 75.9% (used 1591817 bytes from 2097152 bytes) From 15451c16f9e67a69b5ec56fe7777d20a28d729c1 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 30 Nov 2025 01:22:34 +0100 Subject: [PATCH 4/4] reduce debug noise on serial downgraded a few USER_PRINT to DEBUG_PRINT --- wled00/FX_2Dfcn.cpp | 4 ++-- wled00/FX_fcn.cpp | 7 ++++--- wled00/wled_server.cpp | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index f58ba016..8231fc52 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -44,7 +44,7 @@ void WS2812FX::setUpMatrix() { return; } - USER_PRINTF("setUpMatrix %d x %d\n", Segment::maxWidth, Segment::maxHeight); + DEBUG_PRINTF("setUpMatrix %d x %d\n", Segment::maxWidth, Segment::maxHeight); // WLEDMM check if mapping table is necessary (avoiding heap fragmentation) #if defined(WLED_ENABLE_HUB75MATRIX) @@ -66,7 +66,7 @@ void WS2812FX::setUpMatrix() { if (Segment::maxWidth * Segment::maxHeight > customMappingTableSize) { size_t size = max(ledmapMaxSize, size_t(Segment::maxWidth * Segment::maxHeight)); // TroyHacks if (!needLedMap) size = 0; // softhack007 - USER_PRINTF("setupmatrix customMappingTable alloc %d from %d\n", size, customMappingTableSize); + DEBUG_PRINTF("setupmatrix customMappingTable alloc %d from %d\n", size, customMappingTableSize); //if (customMappingTable != nullptr) delete[] customMappingTable; //customMappingTable = new(std::nothrow) uint16_t[size]; diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index d307b5b8..51722c9a 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -61,7 +61,7 @@ static portMUX_TYPE s_wled_strip_mux = portMUX_INITIALIZER_UNLOCKED; // to prote void strip_wait_until_idle(String whoCalledMe) { #if defined(ARDUINO_ARCH_ESP32) && defined(WLEDMM_PROTECT_SERVICE) // WLEDMM experimental if (strip.isServicing() && (strncmp(pcTaskGetTaskName(NULL), "loopTask", 8) != 0)) { // if we are in looptask (arduino loop), its safe to proceed without waiting - USER_PRINTLN(whoCalledMe + String(": strip is still drawing effects.")); + DEBUG_PRINTLN(whoCalledMe + String(": strip is still drawing effects.")); strip.waitUntilIdle(); } #endif @@ -115,7 +115,7 @@ void Segment::allocLeds() { } // softhack007 clean up buffer } if ((size > 0) && (!ledsrgb || size > ledsrgbSize)) { //softhack dont allocate zero bytes - USER_PRINTF("allocLeds (%d,%d to %d,%d), %u from %u\n", start, startY, stop, stopY, size, ledsrgb?ledsrgbSize:0); + DEBUG_PRINTF("allocLeds (%d,%d to %d,%d), %u from %u\n", start, startY, stop, stopY, size, ledsrgb?ledsrgbSize:0); if (ledsrgb) free(ledsrgb); // we need a bigger buffer, so free the old one first ledsrgb = (CRGB*)calloc(size, 1); ledsrgbSize = ledsrgb?size:0; @@ -1903,7 +1903,8 @@ void WS2812FX::waitUntilIdle(void) { delay(2); // Suspending for 1 tick (or more) gives other tasks a chance to run. //yield(); // seems to be a no-op on esp32 } while (isServicing() && (millis() - waitStarted < MAX_IDLE_WAIT_MS)); - USER_PRINTF("strip.waitUntilIdle(): strip %sidle after %d ms. (task %s with prio=%d)\n", isServicing()?"not ":"", int(millis() - waitStarted), pcTaskGetTaskName(NULL), uxTaskPriorityGet(NULL)); + DEBUG_PRINTF("strip.waitUntilIdle(): strip %sidle after %d ms. (task %s with prio=%d)\n", isServicing()?"not ":"", int(millis() - waitStarted), pcTaskGetTaskName(NULL), uxTaskPriorityGet(NULL)); + if (isServicing()) USER_PRINTF("strip.waitUntilIdle(): strip NOT idle after %d ms - overriding access. (task %s with prio=%d)\n", int(millis() - waitStarted), pcTaskGetTaskName(NULL), uxTaskPriorityGet(NULL)); } return; #else diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index 0a0dd50f..0ec12709 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -390,13 +390,13 @@ void initServer() }); #endif server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ - USER_PRINT("Client request"); //WLEDMM: want to see if client connects to wled + DEBUG_PRINT("Client request"); //WLEDMM: want to see if client connects to wled #ifdef ARDUINO_ARCH_ESP32 DEBUG_PRINTF("%s min free stack %d\n", pcTaskGetTaskName(NULL), uxTaskGetStackHighWaterMark(NULL)); //WLEDMM #endif if (captivePortal(request)) return; serveIndexOrWelcome(request); - USER_PRINTLN(" done"); //WLEDMM: want to see if client connects to wled + DEBUG_PRINTLN(" done"); //WLEDMM: want to see if client connects to wled }); #ifdef WLED_ENABLE_PIXART