From 7ca4fc070b54301e6438f6d56770e0e3f40677f7 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 23 Apr 2024 15:56:08 +0200 Subject: [PATCH 01/42] Merge pull request #3902 from Aircoookie/arduino_2_0_9 update esp32 platform to arduino-esp32 v2.0.9 --- platformio.ini | 64 +++++++++++++++++++++++--------- tools/WLED_ESP32_4MB_700k_FS.csv | 6 +++ 2 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 tools/WLED_ESP32_4MB_700k_FS.csv diff --git a/platformio.ini b/platformio.ini index 2da68bd7..5d4d0489 100644 --- a/platformio.ini +++ b/platformio.ini @@ -307,6 +307,13 @@ build_flags = -g default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv ;; WLED standard for 4MB flash: 1.4MB firmware, 1MB filesystem ;default_partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; WLEDMM alternative for 4MB flash: 1.8MB firmware, 256KB filesystem (esptool erase_flash needed before changing) +tiny_partitions = tools/WLED_ESP32_2MB_noOTA.csv +default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv +extended_partitions = tools/WLED_ESP32_4MB_700k_FS.csv +big_partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem, coredump support +large_partitions = tools/WLED_ESP32_8MB.csv +extreme_partitions = tools/WLED_ESP32_16MB_9MB_FS.csv + lib_deps = https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 ;; WLEDMM this must be first in the list, otherwise Aircoookie/ESPAsyncWebServer pulls in an older version of AsyncTCP !! ; https://github.com/lorol/LITTLEFS.git @@ -323,8 +330,8 @@ platformV4_pre = espressif32@5.2.0 platformV4_packages_pre = toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 ; required for platform version < 5.3.0, remove this line when upgrading to platform >=5.3.0 ;;; standard V4 platform -platformV4 = espressif32@5.3.0 -platformV4_packages = +platformV4 = espressif32@ ~6.3.2 +platformV4_packages = platformio/framework-arduinoespressif32 @ 3.20009.0 ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) ;;; experimental: latest V4 platform with latest arduino-esp32 2.0.9 + ESP-IDF 4.4.4 (may or may not work) platformV4_xp = espressif32@ ~6.4.0 @@ -355,8 +362,8 @@ lib_depsV4 = ;; ;; please note that you can NOT update existing ESP32 installs with a "V4" build. Also updating by OTA will not work properly. ;; You need to completely erase your device (esptool erase_flash) first, then install the "V4" build from VSCode+platformio. -platform = espressif32@5.3.0 -platform_packages = +platform = espressif32@ ~6.3.2 +platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0 ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) build_flags = -g -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one -DARDUINO_ARCH_ESP32 -DESP32 @@ -372,10 +379,13 @@ lib_deps = [esp32s2] ;; generic definitions for all ESP32-S2 boards -platform = espressif32@5.2.0 -platform_packages = - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 - toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5 +;;platform = espressif32@5.2.0 +;;platform_packages = +;; toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 +;; toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5 +platform = espressif32@ ~6.3.2 +platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0 ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) + build_flags = -g -DARDUINO_ARCH_ESP32 -DESP32 ;; WLEDMM -DARDUINO_ARCH_ESP32S2 @@ -396,8 +406,8 @@ lib_deps = [esp32c3] ;; generic definitions for all ESP32-C3 boards -platform = espressif32@5.3.0 -platform_packages = +platform = espressif32@ ~6.3.2 +platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0 ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) build_flags = -g -DARDUINO_ARCH_ESP32 -DESP32 ;; WLEDMM -DARDUINO_ARCH_ESP32C3 @@ -417,8 +427,8 @@ lib_deps = [esp32s3] ;; generic definitions for all ESP32-S3 boards -platform = espressif32@5.3.0 -platform_packages = +platform = espressif32@ ~6.3.2 +platform_packages = platformio/framework-arduinoespressif32 @ 3.20009.0 ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) build_flags = -g -DESP32 -DARDUINO_ARCH_ESP32 @@ -431,7 +441,6 @@ build_flags = -g -DCO ;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry: ;; ARDUINO_USB_MODE, ARDUINO_USB_CDC_ON_BOOT - lib_deps = https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 makuna/NeoPixelBus @ 2.7.5 @@ -602,13 +611,29 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} #-D WLED_RELEASE_NAME -DARDUINO_USB_CDC_ON_BOOT=1 lib_deps = ${esp32s2.lib_deps} +[env:esp32_wrover] +extends = esp32_idf_V4 +platform = ${esp32_idf_V4.platform} +platform_packages = ${esp32_idf_V4.platform_packages} +board = ttgo-t7-v14-mini32 +board_build.f_flash = 80000000L +board_build.flash_mode = qio +board_build.partitions = ${esp32.extended_partitions} +build_unflags = ${common.build_unflags} +build_flags = ${common.build_flags_esp32_V4} -D WLED_RELEASE_NAME=ESP32_WROVER + -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html + -D LEDPIN=25 + ; ${esp32.AR_build_flags} +lib_deps = ${esp32_idf_V4.lib_deps} + ; ${esp32.AR_lib_deps} + [env:esp32c3dev] extends = esp32c3 platform = ${esp32c3.platform} platform_packages = ${esp32c3.platform_packages} framework = arduino board = esp32-c3-devkitm-1 -board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv +board_build.partitions = ${esp32.default_partitions} build_flags = ${common.build_flags} ${esp32c3.build_flags} -D WLED_RELEASE_NAME=ESP32-C3 -D WLED_WATCHDOG_TIMEOUT=0 -DLOLIN_WIFI_FIX ; seems to work much better with this @@ -631,7 +656,8 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME= ;-D ARDUINO_USB_CDC_ON_BOOT=1 ;; -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB") ;-D WLED_DEBUG lib_deps = ${esp32s3.lib_deps} -board_build.partitions = tools/WLED_ESP32_8MB.csv + ${esp32.AR_lib_deps} +board_build.partitions = ${esp32.large_partitions} board_build.f_flash = 80000000L board_build.flash_mode = qio ; board_build.flash_mode = dio ;; try this if you have problems at startup @@ -652,7 +678,8 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} ; -D WLED_RELEASE_NAME=ESP32-S3_PSRAM -D WLED_USE_PSRAM -DBOARD_HAS_PSRAM ; tells WLED that PSRAM shall be used lib_deps = ${esp32s3.lib_deps} -board_build.partitions = tools/WLED_ESP32_8MB.csv + ${esp32.AR_lib_deps} +board_build.partitions = ${esp32.large_partitions} board_build.f_flash = 80000000L board_build.flash_mode = qio monitor_filters = esp32_exception_decoder @@ -735,8 +762,11 @@ lib_deps = ${esp8266.lib_deps} platform = ${esp32s2.platform} platform_packages = ${esp32s2.platform_packages} board = lolin_s2_mini -board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv +board_build.partitions = ${esp32.default_partitions} build_unflags = ${common.build_unflags} #-DARDUINO_USB_CDC_ON_BOOT=1 +;board_build.flash_mode = qio +;board_build.f_flash = 80000000L +build_unflags = ${common.build_unflags} build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32-S2 -DBOARD_HAS_PSRAM -DARDUINO_USB_CDC_ON_BOOT=1 # try disabling and enabling unflag above in case of board-specific issues, will disable Serial diff --git a/tools/WLED_ESP32_4MB_700k_FS.csv b/tools/WLED_ESP32_4MB_700k_FS.csv new file mode 100644 index 00000000..39c88e54 --- /dev/null +++ b/tools/WLED_ESP32_4MB_700k_FS.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x1A0000, +app1, app, ota_1, 0x1B0000,0x1A0000, +spiffs, data, spiffs, 0x350000,0xB0000, From e743c9b96c81694d1b74a310c64291054f0aa345 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:32:38 +0200 Subject: [PATCH 02/42] post-merge fixes, upgrade ESPAsyncWebServer 2.2.1 --- platformio.ini | 51 ++++++++++++++++++++++++++------------------------ wled00/wled.h | 2 +- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/platformio.ini b/platformio.ini index 5d4d0489..0ca78e9e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -239,8 +239,8 @@ lib_deps = IRremoteESP8266 @ 2.8.2 ;;makuna/NeoPixelBus @ 2.7.5 ;; WLEDMM will be added in board specific sections ;;https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.7 - https://github.com/lost-hope/ESPAsyncWebServer.git#master ;; WLEDMM to display .log and .wled files in /edit - ;; https://github.com/Aircoookie/ESPAsyncWebServer.git @ ^2.2.1 + ;; https://github.com/lost-hope/ESPAsyncWebServer.git#master ;; WLEDMM to display .log and .wled files in /edit + https://github.com/Aircoookie/ESPAsyncWebServer.git @ 2.2.1 ;; newer with bugfixes and stability improvements #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line #TFT_eSPI #For compatible OLED display uncomment following @@ -308,7 +308,6 @@ default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv ;; WLED standard for 4 ;default_partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; WLEDMM alternative for 4MB flash: 1.8MB firmware, 256KB filesystem (esptool erase_flash needed before changing) tiny_partitions = tools/WLED_ESP32_2MB_noOTA.csv -default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv extended_partitions = tools/WLED_ESP32_4MB_700k_FS.csv big_partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem, coredump support large_partitions = tools/WLED_ESP32_8MB.csv @@ -322,6 +321,10 @@ lib_deps = makuna/NeoPixelBus @ 2.7.5 ${env.lib_deps} +;; Compatibility with upstream --> you should prefer using ${common_mm.build_flags_S} and ${common_mm.lib_deps_S} +AR_build_flags = -D USERMOD_AUDIOREACTIVE -D UM_AUDIOREACTIVE_USE_NEW_FFT +AR_lib_deps = https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2 ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 + ;; WLEDMM begin ;; ** For compiling with latest Frameworks (IDF4.4.x and arduino-esp32 v2.0.x) ** @@ -350,8 +353,8 @@ build_flagsV4 = -g lib_depsV4 = https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 ;; WLEDMM this must be first in the list, otherwise Aircoookie/ESPAsyncWebServer pulls in an older version of AsyncTCP !! makuna/NeoPixelBus @ 2.7.5 - ${env.lib_deps} https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.10 + ${env.lib_deps} ;; WLEDMM end @@ -379,8 +382,8 @@ lib_deps = [esp32s2] ;; generic definitions for all ESP32-S2 boards -;;platform = espressif32@5.2.0 -;;platform_packages = +;; platform = espressif32@5.2.0 +;; platform_packages = ;; toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 ;; toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5 platform = espressif32@ ~6.3.2 @@ -611,21 +614,22 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} #-D WLED_RELEASE_NAME -DARDUINO_USB_CDC_ON_BOOT=1 lib_deps = ${esp32s2.lib_deps} -[env:esp32_wrover] -extends = esp32_idf_V4 -platform = ${esp32_idf_V4.platform} -platform_packages = ${esp32_idf_V4.platform_packages} -board = ttgo-t7-v14-mini32 -board_build.f_flash = 80000000L -board_build.flash_mode = qio -board_build.partitions = ${esp32.extended_partitions} -build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags_esp32_V4} -D WLED_RELEASE_NAME=ESP32_WROVER - -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html - -D LEDPIN=25 - ; ${esp32.AR_build_flags} -lib_deps = ${esp32_idf_V4.lib_deps} - ; ${esp32.AR_lib_deps} +;; WLEDMM: use WLEDMM build environments +;; [env:esp32_wrover] +;; extends = esp32_idf_V4 +;; platform = ${esp32_idf_V4.platform} +;; platform_packages = ${esp32_idf_V4.platform_packages} +;; board = ttgo-t7-v14-mini32 +;; board_build.f_flash = 80000000L +;; board_build.flash_mode = qio +;; board_build.partitions = ${esp32.extended_partitions} +;; build_unflags = ${common.build_unflags} +;; build_flags = ${common.build_flags_esp32_V4} -D WLED_RELEASE_NAME=ESP32_WROVER +;; -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html +;; -D LEDPIN=25 +;; ; ${esp32.AR_build_flags} +;; lib_deps = ${esp32_idf_V4.lib_deps} +;; ; ${esp32.AR_lib_deps} [env:esp32c3dev] extends = esp32c3 @@ -764,9 +768,8 @@ platform_packages = ${esp32s2.platform_packages} board = lolin_s2_mini board_build.partitions = ${esp32.default_partitions} build_unflags = ${common.build_unflags} #-DARDUINO_USB_CDC_ON_BOOT=1 -;board_build.flash_mode = qio -;board_build.f_flash = 80000000L -build_unflags = ${common.build_unflags} +;; board_build.flash_mode = qio +;; board_build.f_flash = 80000000L build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32-S2 -DBOARD_HAS_PSRAM -DARDUINO_USB_CDC_ON_BOOT=1 # try disabling and enabling unflag above in case of board-specific issues, will disable Serial diff --git a/wled00/wled.h b/wled00/wled.h index 92b121f0..5e5048dd 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2404201 +#define VERSION 2404230 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ From a3da6d604edddae7836ba0f341217ac7be90cb3d Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:37:21 +0200 Subject: [PATCH 03/42] version bump -b31.38 --- .github/ISSUE_TEMPLATE/bug.yml | 2 +- package-lock.json | 4 ++-- package.json | 2 +- wled00/improv.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 9f6250cb..2cb69644 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -48,7 +48,7 @@ body: attributes: label: What version/release of MM WLED? description: You can find this in by going to Config -> Security & Updates -> Scroll to Bottom. Copy and paste the entire line after "Server message" - placeholder: "e.g. build 2401290, WLEDMM_0.14.1-b30.37_esp32_4MB_M.bin" + placeholder: "e.g. build 2401290, WLEDMM_0.14.1-b31.38_esp32_4MB_M.bin" validations: required: true - type: dropdown diff --git a/package-lock.json b/package-lock.json index eead5461..b4bcd63e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wled", - "version": "0.14.1-b30.37", + "version": "0.14.1-b31.38", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "wled", - "version": "0.14.1-b30.37", + "version": "0.14.1-b31.38", "license": "GPL-3.0-or-later", "dependencies": { "clean-css": "^4.2.3", diff --git a/package.json b/package.json index 920024ce..347fec25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wled", - "version": "0.14.1-b30.37", + "version": "0.14.1-b31.38", "description": "Tools for WLED project", "main": "tools/cdata.js", "directories": { diff --git a/wled00/improv.cpp b/wled00/improv.cpp index af30065d..646201d3 100644 --- a/wled00/improv.cpp +++ b/wled00/improv.cpp @@ -210,7 +210,7 @@ void sendImprovInfoResponse() { //Use serverDescription if it has been changed from the default "WLED", else mDNS name bool useMdnsName = (strcmp(serverDescription, "WLED") == 0 && strlen(cmDNS) > 0); char vString[32]; - snprintf_P(vString, sizeof(vString)-1, PSTR("0.14.1-b30.37/%i"),VERSION); + snprintf_P(vString, sizeof(vString)-1, PSTR("0.14.1-b31.38/%i"),VERSION); const char *str[4] = {"WLED", vString, bString, useMdnsName ? cmDNS : serverDescription}; sendImprovRPCResult(ImprovRPCType::Request_Info, 4, str); From aa544ac4c506ec8367b99ac07369c5f61651d6ca Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 23 Apr 2024 18:19:09 +0200 Subject: [PATCH 04/42] build fix for adafruit_matrixportal lessons learnt: * never ever use "latest" platform. always pin a version. * do not use "esp32.lib_depsV4" for esp32-S3 --- platformio.ini | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index 0ca78e9e..278d0248 100644 --- a/platformio.ini +++ b/platformio.ini @@ -2335,9 +2335,11 @@ lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} [env:adafruit_matrixportal_esp32s3] -platform = espressif32 ; latest +extends = esp32_4MB_V4_M_base +platform = espressif32@ ~6.5.0 ;; first platform release supporting matrixportal +platform_packages = platformio/framework-arduinoespressif32 @ 3.20014.231204 ;; arduino-esp32 2.0.14 needed - previous versions were missing files for matrixportal board = adafruit_matrixportal_esp32s3 -extends = esp32_4MB_V4_S_base + build_unflags = ${env:esp32S3_8MB_M.build_unflags} ;; use the same as "normal" S3 buildenv build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation ${common_mm.build_flags_S} @@ -2351,7 +2353,9 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-inden -D WLED_USE_PSRAM -DBOARD_HAS_PSRAM ; tells WLED that PSRAM shall be used -D WLED_ENABLE_HUB75MATRIX -D NO_GFX ;-D SPIRAM_FRAMEBUFFER -D DEFAULT_LED_TYPE=101 -lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} - ${common_mm.animartrix_lib_deps} +lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} ;; ;; do not include ${esp32.lib_depsV4} !!!! + ${common_mm.animartrix_lib_deps} + https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.10 + lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation monitor_filters = esp32_exception_decoder From 858610e39bd5581c04d461827d15929d127753a1 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Fri, 26 Apr 2024 21:21:32 +0200 Subject: [PATCH 05/42] trying to reduce flickering The NeoPixelBus RMT driver seems to get stalled when ESP.get.... functions are called (big kernel lock?). Also its glitching during flash file access. This change tries to avoid some conflicts by first checking that the driver is not sending. --- wled00/bus_wrapper.h | 4 ++-- wled00/file.cpp | 8 ++++++++ wled00/json.cpp | 8 ++++++++ wled00/wled.cpp | 8 +++++++- wled00/wled.h | 2 +- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index ada486d5..c6228539 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -1192,8 +1192,8 @@ class PolyBus { if (num > 7) return I_NONE; #else if (num > 8) return I_NONE; - if (num == 1) offset = 2; // use I2S#1 as 2nd bus - seems to be a good compromise for performance, and reduces flickering for some users - // if (num == 0) offset = 2; // un-comment to use I2S#1 as 1st bus - sometimes helps, if you experience flickering during Wifi or filesystem activity. + //if (num == 1) offset = 2; // use I2S#1 as 2nd bus - seems to be a good compromise for performance, and reduces flickering for some users + if (num == 0) offset = 2; // un-comment to use I2S#1 as 1st bus - sometimes helps, if you experience flickering during Wifi or filesystem activity. #endif #endif #endif diff --git a/wled00/file.cpp b/wled00/file.cpp index bf7c1a7a..9d6e6a1e 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -35,6 +35,14 @@ static File f; // don't export to other cpp files //wrapper to find out how long closing takes void closeFile() { + #ifdef ARDUINO_ARCH_ESP32 + // WLEDMM: file.close() triggers flash writing. While flash is writing, the NPB RMT driver cannot fill its buffer which may create glitches. + unsigned long t_wait = millis(); + while(strip.isUpdating() && (millis() - t_wait < 72)) delay(1); // WLEDMM try to catch a moment when strip is idle + while(strip.isUpdating() && (millis() - t_wait < 96)) delay(0); // try harder + //if (strip.isUpdating()) USER_PRINTLN("closeFile: strip still updating."); + delay(2); // might help + #endif #ifdef WLED_DEBUG_FS DEBUGFS_PRINT(F("Close -> ")); uint32_t s = millis(); diff --git a/wled00/json.cpp b/wled00/json.cpp index 8bd9cd2d..dbb51f91 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -1032,6 +1032,14 @@ void serializeInfo(JsonObject root) if(ESP.getChipCores() > 1) // WLEDMM root[F("resetReason1")] = (int)rtc_get_reset_reason(1); #endif + + #if defined(ARDUINO_ARCH_ESP32) + unsigned long t_wait = millis(); + while(strip.isUpdating() && (millis() - t_wait < 125)) delay(1); // WLEDMM try to catch a moment when strip is idle + while(strip.isUpdating() && (millis() - t_wait < 160)) yield(); // try harder + //if (strip.isUpdating()) USER_PRINTLN("serializeInfo: strip still updating."); + #endif + root[F("lwip")] = 0; //deprecated root[F("totalheap")] = ESP.getHeapSize(); //WLEDMM #else diff --git a/wled00/wled.cpp b/wled00/wled.cpp index e8e9eecc..52c1b321 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -1031,6 +1031,12 @@ bool WLED::initEthernet() void WLED::initConnection() { +#ifdef ARDUINO_ARCH_ESP32 + unsigned long t_wait = millis(); + while(strip.isUpdating() && (millis() - t_wait < 86)) delay(1); // WLEDMM try to catch a moment when strip is idle + //if (strip.isUpdating()) USER_PRINTLN("WLED::initConnection: strip still updating."); +#endif + #ifdef WLED_ENABLE_WEBSOCKETS ws.onEvent(wsEvent); #endif @@ -1208,7 +1214,7 @@ void WLED::handleConnection() static unsigned retryCount = 0; // WLEDMM #ifdef ARDUINO_ARCH_ESP32 // reconnect WiFi to clear stale allocations if heap gets too low - if (now - heapTime > 5000) { // WLEDMM: updated with better logic for small heap available by block, not total. + if ((!strip.isUpdating()) && (now - heapTime > 5000)) { // WLEDMM: updated with better logic for small heap available by block, not total. // WLEDMM trying to use a moment when the strip is idle #if defined(ARDUINO_ARCH_ESP32S2) uint32_t heap = ESP.getFreeHeap(); // WLEDMM works better on -S2 #else diff --git a/wled00/wled.h b/wled00/wled.h index 5e5048dd..dc3ee12b 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2404230 +#define VERSION 2404260 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ From 0572d3bee9fce83035db4303697f6bdaf37154a4 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Fri, 26 Apr 2024 20:07:27 +0200 Subject: [PATCH 06/42] Bugfix - getPixelColor() for analog - RMT channel (#3922) --- wled00/bus_manager.cpp | 17 ++++++++++++++++- wled00/bus_wrapper.h | 5 +++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 4f68a0ee..bd1d9bf8 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -309,7 +309,22 @@ void BusPwm::setPixelColor(uint16_t pix, uint32_t c) { //does no index check uint32_t BusPwm::getPixelColor(uint16_t pix) { if (!_valid) return 0; - return RGBW32(_data[0], _data[1], _data[2], _data[3]); + // TODO getting the reverse from CCT is involved (a quick approximation when CCT blending is ste to 0 implemented) + switch (_type) { + case TYPE_ANALOG_1CH: //one channel (white), relies on auto white calculation + return RGBW32(0, 0, 0, _data[0]); + case TYPE_ANALOG_2CH: //warm white + cold white + if (cctICused) return RGBW32(0, 0, 0, _data[0]); + else return RGBW32(0, 0, 0, _data[0] + _data[1]); + case TYPE_ANALOG_5CH: //RGB + warm white + cold white + if (cctICused) return RGBW32(_data[0], _data[1], _data[2], _data[3]); + else return RGBW32(_data[0], _data[1], _data[2], _data[3] + _data[4]); + case TYPE_ANALOG_4CH: //RGBW + return RGBW32(_data[0], _data[1], _data[2], _data[3]); + case TYPE_ANALOG_3CH: //standard dumb RGB + return RGBW32(_data[0], _data[1], _data[2], 0); + } + return RGBW32(_data[0], _data[0], _data[0], _data[0]); } void BusPwm::show() { diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index c6228539..398034f7 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -389,6 +389,11 @@ class PolyBus { } }; static void* create(uint8_t busType, uint8_t* pins, uint16_t len, uint8_t channel, uint16_t clock_kHz = 0U) { + #if defined(ARDUINO_ARCH_ESP32) && !(defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)) + // NOTE: "channel" is only used on ESP32 (and its variants) for RMT channel allocation + // since 0.15.0-b3 I2S1 is favoured for classic ESP32 and moved to position 0 (channel 0) so we need to subtract 1 for correct RMT allocation + if (channel > 1) channel--; // accommodate I2S1 which is used as 1st bus on classic ESP32 + #endif void* busPtr = nullptr; switch (busType) { case I_NONE: break; From c723e0043b7c26a171f2e5e0af1efde1ab67fa69 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Fri, 26 Apr 2024 23:49:34 +0200 Subject: [PATCH 07/42] Bugfix for bugfix - thanks @softhack007 --- wled00/bus_wrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index 398034f7..87bc7806 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -392,7 +392,7 @@ class PolyBus { #if defined(ARDUINO_ARCH_ESP32) && !(defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)) // NOTE: "channel" is only used on ESP32 (and its variants) for RMT channel allocation // since 0.15.0-b3 I2S1 is favoured for classic ESP32 and moved to position 0 (channel 0) so we need to subtract 1 for correct RMT allocation - if (channel > 1) channel--; // accommodate I2S1 which is used as 1st bus on classic ESP32 + if (channel > 0) channel--; // accommodate I2S1 which is used as 1st bus on classic ESP32 #endif void* busPtr = nullptr; switch (busType) { From bd8df5e5c881bde9e53cf8c429caed694d1a7f7b Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sat, 27 Apr 2024 19:23:24 +0200 Subject: [PATCH 08/42] WLEDMM specific adjustments --- wled00/bus_manager.cpp | 5 +++++ wled00/bus_wrapper.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index bd1d9bf8..0dad3ffc 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -309,6 +309,10 @@ void BusPwm::setPixelColor(uint16_t pix, uint32_t c) { //does no index check uint32_t BusPwm::getPixelColor(uint16_t pix) { if (!_valid) return 0; +#if 1 + // WLEDMM stick with the old code - we don't have cctICused + return RGBW32(_data[0], _data[1], _data[2], _data[3]); +#else // TODO getting the reverse from CCT is involved (a quick approximation when CCT blending is ste to 0 implemented) switch (_type) { case TYPE_ANALOG_1CH: //one channel (white), relies on auto white calculation @@ -325,6 +329,7 @@ uint32_t BusPwm::getPixelColor(uint16_t pix) { return RGBW32(_data[0], _data[1], _data[2], 0); } return RGBW32(_data[0], _data[0], _data[0], _data[0]); +#endif } void BusPwm::show() { diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index 87bc7806..327da0ad 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -390,10 +390,12 @@ class PolyBus { }; static void* create(uint8_t busType, uint8_t* pins, uint16_t len, uint8_t channel, uint16_t clock_kHz = 0U) { #if defined(ARDUINO_ARCH_ESP32) && !(defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)) + #if defined(WLEDMM_FASTPATH) && !defined(WLEDMM_SLOWPATH) // WLEDMM only for fastpath builds // NOTE: "channel" is only used on ESP32 (and its variants) for RMT channel allocation // since 0.15.0-b3 I2S1 is favoured for classic ESP32 and moved to position 0 (channel 0) so we need to subtract 1 for correct RMT allocation if (channel > 0) channel--; // accommodate I2S1 which is used as 1st bus on classic ESP32 #endif + #endif void* busPtr = nullptr; switch (busType) { case I_NONE: break; From 3567243d1801abb36f99a1c1d78eb20eb4914974 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 28 Apr 2024 18:52:19 +0200 Subject: [PATCH 09/42] small improvements for audioreactive * added ESP_INTR_FLAG_IRAM to reduce lost samples (only on ESP32 without PSRAM) --> may cause crash if used wrongly * FFT_MajorPeak stabilized, by ignoring extreme results --- usermods/audioreactive/audio_reactive.h | 6 ++++++ usermods/audioreactive/audio_source.h | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index c67299e8..8fa65e30 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -617,6 +617,9 @@ void FFTcode(void * parameter) FFT.ComplexToMagnitude(); // Compute magnitudes #endif + float last_majorpeak = FFT_MajorPeak; + float last_magnitude = FFT_Magnitude; + #ifdef FFT_MAJORPEAK_HUMAN_EAR // scale FFT results for(uint_fast16_t binInd = 0; binInd < samplesFFT; binInd++) @@ -629,6 +632,9 @@ void FFTcode(void * parameter) FFT.MajorPeak(&FFT_MajorPeak, &FFT_Magnitude); // let the effects know which freq was most dominant #endif + if (FFT_MajorPeak < (SAMPLE_RATE / samplesFFT)) {FFT_MajorPeak = 1.0f; FFT_Magnitude = 0;} // too low - use zero + if (FFT_MajorPeak > (0.42f * SAMPLE_RATE)) {FFT_MajorPeak = last_majorpeak; FFT_Magnitude = last_magnitude;} // too high - keep last peak + #ifdef FFT_MAJORPEAK_HUMAN_EAR // undo scaling - we want unmodified values for FFTResult[] computations for(uint_fast16_t binInd = 0; binInd < samplesFFT; binInd++) diff --git a/usermods/audioreactive/audio_source.h b/usermods/audioreactive/audio_source.h index 0e0a2153..63ee584a 100644 --- a/usermods/audioreactive/audio_source.h +++ b/usermods/audioreactive/audio_source.h @@ -185,8 +185,12 @@ class I2SSource : public AudioSource { .communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S), //.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, #ifdef WLEDMM_FASTPATH + #if CONFIG_IDF_TARGET_ESP32 && !defined(BOARD_HAS_PSRAM) // still need to test on boards with PSRAM + .intr_alloc_flags = ESP_INTR_FLAG_IRAM|ESP_INTR_FLAG_LEVEL2|ESP_INTR_FLAG_LEVEL3, // IRAM flag reduces missed samples + #else .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2|ESP_INTR_FLAG_LEVEL3, // seems to reduce noise - .dma_buf_count = 28, // 160ms buffer (128 * dma_buf_count / sampleRate) + #endif + .dma_buf_count = 24, // 140ms buffer (128 * dma_buf_count / sampleRate) #else .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2, .dma_buf_count = 8, From d058e33df31ddaa10a70f515118af5f4cc30698b Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 28 Apr 2024 18:57:05 +0200 Subject: [PATCH 10/42] slightly reduce flickering during file access it seems that reading/writing "larger" files from LittleFS causes LED flickering. This change adds a simple cache for "file not found" results, so that repeated file.exists() calls are avoided. --- wled00/fcn_declare.h | 1 + wled00/file.cpp | 31 +++++++++++++++++++++++++++++++ wled00/wled.h | 2 +- wled00/wled_server.cpp | 1 + 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index ff44bbd9..38a18b09 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -93,6 +93,7 @@ bool readObjectFromFileUsingId(const char* file, uint16_t id, JsonDocument* dest bool readObjectFromFile(const char* file, const char* key, JsonDocument* dest); void updateFSInfo(); void closeFile(); +void invalidateFileNameCache(); // WLEDMM call when new files were uploaded //hue.cpp void handleHue(); diff --git a/wled00/file.cpp b/wled00/file.cpp index 9d6e6a1e..84f99c09 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -407,10 +407,33 @@ static String getContentType(AsyncWebServerRequest* request, String filename){ return "text/plain"; } +// WLEDMM +static bool haveLedmapFile = true; +static bool haveIndexFile = true; +static bool haveSkinFile = true; +static bool haveICOFile = true; +static bool haveCpalFile = true; +void invalidateFileNameCache() { // reset "file not found" cache + haveLedmapFile = true; + haveIndexFile = true; + haveSkinFile = true; + haveICOFile = true; + haveCpalFile = true; +} + bool handleFileRead(AsyncWebServerRequest* request, String path){ DEBUG_PRINTLN("WS FileRead: " + path); if(path.endsWith("/")) path += "index.htm"; if(path.indexOf("sec") > -1) return false; + + // WLEDMM shortcuts + if ((haveLedmapFile == false) && path.equals("/ledmap.json")) return false; + if ((haveIndexFile == false) && path.equals("/index.htm")) return false; + if ((haveSkinFile == false) && path.equals("/skin.css")) return false; + if ((haveICOFile == false) && path.equals("/favicon.ico")) return false; + if ((haveCpalFile == false) && path.equals("/cpal.htm")) return false; + // WLEDMM toDO: add file caching (PSRAM) for /presets.json an /cfg.json + String contentType = getContentType(request, path); /*String pathWithGz = path + ".gz"; if(WLED_FS.exists(pathWithGz)){ @@ -421,5 +444,13 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){ request->send(WLED_FS, path, contentType); return true; } + //USER_PRINTLN("WS FileRead failed: " + path + " (" + contentType + ")"); + + // WLEDMM cache "file not found" results (reduces LED flickering during UI activities) + if (path.equals("/ledmap.json")) haveLedmapFile = false; + if (path.equals("/index.htm")) haveIndexFile = false; + if (path.equals("/skin.css")) haveSkinFile = false; + if (path.equals("/favicon.ico")) haveICOFile = false; + if (path.equals("/cpal.htm")) haveCpalFile = false; return false; } diff --git a/wled00/wled.h b/wled00/wled.h index dc3ee12b..36170286 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2404260 +#define VERSION 2404280 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index a08e9ea6..f3fe1c08 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -58,6 +58,7 @@ void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t request->_tempFile.close(); USER_PRINT(F("File uploaded: ")); // WLEDMM USER_PRINTLN(filename); // WLEDMM + invalidateFileNameCache(); // WLEDMM if (filename.equalsIgnoreCase("/cfg.json") || filename.equalsIgnoreCase("cfg.json")) { // WLEDMM request->send(200, "text/plain", F("Configuration restore successful.\nRebooting...")); doReboot = true; From 56c76458fda95427fa90ab970d5d5594b1301dd1 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Tue, 13 Feb 2024 11:12:04 +0100 Subject: [PATCH 11/42] Preset caching on chips with PSRAM - credit @akaricchi --- wled00/file.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/wled00/file.cpp b/wled00/file.cpp index 84f99c09..1c325861 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -407,6 +407,47 @@ static String getContentType(AsyncWebServerRequest* request, String filename){ return "text/plain"; } +#if defined(BOARD_HAS_PSRAM) && defined(WLED_USE_PSRAM) +// caching presets in PSRAM may prevent occasional flashes seen when HomeAssitant polls WLED +// original idea by @akaricchi (https://github.com/Akaricchi) +// returns a pointer to the PSRAM buffer updates size parameter +static const uint8_t *getPresetCache(size_t &size) { + static unsigned long presetsCachedTime; + static uint8_t *presetsCached; + static size_t presetsCachedSize; + + if (!psramFound()) { + size = 0; + return nullptr; + } + + if (presetsModifiedTime != presetsCachedTime) { + if (presetsCached) { + free(presetsCached); + presetsCached = nullptr; + } + } + + if (!presetsCached) { + File file = WLED_FS.open("/presets.json", "r"); + if (file) { + presetsCachedTime = presetsModifiedTime; + presetsCachedSize = 0; + presetsCached = (uint8_t*)ps_malloc(file.size() + 1); + if (presetsCached) { + presetsCachedSize = file.size(); + file.read(presetsCached, presetsCachedSize); + presetsCached[presetsCachedSize] = 0; + file.close(); + } + } + } + + size = presetsCachedSize; + return presetsCached; +} +#endif + // WLEDMM static bool haveLedmapFile = true; static bool haveIndexFile = true; @@ -440,6 +481,19 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){ request->send(WLED_FS, pathWithGz, contentType); return true; }*/ + + #if defined(BOARD_HAS_PSRAM) && defined(WLED_USE_PSRAM) + if (path.endsWith("/presets.json")) { + size_t psize; + const uint8_t *presets = getPresetCache(psize); + if (presets) { + AsyncWebServerResponse *response = request->beginResponse_P(200, contentType, presets, psize); + request->send(response); + return true; + } + } + #endif + if(WLED_FS.exists(path)) { request->send(WLED_FS, path, contentType); return true; From de66ec45b70d08d6933f217d4b4d6a14801b7bbc Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 28 Apr 2024 22:56:06 +0200 Subject: [PATCH 12/42] make ALL_JSON_TO_PSRAM the default PSRAM optimizations: always enable ALL_JSON_TO_PSRAM and WLED_USE_PSRAM_JSON --- platformio.ini | 4 ---- wled00/file.cpp | 4 ++-- wled00/wled.h | 10 ++++++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/platformio.ini b/platformio.ini index 278d0248..dcc7b014 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1660,7 +1660,6 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions. -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON ;; -D WLED_USE_PSRAM ;; WLED_USE_PSRAM causes major slow-down (slow LEDs) on some ESP32 boards - ;; -DALL_JSON_TO_PSRAM ;; WLEDMM experimental --> try to force all JSON stuff into PSRAM; gives more free heap. -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes -D WLED_DISABLE_HUESYNC ; RAM 122 bytes; FLASH 6308 bytes -D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes @@ -1695,7 +1694,6 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} ;;${Speed_Flags.build_flags} ;; optimize for speed instead of size --> over 100% flash, but works with 256KB filesystem (alternative partitions file) -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions. -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON ;; -D WLED_USE_PSRAM ;; WLED_USE_PSRAM causes major slow-down (slow LEDs) on some ESP32 boards - ;; -DALL_JSON_TO_PSRAM ;; WLEDMM experimental --> try to force all JSON stuff into PSRAM; gives more free heap. ;;-D CONFIG_ESP32_REV_MIN=3 ;; disables PSRAM bug workarounds in the core, reducing the code size and improving overall performance. -D WLED_RELEASE_NAME=esp32_4MB_PSRAM_REV3_S -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET @@ -1904,7 +1902,6 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0 -D SERVERNAME='"WLED-S2"' -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON ;; -D WLED_USE_PSRAM - -DALL_JSON_TO_PSRAM ;; WLEDMM experimental --> try to force all JSON stuff into PSRAM; gives more free heap. -D WLED_DISABLE_LOXONE ;; FLASH 1272 bytes -D WLED_DISABLE_HUESYNC ;; RAM 122 bytes; FLASH 6308 bytes -D WLED_DISABLE_ALEXA ;; RAM 116 bytes; FLASH 13524 bytes @@ -1955,7 +1952,6 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} -Wno-misleading-indentation -Wno-format-truncation -D WLED_RELEASE_NAME=esp32s2_4MB_M -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON ;; -D WLED_USE_PSRAM - ;; -DALL_JSON_TO_PSRAM ;; WLEDMM experimental --> try to force all JSON stuff into PSRAM; gives more free heap. -DLOLIN_WIFI_FIX -DWLEDMM_WIFI_POWERON_HACK ;; seems to work much better with this -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 -D WLED_DISABLE_ADALIGHT ;; disables serial protocols, as the board only has CDC USB diff --git a/wled00/file.cpp b/wled00/file.cpp index 1c325861..d14fe2fc 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -408,9 +408,9 @@ static String getContentType(AsyncWebServerRequest* request, String filename){ } #if defined(BOARD_HAS_PSRAM) && defined(WLED_USE_PSRAM) -// caching presets in PSRAM may prevent occasional flashes seen when HomeAssitant polls WLED +// caching presets in PSRAM may prevent occasional flashes seen when HomeAssistant polls WLED // original idea by @akaricchi (https://github.com/Akaricchi) -// returns a pointer to the PSRAM buffer updates size parameter +// returns a pointer to the PSRAM buffer, updates size parameter static const uint8_t *getPresetCache(size_t &size) { static unsigned long presetsCachedTime; static uint8_t *presetsCached; diff --git a/wled00/wled.h b/wled00/wled.h index 36170286..050df258 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2404280 +#define VERSION 2404281 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ @@ -184,6 +184,12 @@ // There is a code that will still not use PSRAM though: // AsyncJsonResponse is a derived class that implements DynamicJsonDocument (AsyncJson-v6.h) #if defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM) && (defined(WLED_USE_PSRAM) || defined(WLED_USE_PSRAM_JSON)) // WLEDMM +// WLEDMM the JSON_TO_PSRAM feature works, so use it by default +#undef WLED_USE_PSRAM_JSON +#define WLED_USE_PSRAM_JSON +#undef ALL_JSON_TO_PSRAM +#define ALL_JSON_TO_PSRAM + struct PSRAM_Allocator { void* allocate(size_t size) { if (psramFound()) return ps_malloc(size); // use PSRAM if it exists @@ -802,7 +808,7 @@ WLED_GLOBAL int8_t spi_sclk _INIT(HW_PIN_CLOCKSPI); WLED_GLOBAL PSRAMDynamicJsonDocument doc; #else WLED_GLOBAL PSRAMDynamicJsonDocument doc(JSON_BUFFER_SIZE); - #warning experimental - trying to always use dynamic JSON + //#warning trying to always use dynamic JSON in PSRAM #endif #else WLED_GLOBAL StaticJsonDocument doc; From 55552c3e071e8975052b079cbac0e61ea8bbb135 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 29 Apr 2024 00:23:13 +0200 Subject: [PATCH 13/42] Update file.cpp --- wled00/file.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/file.cpp b/wled00/file.cpp index d14fe2fc..3a424b14 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -407,7 +407,7 @@ static String getContentType(AsyncWebServerRequest* request, String filename){ return "text/plain"; } -#if defined(BOARD_HAS_PSRAM) && defined(WLED_USE_PSRAM) +#if defined(BOARD_HAS_PSRAM) && (defined(WLED_USE_PSRAM) || defined(WLED_USE_PSRAM_JSON)) // caching presets in PSRAM may prevent occasional flashes seen when HomeAssistant polls WLED // original idea by @akaricchi (https://github.com/Akaricchi) // returns a pointer to the PSRAM buffer, updates size parameter @@ -482,7 +482,7 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){ return true; }*/ - #if defined(BOARD_HAS_PSRAM) && defined(WLED_USE_PSRAM) + #if defined(BOARD_HAS_PSRAM) && (defined(WLED_USE_PSRAM) || defined(WLED_USE_PSRAM_JSON)) if (path.endsWith("/presets.json")) { size_t psize; const uint8_t *presets = getPresetCache(psize); From 2dae8543df52bf77b2968feb3df27509e6bc89ee Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 29 Apr 2024 00:23:34 +0200 Subject: [PATCH 14/42] new MM buildenv esp32S3_4MB_PSRAM_S MM buildenv for esp32-s3 zero/supermini and lolin S3 mini boards --> 4MB Flash, 2MB PSRAM --- platformio.ini | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/platformio.ini b/platformio.ini index dcc7b014..bad78acc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -74,6 +74,7 @@ default_envs = ; esp32_4MB_PSRAM_REV3_S ;; experimental, optimized for WROVER-E with "revision3" chip esp32S3_8MB_S ;; experimental, optimized for speed esp32S3_8MB_M + esp32S3_4MB_PSRAM_S ;; for lolin s3 mini, S3 zero, S3 super mini ;; esp32S3_8MB_PSRAM_M ;; experiemental ;; esp32s2_tinyUF2_PSRAM_S ;; experimental - only for adafruit -S2 boards with tinyUF2 bootloader !!! esp32s2_PSRAM_M ;; experimental @@ -1872,6 +1873,44 @@ board_build.partitions = tools/WLED_ESP32_8MB.csv ; Flash: [======== ] 78.1% (used 1638737 bytes from 2097152 bytes) +;; MM for esp32-s3 zero/supermini and lolin S3 mini boards - fastpath, optimize for speed +[env:esp32S3_4MB_PSRAM_S] +extends = env:esp32S3_8MB_S +board = lolin_s3_mini ;; -S3 mini: 4MB flash 2MB PSRAM +board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions) + +build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation + ${common_mm.build_flags_S} + -D WLED_RELEASE_NAME=esp32S3_4MB_S + -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON ;; -D WLED_USE_PSRAM + -DCONFIG_MBEDTLS_DYNAMIC_BUFFER=1 ;; optional - allows some buffers to use PSRAM + -DLOLIN_WIFI_FIX -DWLEDMM_WIFI_POWERON_HACK ;; seems to work much better with this + -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Serial-to-USB chip + ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode + -D WLED_DISABLE_ADALIGHT ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor) + ${Speed_Flags.build_flags} ;; optimize for speed instead of size + -D WLEDMM_FASTPATH ;; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions. + ${common_mm.animartrix_build_flags} + -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0 + -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes + -D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes + -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes + -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes + -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes + -D LEDPIN=21 + -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1 + -D HW_PIN_SDA=12 -D HW_PIN_SCL=13 + -D AUDIOPIN=-1 + -D SR_DMTYPE=1 -D I2S_SDPIN=5 -D I2S_WSPIN=6 -D I2S_CKPIN=4 -D MCLK_PIN=7 + ; -D WLED_DEBUG + ; -D SR_DEBUG + ; -D MIC_LOGGER +lib_ignore = + IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation +; RAM: [== ] 20.4% (used 66840 bytes from 327680 bytes) +; Flash: [========= ] 86.5% (used 1644765 bytes from 1900544 bytes) + + ;; MM for Adafruit QT Py ESP32-S2 -> 4MB flash, PSRAM, and tinyUF2 bootloader ;; to ewowi - i'll optimize this entry later, as a few things can be inherited for sure. To softhack: sure ;-) [env:esp32s2_tinyUF2_PSRAM_S] From d61d57d60852d257d55f274bba316edaa6654c15 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:04:47 +0200 Subject: [PATCH 15/42] additional partitions file with 512KB filesystem just enough program space to use S3 mini/zero boards with "optimize for speed" --- platformio.ini | 1 + tools/WLED_ESP32_4MB_512KB_FS.csv | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 tools/WLED_ESP32_4MB_512KB_FS.csv diff --git a/platformio.ini b/platformio.ini index bad78acc..a83ef0a9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1878,6 +1878,7 @@ board_build.partitions = tools/WLED_ESP32_8MB.csv extends = env:esp32S3_8MB_S board = lolin_s3_mini ;; -S3 mini: 4MB flash 2MB PSRAM board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions) +;; board_build.partitions = tools/WLED_ESP32_4MB_512KB_FS.csv ;; 1.7MB firmware, 500KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions) build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation ${common_mm.build_flags_S} diff --git a/tools/WLED_ESP32_4MB_512KB_FS.csv b/tools/WLED_ESP32_4MB_512KB_FS.csv new file mode 100644 index 00000000..5281a612 --- /dev/null +++ b/tools/WLED_ESP32_4MB_512KB_FS.csv @@ -0,0 +1,7 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x1B0000, +app1, app, ota_1, 0x1C0000,0x1B0000, +spiffs, data, spiffs, 0x370000,0x80000, +coredump, data, coredump,,64K \ No newline at end of file From b584962334d4d32047b4fdc306d6c3fd9b22581c Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:06:18 +0200 Subject: [PATCH 16/42] clear presets.json cache on upload needed to avoid inconsistent/corrupted presets after upload or restore. --- wled00/file.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wled00/file.cpp b/wled00/file.cpp index 3a424b14..2b83d7f2 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -439,8 +439,11 @@ static const uint8_t *getPresetCache(size_t &size) { file.read(presetsCached, presetsCachedSize); presetsCached[presetsCachedSize] = 0; file.close(); + //USER_PRINTLN(F("getPresetCache(): /presets.json cached in PSRAM.")); } } + } else { + //USER_PRINTLN(F("getPresetCache(): /presets.json served from PSRAM.")); } size = presetsCachedSize; @@ -460,6 +463,16 @@ void invalidateFileNameCache() { // reset "file not found" cache haveSkinFile = true; haveICOFile = true; haveCpalFile = true; + + #if defined(BOARD_HAS_PSRAM) && (defined(WLED_USE_PSRAM) || defined(WLED_USE_PSRAM_JSON)) + // WLEDMM hack to clear presets.json cache + size_t dummy; + unsigned long realpresetsTime = presetsModifiedTime; + presetsModifiedTime = toki.second(); // pretend we have changes + (void) getPresetCache(dummy); // clear presets.json cache + presetsModifiedTime = realpresetsTime; // restore correct value +#endif + //USER_PRINTLN("WS FileRead cache cleared"); } bool handleFileRead(AsyncWebServerRequest* request, String path){ From f7504dcc36691749de3147980ca1f0f359f0aa3c Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:05:12 +0200 Subject: [PATCH 17/42] presets.json PSRAM caching: consider cacheInvalidate * trying to make the caching mechanism bulletproof. `cacheInvalidate` is changed when - autosave usermod updates presets - a file was upload * (coding style) fixed some unitialized variables --- wled00/file.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wled00/file.cpp b/wled00/file.cpp index 2b83d7f2..5affc666 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -412,16 +412,20 @@ static String getContentType(AsyncWebServerRequest* request, String filename){ // original idea by @akaricchi (https://github.com/Akaricchi) // returns a pointer to the PSRAM buffer, updates size parameter static const uint8_t *getPresetCache(size_t &size) { - static unsigned long presetsCachedTime; - static uint8_t *presetsCached; - static size_t presetsCachedSize; + static unsigned long presetsCachedTime = 0; + static uint8_t *presetsCached = nullptr; + static size_t presetsCachedSize = 0; + static byte presetsCachedValidate = 0; if (!psramFound()) { size = 0; return nullptr; } - if (presetsModifiedTime != presetsCachedTime) { + //if (presetsModifiedTime != presetsCachedTime) DEBUG_PRINTLN(F("getPresetCache(): presetsModifiedTime changed.")); + //if (presetsCachedValidate != cacheInvalidate) DEBUG_PRINTLN(F("getPresetCache(): cacheInvalidate changed.")); + + if ((presetsModifiedTime != presetsCachedTime) || (presetsCachedValidate != cacheInvalidate)) { if (presetsCached) { free(presetsCached); presetsCached = nullptr; @@ -432,6 +436,7 @@ static const uint8_t *getPresetCache(size_t &size) { File file = WLED_FS.open("/presets.json", "r"); if (file) { presetsCachedTime = presetsModifiedTime; + presetsCachedValidate = cacheInvalidate; presetsCachedSize = 0; presetsCached = (uint8_t*)ps_malloc(file.size() + 1); if (presetsCached) { From b2646a8489015af7dee602ae44180e96bf47bfbb Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:11:12 +0200 Subject: [PATCH 18/42] Update file.cpp small optimization, based on upstream https://github.com/Aircoookie/WLED/commit/0593a078c6560ad0507ac3673fa749e85815c18b by willmmiles --- wled00/file.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/file.cpp b/wled00/file.cpp index 5affc666..4e23d5ca 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -512,8 +512,8 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){ } #endif - if(WLED_FS.exists(path)) { - request->send(WLED_FS, path, contentType); + if(WLED_FS.exists(path) || WLED_FS.exists(path + ".gz")) { + request->send(WLED_FS, path, String(), request->hasArg(F("download"))); return true; } //USER_PRINTLN("WS FileRead failed: " + path + " (" + contentType + ")"); From f4dd5c006865d6b8e8a9ee78927a387643732214 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 29 Apr 2024 23:35:48 +0200 Subject: [PATCH 19/42] new buildenv esp32S3_4MB_PSRAM_M MM for esp32-s3 zero/supermini and lolin S3 mini boards - standard --- platformio.ini | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index a83ef0a9..79ccde66 100644 --- a/platformio.ini +++ b/platformio.ini @@ -74,8 +74,9 @@ default_envs = ; esp32_4MB_PSRAM_REV3_S ;; experimental, optimized for WROVER-E with "revision3" chip esp32S3_8MB_S ;; experimental, optimized for speed esp32S3_8MB_M - esp32S3_4MB_PSRAM_S ;; for lolin s3 mini, S3 zero, S3 super mini - ;; esp32S3_8MB_PSRAM_M ;; experiemental + esp32S3_4MB_PSRAM_S ;; for lolin s3 mini, S3 zero, S3 super mini - optimized for speed + esp32S3_4MB_PSRAM_M ;; for lolin s3 mini, S3 zero, S3 super mini + esp32S3_8MB_PSRAM_M ;; experiemental ;; esp32s2_tinyUF2_PSRAM_S ;; experimental - only for adafruit -S2 boards with tinyUF2 bootloader !!! esp32s2_PSRAM_M ;; experimental esp32c3dev_4MB_M ;; experimental @@ -1911,6 +1912,41 @@ lib_ignore = ; RAM: [== ] 20.4% (used 66840 bytes from 327680 bytes) ; Flash: [========= ] 86.5% (used 1644765 bytes from 1900544 bytes) +;; MM for esp32-s3 zero/supermini and lolin S3 mini boards - standard +[env:esp32S3_4MB_PSRAM_M] +extends = env:esp32S3_8MB_M +board = lolin_s3_mini ;; -S3 mini: 4MB flash 2MB PSRAM +board_build.partitions = ${esp32.default_partitions} + +build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation + ;; ${common_mm.build_flags_S} ${common_mm.build_flags_M} + ${common_mm.build_flags_S} ${common_mm.build_flags_M} + -D WLED_RELEASE_NAME=esp32S3_4MB_M + -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON ;; -D WLED_USE_PSRAM + -DCONFIG_MBEDTLS_DYNAMIC_BUFFER=1 ;; optional - allows some buffers to use PSRAM + -DLOLIN_WIFI_FIX -DWLEDMM_WIFI_POWERON_HACK ;; seems to work much better with this + -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Serial-to-USB chip + ;;-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 ;; for Hardware-CDC USB mode + -D WLED_DISABLE_ADALIGHT ;; disables serial protocols - recommended for Hardware-CDC USB (Serial RX will receive junk commands when RX pin is unconnected, unless its pulled down by resistor) + ${common_mm.animartrix_build_flags} + -D LEDPIN=21 + -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1 -D AUDIOPIN=-1 + -D HW_PIN_SDA=12 -D HW_PIN_SCL=13 + -D SR_DMTYPE=1 -D I2S_SDPIN=5 -D I2S_WSPIN=6 -D I2S_CKPIN=4 -D MCLK_PIN=7 + ;; -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes + ;; -D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes + ;; -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes + ;; -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes + ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes + ; -D WLED_DEBUG + ; -D SR_DEBUG + ; -D MIC_LOGGER +lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M} +lib_ignore = + ; IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation +; RAM: [== ] 18.2% (used 59668 bytes from 327680 bytes) +; Flash: [==========] 97.0% (used 1525125 bytes from 1572864 bytes) + ;; MM for Adafruit QT Py ESP32-S2 -> 4MB flash, PSRAM, and tinyUF2 bootloader ;; to ewowi - i'll optimize this entry later, as a few things can be inherited for sure. To softhack: sure ;-) From 4bfdf9a5900190154b732ada99dcd4e3b2e8e466 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 30 Apr 2024 00:52:14 +0200 Subject: [PATCH 20/42] repairing the MM build system (again) In the future, when anybody feels like "otpimizing" our platformio.ini ->PLEASE contact me before making any changes. --- platformio.ini | 79 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 25 deletions(-) diff --git a/platformio.ini b/platformio.ini index 79ccde66..be4ed0b3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1018,7 +1018,6 @@ build_flags_S = ; -D USERMOD_ARTIFX ;; WLEDMM usermod - temporarily moved into "_M", due to problems in "_S" when compiling with -O2 -D WLEDMM_FASTPATH ;; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions. ; -D WLED_DEBUG_HEAP ;; WLEDMM enable heap debugging - ${common_mm.build_disable_sync_interfaces} lib_deps_S = ;; https://github.com/kosme/arduinoFFT#develop @ 1.9.2+sha.419d7b0 ;; used for USERMOD_AUDIOREACTIVE - using "known working" hash @@ -1101,7 +1100,7 @@ platform = ${esp32.platform} upload_speed = 460800 ; or 921600 platform_packages = ${esp32.platform_packages} build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags_esp32} ${common_mm.build_flags_S} +build_flags = ${common.build_flags_esp32} ${common_mm.build_flags_S} ${common_mm.build_disable_sync_interfaces} lib_deps = ${esp32.lib_deps} ${common_mm.lib_deps_S} board_build.partitions = ${esp32.default_partitions} board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz) @@ -1111,15 +1110,15 @@ monitor_filters = esp32_exception_decoder ;common default for all max environments [esp32_4MB_M_base] extends = esp32_4MB_S_base -build_flags = ${esp32_4MB_S_base.build_flags} ${common_mm.build_flags_M} -build_unflags = ${esp32_4MB_S_base.build_unflags} ${common_mm.build_disable_sync_interfaces} +build_flags = ${common.build_flags_esp32} ${common_mm.build_flags_S} ${common_mm.build_flags_M} ;; we don't want common_mm.build_disable_sync_interfaces, so we cannot inherit from esp32_4MB_S_base +build_unflags = ${esp32_4MB_S_base.build_unflags} lib_deps = ${esp32_4MB_S_base.lib_deps} ${common_mm.lib_deps_M} ; board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv [esp32_4MB_XL_base] extends = esp32_4MB_M_base build_flags = ${esp32_4MB_M_base.build_flags} ${common_mm.build_flags_XL} -build_unflags = ${esp32_4MB_M_base.build_unflags} ${common_mm.build_disable_sync_interfaces} +build_unflags = ${esp32_4MB_M_base.build_unflags} lib_deps = ${esp32_4MB_M_base.lib_deps} ${common_mm.lib_deps_XL} ; board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv @@ -1130,7 +1129,7 @@ upload_speed = 460800 ; or 921600 platform = ${esp32.platformV4} platform_packages = ${esp32.platformV4_packages} build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags} ${common_mm.build_flags_S} ;; do not include ${esp32.build_flagsV4} here !!!! +build_flags = ${common.build_flags} ${common_mm.build_flags_S} ${common_mm.build_disable_sync_interfaces} ;; do not include ${esp32.build_flagsV4} here !!!! -Wno-misleading-indentation -Wno-format-truncation -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one ;-Wstack-usage=2732 ;; warn if a function needs more that 30% of availeable stack ("stack usage might be unbounded", "stack usage is 2824 bytes") @@ -1148,7 +1147,14 @@ board_build.flash_mode = dio ; (dio = dual i/o; more compatible than qio = quad [esp32_4MB_V4_M_base] extends = esp32_4MB_V4_S_base -build_flags = ${esp32_4MB_V4_S_base.build_flags} ${common_mm.build_flags_M} ;; generic, for all variants +build_flags = + ${common.build_flags} ${common_mm.build_flags_S} ;; do not include ${esp32.build_flagsV4} here !!!! + -Wno-misleading-indentation -Wno-format-truncation + -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one + ;-Wstack-usage=2732 ;; warn if a function needs more that 30% of availeable stack ("stack usage might be unbounded", "stack usage is 2824 bytes") + ;-Wsuggest-attribute=const -Wsuggest-attribute=pure ;; ask compiler for hints on attributes + -D WLED_ENABLE_DMX_INPUT + ${common_mm.build_flags_M} ;; generic, for all variants lib_deps = ${esp32_4MB_V4_S_base.lib_deps} ${common_mm.lib_deps_V4_M} esp32_build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} ${common_mm.build_flags_M} ;; for esp32 only, including specific "V4" flags esp32_lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} ${common_mm.lib_deps_V4_M} @@ -1741,6 +1747,11 @@ lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps} ;; Flash: [======== ] 84.6% (used 1607857 bytes from 1900544 bytes) +# ------------------------------------------------------------------------------ +# esp32-S3 environments +# ------------------------------------------------------------------------------ + + [env:esp32S3_8MB_M] extends = esp32_4MB_V4_M_base board = esp32-s3-devkitc-1 @@ -1873,14 +1884,12 @@ board_build.partitions = tools/WLED_ESP32_8MB.csv ; RAM: [=== ] 25.8% (used 84544 bytes from 327680 bytes) ; Flash: [======== ] 78.1% (used 1638737 bytes from 2097152 bytes) - ;; MM for esp32-s3 zero/supermini and lolin S3 mini boards - fastpath, optimize for speed [env:esp32S3_4MB_PSRAM_S] extends = env:esp32S3_8MB_S board = lolin_s3_mini ;; -S3 mini: 4MB flash 2MB PSRAM board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions) ;; board_build.partitions = tools/WLED_ESP32_4MB_512KB_FS.csv ;; 1.7MB firmware, 500KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions) - build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation ${common_mm.build_flags_S} -D WLED_RELEASE_NAME=esp32S3_4MB_S @@ -1909,17 +1918,15 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-inden ; -D MIC_LOGGER lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [== ] 20.4% (used 66840 bytes from 327680 bytes) -; Flash: [========= ] 86.5% (used 1644765 bytes from 1900544 bytes) +; RAM: [== ] 20.4% (used 66908 bytes from 327680 bytes) +; Flash: [========= ] 87.1% (used 1655529 bytes from 1900544 bytes) ;; MM for esp32-s3 zero/supermini and lolin S3 mini boards - standard [env:esp32S3_4MB_PSRAM_M] extends = env:esp32S3_8MB_M board = lolin_s3_mini ;; -S3 mini: 4MB flash 2MB PSRAM board_build.partitions = ${esp32.default_partitions} - build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-indentation -Wno-format-truncation - ;; ${common_mm.build_flags_S} ${common_mm.build_flags_M} ${common_mm.build_flags_S} ${common_mm.build_flags_M} -D WLED_RELEASE_NAME=esp32S3_4MB_M -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON ;; -D WLED_USE_PSRAM @@ -1933,19 +1940,24 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-inden -D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1 -D AUDIOPIN=-1 -D HW_PIN_SDA=12 -D HW_PIN_SCL=13 -D SR_DMTYPE=1 -D I2S_SDPIN=5 -D I2S_WSPIN=6 -D I2S_CKPIN=4 -D MCLK_PIN=7 - ;; -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes - ;; -D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes - ;; -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes - ;; -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes - ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes + -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes - disabled to stay below 100% + -D WLED_DISABLE_HUESYNC ; RAM 122 bytes; FLASH 6308 bytes - disabled to stay below 100% + -D WLED_DISABLE_INFRARED ; RAM 136 bytes; FLASH 24492 bytes - disabled to stay below 100% + ;; -D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes + ;; -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes ; -D WLED_DEBUG ; -D SR_DEBUG ; -D MIC_LOGGER lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M} lib_ignore = - ; IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [== ] 18.2% (used 59668 bytes from 327680 bytes) -; Flash: [==========] 97.0% (used 1525125 bytes from 1572864 bytes) + IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation +; RAM: [== ] 20.6% (used 67524 bytes from 327680 bytes) +; Flash: [==========] 98.5% (used 1549341 bytes from 1572864 bytes) + + +# ------------------------------------------------------------------------------ +# esp32-S2 environments +# ------------------------------------------------------------------------------ ;; MM for Adafruit QT Py ESP32-S2 -> 4MB flash, PSRAM, and tinyUF2 bootloader @@ -2054,6 +2066,11 @@ monitor_filters = esp32_exception_decoder ; Flash: [======== ] 81.4% (used 1547834 bytes from 1900544 bytes) +# ------------------------------------------------------------------------------ +# esp32-C3 environments +# ------------------------------------------------------------------------------ + + ;; MM environment for generic ESP32-C3 -> 4MB flash, no PSRAM [env:esp32c3dev_4MB_M] extends = esp32_4MB_V4_S_base @@ -2163,11 +2180,15 @@ monitor_filters = esp32_exception_decoder # custom board environments # ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# wemos shields +# ------------------------------------------------------------------------------ ;https://www.tindie.com/products/serg74/wled-shield-board-for-addressable-leds/ ;https://www.tindie.com/products/moonmodules/shield-board-for-esp32-for-wled-addressable-leds/ [wemos_shield_esp32_4MB_S_base] extends = esp32_4MB_S_base -build_flags = ${esp32_4MB_S_base.build_flags} +pinout_build_flags = -D ABL_MILLIAMPS_DEFAULT=9500 ; Wemos max 10A -D LEDPIN=16 -D RLYPIN=19 @@ -2182,10 +2203,11 @@ build_flags = ${esp32_4MB_S_base.build_flags} -D PIR_SENSOR_PIN=-1 -D PWM_PIN=-1 ; -D WLED_USE_MY_CONFIG +build_flags = ${esp32_4MB_S_base.build_flags} ${common_mm.build_disable_sync_interfaces} ${wemos_shield_esp32_4MB_S_base.pinout_build_flags} [wemos_shield_esp32_4MB_M_base] extends = wemos_shield_esp32_4MB_S_base -build_flags = ${wemos_shield_esp32_4MB_S_base.build_flags} ${common_mm.build_flags_M} +build_flags = ${esp32_4MB_M_base.build_flags} ${wemos_shield_esp32_4MB_S_base.pinout_build_flags} lib_deps = ${wemos_shield_esp32_4MB_S_base.lib_deps} ${common_mm.lib_deps_M} [wemos_shield_esp32_4MB_XL_base] @@ -2197,13 +2219,15 @@ lib_deps = ${wemos_shield_esp32_4MB_M_base.lib_deps} ${common_mm.lib_deps_XL} extends = wemos_shield_esp32_4MB_S_base build_flags = ${wemos_shield_esp32_4MB_S_base.build_flags} -D WLED_RELEASE_NAME=wemos_shield_esp32_4MB_S +; RAM: [=== ] 25.4% (used 83124 bytes from 327680 bytes) +; Flash: [======== ] 83.4% (used 1311629 bytes from 1572864 bytes) [env:wemos_shield_esp32_4MB_M] extends = wemos_shield_esp32_4MB_M_base build_flags = ${wemos_shield_esp32_4MB_M_base.build_flags} -D WLED_RELEASE_NAME=wemos_shield_esp32_4MB_M -; RAM: [== ] 24.4% (used 79820 bytes from 327680 bytes) -; Flash: [========= ] 88.6% (used 1393421 bytes from 1572864 bytes) +; RAM: [=== ] 26.0% (used 85252 bytes from 327680 bytes) +; Flash: [==========] 97.4% (used 1531865 bytes from 1572864 bytes) [env:wemos_shield_esp32_4MB_ICS4343x_M] extends = wemos_shield_esp32_4MB_M_base @@ -2291,6 +2315,11 @@ board = esp32_16MB board_build.partitions = tools/WLED_ESP32_16MB.csv ;; WLED standard for 16MB flash: 2MB firmware, 12 MB filesystem ;board_build.partitions = tools/WLED_ESP32_16MB_9MB_FS.csv ;; WLED extended for 16MB flash: 3.2MB firmware, 9 MB filesystem + +# ------------------------------------------------------------------------------ +# special boards and controlers +# ------------------------------------------------------------------------------ + ;https://www.athom.tech/blank-1/wled-esp32-music-addressable-led-strip-controller [env:athom_music_esp32_4MB_M] extends = esp32_4MB_M_base From 714d4850af3f87cbd5c47a9f778b0c62faed5675 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 30 Apr 2024 12:47:45 +0200 Subject: [PATCH 21/42] minor cleanup * startup message from UM autoplaylist * zeroCrossingCount added to sound simulation * debug messages cleanup --- usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h | 3 ++- wled00/bus_manager.cpp | 4 ++-- wled00/util.cpp | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h b/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h index c15f116e..d08f295f 100644 --- a/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h +++ b/usermods/usermod_v2_auto_playlist/usermod_v2_auto_playlist.h @@ -85,7 +85,8 @@ class AutoPlaylistUsermod : public Usermod { // gets called once at boot. Do all initialization that doesn't depend on // network here void setup() { - USER_PRINTLN("AutoPlaylistUsermod"); + USER_PRINT(F("AutoPlaylistUsermod startup; enabled = ")); + USER_PRINT(enabled ? F("true"):F("false")); USER_PRINTLN(F(".")); initDone = true; } diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 0dad3ffc..f4e32bd4 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -729,12 +729,12 @@ uint32_t BusManager::memUsage(BusConfig &bc) { int BusManager::add(BusConfig &bc) { if (getNumBusses() - getNumVirtualBusses() >= WLED_MAX_BUSSES) return -1; - USER_PRINTF("BusManager::add(bc.type=%u)\n", bc.type); + DEBUG_PRINTF("BusManager::add(bc.type=%u)\n", bc.type); if (bc.type >= TYPE_NET_DDP_RGB && bc.type < 96) { busses[numBusses] = new BusNetwork(bc); #ifdef WLED_ENABLE_HUB75MATRIX } else if (bc.type >= TYPE_HUB75MATRIX && bc.type <= (TYPE_HUB75MATRIX + 10)) { - USER_PRINTLN("BusManager::add - Adding BusHub75Matrix"); + DEBUG_PRINTLN("BusManager::add - Adding BusHub75Matrix"); busses[numBusses] = new BusHub75Matrix(bc); #endif } else if (IS_DIGITAL(bc.type)) { diff --git a/wled00/util.cpp b/wled00/util.cpp index ceefcc2f..8e6d349a 100644 --- a/wled00/util.cpp +++ b/wled00/util.cpp @@ -433,6 +433,7 @@ um_data_t* simulateSound(uint8_t simulationId) static float volumeSmth; static uint16_t volumeRaw; static float my_magnitude; + static uint16_t zeroCrossingCount = 0; // number of zero crossings in the current batch of 512 samples //arrays uint8_t *fftResult; @@ -447,7 +448,7 @@ um_data_t* simulateSound(uint8_t simulationId) // NOTE!!! // This may change as AudioReactive usermod may change um_data = new um_data_t; - um_data->u_size = 11; + um_data->u_size = 12; um_data->u_type = new um_types_t[um_data->u_size]; um_data->u_data = new void*[um_data->u_size]; um_data->u_data[0] = &volumeSmth; @@ -461,6 +462,7 @@ um_data_t* simulateSound(uint8_t simulationId) um_data->u_data[8] = &FFT_MajorPeak; // dummy (FFT Peak smoothed) um_data->u_data[9] = &volumeSmth; // dummy (soundPressure) um_data->u_data[10] = &volumeSmth; // dummy (agcSensitivity) + um_data->u_data[11] = &zeroCrossingCount; } else { // get arrays from um_data fftResult = (uint8_t*)um_data->u_data[2]; @@ -527,6 +529,7 @@ um_data_t* simulateSound(uint8_t simulationId) volumeRaw = volumeSmth; my_magnitude = 10000.0f / 8.0f; //no idea if 10000 is a good value for FFT_Magnitude ??? if (volumeSmth < 1 ) my_magnitude = 0.001f; // noise gate closed - mute + zeroCrossingCount = floorf(FFT_MajorPeak / 36.0f); // 9Khz max frequency => 255 zero crossings return um_data; } From e0a4a7c71ecf8dcafbdb722e2fbd27ddc2da76b8 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:16:11 +0200 Subject: [PATCH 22/42] minor updates --- platformio.ini | 5 +++-- wled00/wled.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/platformio.ini b/platformio.ini index be4ed0b3..9a9933a8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1977,6 +1977,7 @@ build_unflags = ${common.build_unflags} -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX) -D WLED_ENABLE_DMX_INPUT ;; needs more testing -DWLEDMM_FASTPATH ;; needs more testing on -S2 + -DUSERMOD_RTC build_flags = ${common.build_flags} ${esp32s2.build_flags} ; ${Debug_Flags.build_flags} ;ewowi: enabling debug causes Error: The program size (1463330 bytes) is greater than maximum allowed (1441792 bytes) @@ -2012,8 +2013,8 @@ lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE monitor_filters = esp32_exception_decoder -; RAM: [=== ] 33.0% (used 108276 bytes from 327680 bytes) -; Flash: [==========] 97.9% (used 1411114 bytes from 1441792 bytes) !!! 98% +; RAM: [== ] 21.5% (used 70448 bytes from 327680 bytes) +; Flash: [==========] 99.5% (used 1434054 bytes from 1441792 bytes) !!! 99% ;; MM environment for generic ESP32-S2, with PSRAM, 4MB flash (300kB filesystem to have more program space) ;; PINs assignments optimized for use with serg74 "mini shield" diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 52c1b321..4b2d6609 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -681,7 +681,7 @@ pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), Pin updateFSInfo(); USER_PRINT(F("done Mounting FS; ")); - USER_PRINT(((fsBytesTotal-fsBytesUsed)/1024)); USER_PRINTLN(F(" kB free.")); + USER_PRINT(((fsBytesTotal-fsBytesUsed)/1024)); USER_PRINTLN(F(" kB free.\n")); // generate module IDs must be done before AP setup escapedMac = WiFi.macAddress(); @@ -705,7 +705,7 @@ pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), Pin beginStrip(); DEBUG_PRINT(F("heap ")); DEBUG_PRINTLN(ESP.getFreeHeap()); - USER_PRINTLN(F("Usermods setup ...")); + USER_PRINTLN(F("\nUsermods setup ...")); userSetup(); usermods.setup(); DEBUG_PRINT(F("heap ")); DEBUG_PRINTLN(ESP.getFreeHeap()); @@ -721,7 +721,7 @@ pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), Pin //Serial RX (Adalight, Improv, Serial JSON) only possible if GPIO3 unused //Serial TX (Debug, Improv, Serial JSON) only possible if GPIO1 unused if (!pinManager.isPinAllocated(hardwareRX) && !pinManager.isPinAllocated(hardwareTX)) { - if (Serial) Serial.println(F("Ada")); + if (Serial) Serial.println(F("\nAda")); } #endif @@ -852,7 +852,7 @@ pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), Pin // repeat Ada prompt #ifdef WLED_ENABLE_ADALIGHT if (!pinManager.isPinAllocated(hardwareRX) && !pinManager.isPinAllocated(hardwareTX)) { - if (Serial) Serial.println(F("Ada")); + if (Serial) Serial.println(F("\nAda")); } #endif From 16e8d9dcdc46a2c9f26aad79382614c05a643646 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:17:02 +0200 Subject: [PATCH 23/42] add error msg when oappend buffer is used up --- wled00/const.h | 1 + wled00/util.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/wled00/const.h b/wled00/const.h index 14f419c2..8f690ac9 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -351,6 +351,7 @@ #define ERR_LOW_MEM 33 // WLEDMM: low memory (RAM) #define ERR_LOW_SEG_MEM 34 // WLEDMM: low memory (segment data RAM) #define ERR_LOW_WS_MEM 35 // WLEDMM: low memory (ws) +#define ERR_LOW_AJAX_MEM 36 // WLEDMM: low memory (oappend) // Timer mode types #define NL_MODE_SET 0 //After nightlight time elapsed, set to target brightness diff --git a/wled00/util.cpp b/wled00/util.cpp index 8e6d349a..896b57e3 100644 --- a/wled00/util.cpp +++ b/wled00/util.cpp @@ -155,6 +155,7 @@ bool oappend(const char* txt) USER_PRINTF("%2u bytes \t\"", len /*1 + olen + len - SETTINGS_STACK_BUF_SIZE*/); USER_PRINT(txt); USER_PRINTLN(F("\"")); + errorFlag = ERR_LOW_AJAX_MEM; } return false; // buffer full } From a01d86e8e02ef3da73453f0cd314070e373ab999 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:18:32 +0200 Subject: [PATCH 24/42] info page cleanup - re-organize technical infos for better readability - reduce number of lines added for PSRAM status - removed duplicate infos --- wled00/data/index.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/wled00/data/index.js b/wled00/data/index.js index 2a4b51ba..31726f40 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -680,6 +680,7 @@ function populateInfo(i) if (i.ver.includes("0.14.0-b2")) vcn = "This is the way"; // recently watched The Mandalorian? I have spoken ;-) if (i.ver.includes("0.14.0-b15.22")) vcn = "Lupo"; if (i.ver.includes("0.14.1-b3")) vcn = "Fried Chicken"; // final line of "One Vision" by Queen + if (i.ver.includes("0.14.3-b")) vcn = "Fried Chicken"; cn += `v${i.ver}  "${vcn}"

(WLEDMM_${i.ver} ${i.rel}.bin)

build ${i.vid}

${urows} ${urows===""?'':''} @@ -690,24 +691,22 @@ ${inforow("Build",i.vid)} ${inforow("Estimated current",pwru)} ${inforow("Average FPS",i.leds.fps)} ${inforow("Signal strength",i.wifi.signal +"% ("+ i.wifi.rssi, " dBm)")} +${inforow("MAC address",i.mac)} ${inforow("Uptime",getRuntimeStr(i.uptime))} + +${inforow("Filesystem",i.fs.u + "/" + i.fs.t + " kB, " +Math.round(i.fs.u*100/i.fs.t) + "%")} +${theap>0?inforow("Heap ☾",((i.totalheap-i.freeheap)/1000).toFixed(0)+"/"+theap.toFixed(0)+" kB",", "+Math.round((i.totalheap-i.freeheap)/(10*theap))+"%"):inforow("Free heap",heap," kB")} +${i.minfreeheap?inforow("Max used heap ☾",((i.totalheap-i.minfreeheap)/1000).toFixed(0)+" kB",", "+Math.round((i.totalheap-i.minfreeheap)/(10*theap))+"%"):""} +${i.psram?inforow("PSRAM ☾",((i.tpram-i.psram)/1024).toFixed(0)+"/"+(i.tpram/1024).toFixed(0)+" kB",", "+((i.tpram-i.psram)*100.0/i.tpram).toFixed(1)+"%"):""} +${i.psusedram?inforow("Max used PSRAM ☾",((i.tpram-i.psusedram)/1024).toFixed(0)+" kB",", "+((i.tpram-i.psusedram)*100.0/i.tpram).toFixed(1)+"%"):""} +${i.freestack?inforow("Free stack ☾",(i.freestack/1000).toFixed(3)," kB"):""} -${inforow("Filesystem",i.fs.u + "/" + i.fs.t + " kB (" +Math.round(i.fs.u*100/i.fs.t) + "%)")} -${theap>0?inforow("Heap ☾",((i.totalheap-i.freeheap)/1000).toFixed(0)+"/"+theap.toFixed(0)+" kB"," ("+Math.round((i.totalheap-i.freeheap)/(10*theap))+"%)"):""} -${i.minfreeheap?inforow("Max used heap ☾",((i.totalheap-i.minfreeheap)/1000).toFixed(1)+" kB"," ("+Math.round((i.totalheap-i.minfreeheap)/(10*theap))+"%)"):""} -${inforow("Free heap",heap," kB")} -${i.freestack?inforow("Free stack ☾",(i.freestack/1024).toFixed(3)," kB"):""} -${inforow("Flash Size ☾",flashsize," kB")} -${i.tpram?inforow("PSRAM ☾",(i.tpram/1024).toFixed(1)," kB"):""} -${i.psram?((i.tpram-i.psram)>16383?inforow("Used PSRAM ☾",((i.tpram-i.psram)/1024).toFixed(1)," kB"):inforow("Used PSRAM ☾",(i.tpram-i.psram)," B")):""} -${i.psusedram?((i.tpram-i.psusedram)>16383?inforow("Max used PSRAM ☾",((i.tpram-i.psusedram)/1024).toFixed(1)," kB"):inforow("Max used PSRAM ☾",(i.tpram-i.psusedram)," B")):""} -${i.psram?inforow("Free PSRAM",(i.psram/1024).toFixed(1)," kB"):""} -${inforow("MAC address",i.mac)} +${i.tpram?inforow("PSRAM ☾",(i.tpram/1024/1024).toFixed(0)," MB"):""} +${i.e32flash?inforow("Flash mode "+i.e32flashmode+i.e32flashtext + " ☾",i.e32flash+" MB, "+i.e32flashspeed," Mhz"):""} +${i.e32model?inforow(i.e32model + " ☾",i.e32cores +" core(s),"," "+i.e32speed+" Mhz"):""} ${inforow("Environment",i.arch + " " + i.core + " (" + i.lwip + ")")} -${i.e32model?inforow(i.e32model + " ☾",i.e32cores +" core(s)"," "+i.e32speed+" Mhz"):""} -${i.e32flash?inforow("Flash "+i.e32flash+"MB"+" mode "+i.e32flashmode+i.e32flashtext + " ☾",i.e32flashspeed," Mhz"):""} ${i.e32code?inforow("Last ESP Restart ☾",i.e32code+" "+i.e32text):""} ${i.e32core0code?inforow("Core0 rst reason ☾",i.e32core0code, " "+i.e32core0text):""} ${i.e32core1code?inforow("Core1 rst reason ☾",i.e32core1code, " "+i.e32core1text):""} @@ -1976,6 +1975,9 @@ function readState(s,command=false) case 35: errstr = "Low Memory (WS data)."; break; + case 36: + errstr = "Low Memory (oappend buffer)."; + break; } showToast('Error ' + s.error + ": " + errstr, true); } From bf5c95646c485e7d26bd0c4b9fd1597c4a6c1820 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:09:05 +0200 Subject: [PATCH 25/42] small fix for Fireworks 1D (MM specific) effect did not clean up its canvas initially, leading to sporadic "lost pixels". --- wled00/FX.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 36a40afd..0f6bb40a 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -3552,7 +3552,10 @@ uint16_t mode_exploding_fireworks(void) if (SEGLEN == 1) return mode_static(); const uint16_t cols = strip.isMatrix ? SEGMENT.virtualWidth() : 1; const uint16_t rows = strip.isMatrix ? SEGMENT.virtualHeight() : SEGMENT.virtualLength(); - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) { + SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + SEGMENT.fill(BLACK); + } //allocate segment data uint16_t maxData = FAIR_DATA_PER_SEG; //ESP8266: 256 ESP32: 640 From 08d73646fdb17ac6ce2f46faea32f0fc8d003ac1 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 1 May 2024 02:11:28 +0200 Subject: [PATCH 26/42] adding compile-time messages when extra features are enabled --- wled00/bus_manager.cpp | 1 + wled00/dmx_input.cpp | 1 + wled00/network.cpp | 2 ++ wled00/remote.cpp | 1 + 4 files changed, 5 insertions(+) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index f4e32bd4..af4e16ef 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -481,6 +481,7 @@ void BusNetwork::cleanup() { // *************************************************************************** #ifdef WLED_ENABLE_HUB75MATRIX +#warning "HUB75 driver enabled (experimental)" BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWhite) { diff --git a/wled00/dmx_input.cpp b/wled00/dmx_input.cpp index af0bb679..77ebc859 100644 --- a/wled00/dmx_input.cpp +++ b/wled00/dmx_input.cpp @@ -1,6 +1,7 @@ #include "wled.h" #ifdef WLED_ENABLE_DMX_INPUT +#pragma message "DMX physical input driver enabled" #ifdef ESP8266 #error DMX input is only supported on ESP32 diff --git a/wled00/network.cpp b/wled00/network.cpp index 6c94c447..1e414d81 100644 --- a/wled00/network.cpp +++ b/wled00/network.cpp @@ -4,6 +4,8 @@ #ifdef WLED_USE_ETHERNET +#pragma message "Ethernet support enabled" + // The following six pins are neither configurable nor // can they be re-assigned through IOMUX / GPIO matrix. // See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit-v1.1.html#ip101gri-phy-interface diff --git a/wled00/remote.cpp b/wled00/remote.cpp index 5a993c29..48a3297d 100644 --- a/wled00/remote.cpp +++ b/wled00/remote.cpp @@ -20,6 +20,7 @@ #ifdef WLED_DISABLE_ESPNOW void handleRemote(){} #else +#pragma message "ESP-NOW remote driver enabled" #if !defined(ARDUINO_ARCH_ESP32) && !defined(ESP_OK) #define ESP_OK 0 // add missing constant for stupid esp8266 From 4597a885163d998ce873c1405f5da04d746f0f08 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 1 May 2024 02:15:59 +0200 Subject: [PATCH 27/42] platformio maintenance * updates flash size statistics * moved all MM specific dependencies into [common_mm] to simplify maintenance of versions * "V4_xp" = experimental arduino-esp32 v2.0.14 --- platformio.ini | 124 ++++++++++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 52 deletions(-) diff --git a/platformio.ini b/platformio.ini index 9a9933a8..c0c90a6d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -324,8 +324,8 @@ lib_deps = ${env.lib_deps} ;; Compatibility with upstream --> you should prefer using ${common_mm.build_flags_S} and ${common_mm.lib_deps_S} -AR_build_flags = -D USERMOD_AUDIOREACTIVE -D UM_AUDIOREACTIVE_USE_NEW_FFT -AR_lib_deps = https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2 ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 +AR_build_flags = ${common_mm.AR_build_flags} +AR_lib_deps = ${common_mm.AR_lib_deps} ;; optimized version, 10% faster on -S2/-C3 ;; WLEDMM begin @@ -338,10 +338,9 @@ platformV4_packages_pre = platformV4 = espressif32@ ~6.3.2 platformV4_packages = platformio/framework-arduinoespressif32 @ 3.20009.0 ;; select arduino-esp32 v2.0.9 (arduino-esp32 2.0.10 thru 2.0.14 are buggy so avoid them) -;;; experimental: latest V4 platform with latest arduino-esp32 2.0.9 + ESP-IDF 4.4.4 (may or may not work) -platformV4_xp = espressif32@ ~6.4.0 -platformV4_packages_xp = platformio/framework-arduinoespressif32 @ ~3.20009.0 ;; arduino-esp32 v2.0.9+ -;; platformV4_packages_xp = platformio/framework-arduinoespressif32 @ ~3.20011.0 ;; arduino-esp32 v2.0.11 (latest one supported in platformio) +;;; experimental: latest V4 platform with latest arduino-esp32 2.0.14 + ESP-IDF 4.4.6 (may or may not work) +platformV4_xp = espressif32@ ~6.5.0 +platformV4_packages_xp = platformio/framework-arduinoespressif32 @ 3.20014.231204 ;; arduino-esp32 2.0.14 build_flagsV4 = -g -DARDUINO_ARCH_ESP32 -DESP32 @@ -355,7 +354,7 @@ build_flagsV4 = -g lib_depsV4 = https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 ;; WLEDMM this must be first in the list, otherwise Aircoookie/ESPAsyncWebServer pulls in an older version of AsyncTCP !! makuna/NeoPixelBus @ 2.7.5 - https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.10 + ${common_mm.HUB75_lib_deps} ${env.lib_deps} @@ -1005,6 +1004,24 @@ build_disable_sync_interfaces = -D WLED_DISABLE_ADALIGHT ;; WLEDMM this board does not have a serial-to-USB chip. Better to disable serial protocols, to avoid crashes (see upstream #3128) -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only +AR_build_flags = -D USERMOD_AUDIOREACTIVE -D UM_AUDIOREACTIVE_USE_NEW_FFT ;; WLEDMM audioreactive usermod, licensed under GPLv3 +AR_lib_deps = https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2 ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 + +animartrix_build_flags = -D USERMOD_ANIMARTRIX ;; WLEDMM usermod: CC BY-NC 3.0 licensed effects by Stefan Petrick +animartrix_lib_deps = https://github.com/netmindz/animartrix.git#18bf17389e57c69f11bc8d04ebe1d215422c7fb7 +animartrix_lib_ignore = animartrix ;; to remove the animartrix lib dependancy (saves a few bytes) + +DMXin_build_flags = -D WLED_ENABLE_DMX_INPUT ;; WLEDMM DMX physical input - requires ESP-IDF v4.4.x +DMXin_lib_deps = https://github.com/someweisguy/esp_dmx.git#47db25d ;; for DMX_INPUT +DMXin_lib_ignore = esp_dmx ;; to remove the esp-dmx lib dependancy (saves a few bytes) + +HUB75_build_flags = + -D WLED_ENABLE_HUB75MATRIX ;-D SPIRAM_FRAMEBUFFER ;; WLEDMM HUB75 support - requires ESP-IDF v4.4.x + -D NO_GFX ; Disable the use of Adafruit_GFX by the HUB75 driver +HUB75_lib_deps = https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.10 +HUB75_lib_ignore = ESP32 HUB75 LED MATRIX PANEL DMA Display ;; to remove the HUB75 lib dependancy (saves a few bytes) + + build_flags_S = -Wall -Wformat -Woverflow -Wuninitialized -Winit-self -Warray-bounds ; enables more warnings -Wno-attributes -Wno-unused-variable -Wno-unused-function -Wno-deprecated-declarations ;disables some stupid warnings @@ -1012,20 +1029,15 @@ build_flags_S = -D WLED_USE_MY_CONFIG ; -D WLED_DISABLE_2D ;; un-comment to build a firmware without 2D matrix support ; -D WLED_USE_CIE_BRIGHTNESS_TABLE ;; experimental: use different color / brightness lookup table - -D USERMOD_AUDIOREACTIVE + ${common_mm.AR_build_flags} ; use latest (upstream) FFTLib, instead of older library modified by blazoncek. Slightly faster, more accurate, needs 2KB RAM extra -D USERMOD_AUTO_PLAYLIST - -D UM_AUDIOREACTIVE_USE_NEW_FFT ; use latest (upstream) FFTLib, instead of older library modified by blazoncek. Slightly faster, more accurate, needs 2KB RAM extra ; -D USERMOD_ARTIFX ;; WLEDMM usermod - temporarily moved into "_M", due to problems in "_S" when compiling with -O2 -D WLEDMM_FASTPATH ;; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions. ; -D WLED_DEBUG_HEAP ;; WLEDMM enable heap debugging lib_deps_S = ;; https://github.com/kosme/arduinoFFT#develop @ 1.9.2+sha.419d7b0 ;; used for USERMOD_AUDIOREACTIVE - using "known working" hash - https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2 ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 - - -animartrix_build_flags = -D USERMOD_ANIMARTRIX ;; WLEDMM usermod: CC BY-NC 3.0 licensed effects by Stefan Petrick -animartrix_lib_deps = https://github.com/netmindz/animartrix.git#18bf17389e57c69f11bc8d04ebe1d215422c7fb7 + ${common_mm.AR_lib_deps} ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 build_flags_M = -D USERMOD_ARTIFX ; WLEDMM usermod - temporarily moved into "_M", due to problems in "_S" when compiling with -O2 @@ -1134,9 +1146,9 @@ build_flags = ${common.build_flags} ${common_mm.build_flags_S} ${common_mm.build -Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one ;-Wstack-usage=2732 ;; warn if a function needs more that 30% of availeable stack ("stack usage might be unbounded", "stack usage is 2824 bytes") ;-Wsuggest-attribute=const -Wsuggest-attribute=pure ;; ask compiler for hints on attributes - -D WLED_ENABLE_DMX_INPUT + ${common_mm.DMXin_build_flags} lib_deps = ${common_mm.lib_deps_S} ;; do not include ${esp32.lib_depsV4} here !!!! - https://github.com/someweisguy/esp_dmx.git#47db25d ;; for DMX_INPUT + ${common_mm.DMXin_lib_deps} esp32_build_flags = ${esp32.build_flagsV4} ${esp32_4MB_V4_S_base.build_flags} ;; this is for esp32 only, including specific "V4" flags esp32_lib_deps = ${esp32.lib_depsV4} ${esp32_4MB_V4_S_base.lib_deps} ;; this is for esp32 only, including specific "V4" flags board_build.partitions = ${esp32.default_partitions} @@ -1570,8 +1582,8 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation - ; RAM: [=== ] 27.7% (used 90664 bytes from 327680 bytes) - ; Flash: [==========] 95.1% (used 1495497 bytes from 1572864 bytes) + ; RAM: [=== ] 28.1% (used 91960 bytes from 327680 bytes) + ; Flash: [==========] 97.8% (used 1537777 bytes from 1572864 bytes) ; compiled with ESP-IDF 4.4.1 [env:esp32_4MB_V4_M] extends = esp32_4MB_V4_M_base @@ -1582,16 +1594,21 @@ build_flags = ${esp32_4MB_V4_M_base.esp32_build_flags} -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes -D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes -D WLED_DISABLE_HUESYNC ;RAM 122 bytes; FLASH 6308 bytes - ;-D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes + -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes ;; softhack007 disabled to stay below 100% flash size -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ;; softhack007 disabled to stay below 100% flash size + -D WLEDMM_SAVE_FLASH lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation + ${common_mm.HUB75_lib_ignore} ;; over the flash size limit + ${common_mm.animartrix_lib_ignore} build_unflags = ${esp32_4MB_V4_M_base.build_unflags} -D USERMOD_ANIMARTRIX ;; Tips our memory usage over the limit + -D USERMOD_ARTIFX + -D USERMOD_AUTO_SAVE -D WLED_ENABLE_HUB75MATRIX -;; RAM: [=== ] 25.9% (used 84708 bytes from 327680 bytes) -;; Flash: [==========] 98.5% (used 1549033 bytes from 1572864 bytes) +;; RAM: [=== ] 28.0% (used 91664 bytes from 327680 bytes) +;; Flash: [==========] 99.9% (used 1572053 bytes from 1572864 bytes) ;; V4 build for 16MB flash, optimized for speed [env:esp32_16MB_V4_S] @@ -1662,6 +1679,8 @@ monitor_filters = esp32_exception_decoder extends = esp32_4MB_V4_S_base board = lolin_d32_pro ;board = esp32cam +build_unflags = ${esp32_4MB_V4_S_base.build_unflags} + -D WLED_ENABLE_HUB75MATRIX ;; uses too much flash build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} -D WLED_RELEASE_NAME=esp32_4MB_PSRAM_S -D WLED_WATCHDOG_TIMEOUT=0 #-D WLED_DISABLE_BROWNOUT_DET @@ -1679,8 +1698,8 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} ; -D MIC_LOGGER lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -;; RAM: [== ] 24.3% (used 79524 bytes from 327680 bytes) -;; Flash: [========= ] 93.2% (used 1466389 bytes from 1572864 bytes) +;; RAM: [== ] 20.4% (used 66960 bytes from 327680 bytes) +;; Flash: [==========] 98.7% (used 1553129 bytes from 1572864 bytes) ;; similar to 4MB_PSRAM_S, but optimized for WROVER-E (chip revision >= 3) that doesn't need any workarounds for PSRAM any more ;; tl;dr: its faster on PSRAM. But it will not work on all boards. @@ -1694,6 +1713,7 @@ build_unflags = ${esp32_4MB_V4_S_base.build_unflags} -DARDUINO_EVENT_RUNNING_CORE=1 ;; we want to run wifi on core0, so remove the standard flag -mfix-esp32-psram-cache-issue ;; this fix is not needed any more for revision 3 -mfix-esp32-psram-cache-strategy=memw ;; same as above + -D WLED_ENABLE_HUB75MATRIX ;; uses too much flash build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} -DARDUINO_EVENT_RUNNING_CORE=0 ;; assign Wifi to core0, to have more CPU on core#1 (arduino loop) @@ -1718,8 +1738,8 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} ; -D MIC_LOGGER lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -;; RAM: [==== ] 35.9% (used 117688 bytes from 327680 bytes) -;; Flash: [========= ] 94.5% (used 1487097 bytes from 1572864 bytes) +;; RAM: [== ] 20.4% (used 66976 bytes from 327680 bytes) +;; Flash: [==========] 97.0% (used 1525833 bytes from 1572864 bytes) ;; PSRAM build env that only leaves 300Kb for filesystem (instead of 1MB), but adds 300kB for program space [env:esp32_4MB_PSRAM_M] @@ -1743,8 +1763,8 @@ build_flags = ${esp32_4MB_V4_M_base.esp32_build_flags} ; -D MIC_LOGGER lib_deps = ${esp32_4MB_V4_M_base.esp32_lib_deps} ;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -;; RAM: [== ] 24.9% (used 81484 bytes from 327680 bytes) -;; Flash: [======== ] 84.6% (used 1607857 bytes from 1900544 bytes) +;; RAM: [== ] 20.7% (used 67672 bytes from 327680 bytes) +;; Flash: [========= ] 90.4% (used 1718421 bytes from 1900544 bytes) # ------------------------------------------------------------------------------ @@ -1978,6 +1998,7 @@ build_unflags = ${common.build_unflags} -D WLED_ENABLE_DMX_INPUT ;; needs more testing -DWLEDMM_FASTPATH ;; needs more testing on -S2 -DUSERMOD_RTC + -D WLED_ENABLE_HUB75MATRIX build_flags = ${common.build_flags} ${esp32s2.build_flags} ; ${Debug_Flags.build_flags} ;ewowi: enabling debug causes Error: The program size (1463330 bytes) is greater than maximum allowed (1441792 bytes) @@ -2034,6 +2055,7 @@ build_unflags = ${common.build_unflags} -D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX) -D WLED_ENABLE_DMX_INPUT ;; needs more testing -DWLEDMM_FASTPATH ;; needs more testing on -S2 + -D WLED_ENABLE_HUB75MATRIX build_flags = ${common.build_flags} ${esp32s2.build_flags} ;; ${Debug_Flags.build_flags} -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0 @@ -2122,8 +2144,8 @@ lib_ignore = ;IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE U8g2 ; not needed as we don't include USERMOD_FOUR_LINE_DISPLAY -; RAM: [== ] 23.7% (used 77780 bytes from 327680 bytes) -; Flash: [========= ] 93.9% (used 1477456 bytes from 1572864 bytes) +; RAM: [=== ] 25.9% (used 84884 bytes from 327680 bytes) +; Flash: [==========] 99.1% (used 1557952 bytes from 1572864 bytes) ;; MM environment for ESP32-C3 "mini" and "super mini" -> flash mode "dio" instead of "qio" (see #101) [env:esp32c3mini_dio_4MB_M] @@ -2141,6 +2163,8 @@ build_flags = ${env:esp32c3dev_4MB_M.build_flags} -D WLED_DISABLE_BROWNOUT_DET ;; the board only has a 500mA LDO, better to disable brownout detection -D WLED_DISABLE_ADALIGHT ;; to disable serial protocols for boards with CDC USB (Serial RX will receive junk commands, unless its pulled down by resistor) -D HW_PIN_SDA=0 -D HW_PIN_SCL=1 ;; avoid pin conflicts +; RAM: [=== ] 25.8% (used 84700 bytes from 327680 bytes) +; Flash: [==========] 98.9% (used 1554906 bytes from 1572864 bytes) ;; MM environment for "seeed xiao -C3" boards [env:seeed_esp32c3_4MB_S] @@ -2152,6 +2176,7 @@ board_build.flash_mode = qio upload_speed = 460800 build_unflags = ${env:esp32c3dev_4MB_M.build_unflags} -DWLEDMM_FASTPATH ;; needs more testing on -C3 + -D WLED_ENABLE_HUB75MATRIX ;; not enough pins build_flags = ${common.build_flags} ${esp32c3.build_flags} -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0 ${common_mm.build_flags_S} -Wno-misleading-indentation -Wno-format-truncation @@ -2171,11 +2196,10 @@ build_flags = ${common.build_flags} ${esp32c3.build_flags} -D WLED_USE_MY_CONFIG ;-D WLED_DEBUG -D SR_DEBUG lib_deps = ${esp32c3.lib_deps} ${common_mm.lib_deps_S} -;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation +lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation monitor_filters = esp32_exception_decoder -; RAM: [== ] 23.8% (used 77908 bytes from 327680 bytes) -; Flash: [========= ] 90.9% (used 1429302 bytes from 1572864 bytes) - +; RAM: [== ] 23.6% (used 77460 bytes from 327680 bytes) +; Flash: [========= ] 91.7% (used 1442092 bytes from 1572864 bytes) # ------------------------------------------------------------------------------ # custom board environments @@ -2392,19 +2416,18 @@ build_flags = ${esp32_4MB_M_base.build_flags} ; -D WLED_DISABLE_MQTT ; -D WLED_DISABLE_INFRARED ; -D WLED_ENABLE_DMX -; RAM: [== ] 24.4% (used 79812 bytes from 327680 bytes) -; Flash: [========= ] 90.4% (used 1422581 bytes from 1572864 bytes) - +; RAM: [=== ] 26.0% (used 85236 bytes from 327680 bytes) +; Flash: [==========] 97.1% (used 1527049 bytes from 1572864 bytes) ;; experimental -;; PICO environment with ESP-IDF v4.4.1 / arduino-esp32 v2.0.4 +;; PICO environment with ESP-IDF v4.4.4 / arduino-esp32 v2.0.9 [env:esp32_pico_4MB_V4_S] extends = esp32_4MB_V4_S_base board = pico32 -;platform = espressif32@~5.2.0 ;; alternative platform, might help in case you experience bootloops due to corrupted flash filesystem -;platform_packages = upload_speed = 256000 ;; or 115200 ;; or 460800 ; or 921600 (slower speeds are better when flashing without a soldered connection) +build_unflags = ${esp32_4MB_V4_S_base.build_unflags} + -D WLED_ENABLE_HUB75MATRIX ;; not enough pins build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4; avoids errors on startup -D WLED_RELEASE_NAME=esp32_pico_4MB_V4_S @@ -2412,13 +2435,7 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} -D SERVERNAME='"WLED-pico32-V4"' -D WLED_WATCHDOG_TIMEOUT=0 ; -D WLED_WATCHDOG_TIMEOUT=60 - ; -D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates. May break compatibility with previous versions. -D WLED_DISABLE_ADALIGHT ;; WLEDMM this board does not have a serial-to-USB chip. Better to disable serial protocols, to avoid crashes (see upstream #3128) - ; -D WLED_DISABLE_LOXONE - ; -D WLED_DISABLE_ALEXA - ; -D WLED_DISABLE_HUESYNC - ; -D WLED_DISABLE_MQTT - ; -D WLED_DISABLE_INFRARED ; -D WLED_DEBUG ; -D SR_DEBUG -D LEDPIN=2 @@ -2430,16 +2447,16 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} -D SR_ENABLE_DEFAULT ;; enable audioreactive at first start - no need to manually set "enable", then reboot ; -D WLED_USE_MY_CONFIG lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} -;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [=== ] 25.4% (used 83144 bytes from 327680 bytes) -; Flash: [==========] 96.4% (used 1516029 bytes from 1572864 bytes) +lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation +; RAM: [=== ] 27.9% (used 91448 bytes from 327680 bytes) +; Flash: [==========] 96.2% (used 1513557 bytes from 1572864 bytes) ; [env:adafruit_matrixportal_esp32s3] extends = esp32_4MB_V4_M_base -platform = espressif32@ ~6.5.0 ;; first platform release supporting matrixportal -platform_packages = platformio/framework-arduinoespressif32 @ 3.20014.231204 ;; arduino-esp32 2.0.14 needed - previous versions were missing files for matrixportal +platform = ${esp32.platformV4_xp} ;; 6.5.0 = first platform release supporting matrixportal +platform_packages = ${esp32.platformV4_packages_xp} ;; arduino-esp32 2.0.14 needed - previous versions were missing files for matrixportal board = adafruit_matrixportal_esp32s3 build_unflags = ${env:esp32S3_8MB_M.build_unflags} ;; use the same as "normal" S3 buildenv @@ -2453,11 +2470,14 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-inden -D LOLIN_WIFI_FIX ;; try this in case Wifi does not work -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0 -D WLED_USE_PSRAM -DBOARD_HAS_PSRAM ; tells WLED that PSRAM shall be used - -D WLED_ENABLE_HUB75MATRIX -D NO_GFX ;-D SPIRAM_FRAMEBUFFER + ${common_mm.HUB75_build_flags} -D DEFAULT_LED_TYPE=101 lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} ;; ;; do not include ${esp32.lib_depsV4} !!!! ${common_mm.animartrix_lib_deps} - https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.10 + ${common_mm.HUB75_lib_deps} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation monitor_filters = esp32_exception_decoder +; +; RAM: [== ] 20.4% (used 66984 bytes from 327680 bytes) +; Flash: [========= ] 94.8% (used 1491489 bytes from 1572864 bytes) From ccff4785072c9a4d03766e4649e271aa907621c9 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 2 May 2024 16:10:07 +0200 Subject: [PATCH 28/42] make sure that segment buffer is initially aligned with LEDs (MM specific) The Segment LEDs buffer is used to optimize out "writing the same color". SEGMENT.fill(BLACK) ensures that all LEDs start clean, consistent with the Segment LEDs buffer. --- wled00/FX.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 0f6bb40a..6870b13a 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1126,7 +1126,7 @@ static const char _data_FX_MODE_RUNNING_RANDOM[] PROGMEM = "Stream ☾@!,Zone si uint16_t larson_scanner(bool dual) { uint16_t counter = strip.now * ((SEGMENT.speed >> 2) +8); uint16_t index = counter * SEGLEN >> 16; - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() SEGMENT.fade_out(SEGMENT.intensity); @@ -1738,7 +1738,7 @@ uint16_t mode_multi_comet(void) { if (SEGENV.step == it) return FRAMETIME; if (!SEGENV.allocateData(sizeof(uint16_t) * 8)) return mode_static(); //allocation failed - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() SEGMENT.fade_out(SEGMENT.intensity); uint16_t* comets = reinterpret_cast(SEGENV.data); @@ -2096,7 +2096,7 @@ uint16_t mode_fire_2012() { const uint16_t strips = SEGMENT.nrOfVStrips(); if (!SEGENV.allocateData(strips * SEGLEN)) return mode_static(); //allocation failed byte* heat = SEGENV.data; - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() const uint32_t it = strip.now >> 5; //div 32 @@ -2529,7 +2529,7 @@ uint16_t ripple_base() uint16_t dataSize = sizeof(ripple) * maxRipples; if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() Ripple* ripples = reinterpret_cast(SEGENV.data); @@ -4309,7 +4309,7 @@ static const char _data_FX_MODE_FLOW[] PROGMEM = "Flow@!,Zones;;!;;m12=1"; //ver uint16_t mode_chunchun(void) { if (SEGLEN == 1) return mode_static(); - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() SEGMENT.fade_out(254); // add a bit of trail uint16_t counter = strip.now * (6 + (SEGMENT.speed >> 4)); uint16_t numBirds = 2 + (SEGLEN >> 3); // 2 + 1/8 of a segment @@ -4825,7 +4825,7 @@ static const char _data_FX_MODE_AURORA[] PROGMEM = "Aurora@!,!;1,2,3;!;;sx=24,pa // Controls are speed, # of pixels, faderate. uint16_t mode_perlinmove(void) { if (SEGLEN == 1) return mode_static(); - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() SEGMENT.fade_out(255-SEGMENT.custom1); for (int i = 0; i < SEGMENT.intensity/16 + 1; i++) { uint16_t locn = inoise16(strip.now*128/(260-SEGMENT.speed)+i*15000, strip.now*128/(260-SEGMENT.speed)); // Get a new pixel location from moving noise. @@ -6058,7 +6058,7 @@ uint16_t mode_2Dghostrider(void) { const size_t maxLighters = min(cols + rows, LIGHTERS_AM); - if (SEGENV.call == 0) SEGMENT.setUpLeds(); + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} if (SEGENV.aux0 != cols || SEGENV.aux1 != rows) { SEGENV.aux0 = cols; SEGENV.aux1 = rows; @@ -6143,7 +6143,7 @@ uint16_t mode_2Dfloatingblobs(void) { if (!SEGENV.allocateData(sizeof(blob_t))) return mode_static(); //allocation failed blob_t *blob = reinterpret_cast(SEGENV.data); - if (SEGENV.call == 0) SEGMENT.setUpLeds(); + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} if (SEGENV.aux0 != cols || SEGENV.aux1 != rows) { SEGENV.aux0 = cols; // re-initialise if virtual size changes SEGENV.aux1 = rows; @@ -6411,6 +6411,7 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli if (SEGENV.call == 0) { SEGMENT.setUpLeds(); + SEGMENT.fill(BLACK); SEGENV.aux0 = 255; SEGMENT.custom1 = *binNum; SEGMENT.custom2 = *maxVol * 2; @@ -6769,7 +6770,7 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline. um_data = simulateSound(SEGMENT.soundSim); } float volumeSmth = *(float*) um_data->u_data[0]; - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() SEGMENT.fade_out(224); // 6.25% uint16_t my_sampleAgc = fmax(fmin(volumeSmth, 255.0), 0); @@ -6923,7 +6924,7 @@ uint16_t mode_noisemeter(void) { // Noisemeter. By Andrew Tuline. } float volumeSmth = *(float*) um_data->u_data[0]; int16_t volumeRaw = *(int16_t*)um_data->u_data[1]; - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() //uint8_t fadeRate = map(SEGMENT.speed,0,255,224,255); uint8_t fadeRate = map(SEGMENT.speed,0,255,200,254); @@ -7125,7 +7126,7 @@ uint16_t mode_pixels(void) { // Pixels. By Andrew Tuline. um_data = simulateSound(SEGMENT.soundSim); } float volumeSmth = *(float*) um_data->u_data[0]; - if (SEGENV.call == 0) SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + if (SEGENV.call == 0) {SEGENV.setUpLeds(); SEGMENT.fill(BLACK);} // WLEDMM use lossless getPixelColor() myVals[strip.now%32] = volumeSmth; // filling values semi randomly @@ -7588,8 +7589,8 @@ uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuli uint8_t *fftResult = (uint8_t*)um_data->u_data[2]; if (SEGENV.call == 0) { - SEGMENT.fill(BLACK); SEGENV.setUpLeds(); // WLEDMM use lossless getPixelColor() + SEGMENT.fill(BLACK); } //SEGMENT.fade_out(224); // Just in case something doesn't get faded. int fadeoutDelay = (256 - SEGMENT.speed) / 96; @@ -7909,7 +7910,7 @@ uint16_t mode_2DAkemi(void) { const uint16_t cols = SEGMENT.virtualWidth(); const uint16_t rows = SEGMENT.virtualHeight(); - // if (SEGENV.call == 0) SEGMENT.setUpLeds(); + if (SEGENV.call == 0) {SEGMENT.setUpLeds(); SEGMENT.fill(BLACK);} uint16_t counter = (strip.now * ((SEGMENT.speed >> 2) +2)) & 0xFFFF; counter = counter >> 8; @@ -8052,7 +8053,8 @@ uint16_t mode_2Dsoap() { random16_set_seed(535); USER_PRINTF("SuperSync\n"); } - SEGMENT.setUpLeds(); + SEGENV.setUpLeds(); + SEGMENT.fill(BLACK); *noise32_x = random16(); *noise32_y = random16(); *noise32_z = random16(); From 70a5d8b843c4c56aa4a8afc88d0e2171f1e42e51 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 4 May 2024 01:16:45 +0200 Subject: [PATCH 29/42] a few more compile-time infos about enabled/disabled features helps to understand what you'll get --- wled00/alexa.cpp | 1 + wled00/dmx_output.cpp | 1 + wled00/hue.cpp | 1 + wled00/ir.cpp | 1 + wled00/json.cpp | 2 ++ wled00/lx_parser.cpp | 2 ++ wled00/mqtt.cpp | 2 ++ wled00/net_debug.cpp | 2 ++ wled00/wled_serial.cpp | 2 ++ wled00/ws.cpp | 1 + 10 files changed, 15 insertions(+) diff --git a/wled00/alexa.cpp b/wled00/alexa.cpp index 179a522c..b02c10e5 100644 --- a/wled00/alexa.cpp +++ b/wled00/alexa.cpp @@ -139,4 +139,5 @@ void onAlexaChange(EspalexaDevice* dev) #else void alexaInit(){} void handleAlexa(){} + #pragma message "Alexa interface disabled" #endif diff --git a/wled00/dmx_output.cpp b/wled00/dmx_output.cpp index aa01c8a3..b3f2eadd 100644 --- a/wled00/dmx_output.cpp +++ b/wled00/dmx_output.cpp @@ -11,6 +11,7 @@ */ #ifdef WLED_ENABLE_DMX +#pragma message "DMX network output enabled" // WLEDMM: seems that DMX output triggers watchdog resets when compiling for IDF 4.4.x #ifdef ARDUINO_ARCH_ESP32 diff --git a/wled00/hue.cpp b/wled00/hue.cpp index 950c5489..54cddd33 100644 --- a/wled00/hue.cpp +++ b/wled00/hue.cpp @@ -205,4 +205,5 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len) #else void handleHue(){} void reconnectHue(){} +#pragma message "Philips HUE bridge interface disabled" #endif diff --git a/wled00/ir.cpp b/wled00/ir.cpp index c3e12544..bfb79264 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -7,6 +7,7 @@ */ #if defined(WLED_DISABLE_INFRARED) +#pragma message "IR remote support disabled" void handleIR(){} #else diff --git a/wled00/json.cpp b/wled00/json.cpp index dbb51f91..35d19198 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -1529,6 +1529,8 @@ void serveJson(AsyncWebServerRequest* request) #ifdef WLED_ENABLE_JSONLIVE #define MAX_LIVE_LEDS 180 +#warning "JSON Live enabled" + bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient) { #ifdef WLED_ENABLE_WEBSOCKETS diff --git a/wled00/lx_parser.cpp b/wled00/lx_parser.cpp index e717f941..5fe7c18c 100644 --- a/wled00/lx_parser.cpp +++ b/wled00/lx_parser.cpp @@ -68,4 +68,6 @@ void parseLxJson(int lxValue, byte segId, bool secondary) } } +#else +#pragma message "Loxone support disabled" #endif diff --git a/wled00/mqtt.cpp b/wled00/mqtt.cpp index a5caaf47..31162148 100644 --- a/wled00/mqtt.cpp +++ b/wled00/mqtt.cpp @@ -195,4 +195,6 @@ bool initMqtt() mqtt->connect(); return true; } +#else +#pragma message "MQTT disabled" #endif diff --git a/wled00/net_debug.cpp b/wled00/net_debug.cpp index a345dd30..43c47ac1 100644 --- a/wled00/net_debug.cpp +++ b/wled00/net_debug.cpp @@ -26,4 +26,6 @@ size_t NetworkDebugPrinter::write(const uint8_t *buf, size_t size) { NetworkDebugPrinter NetDebug; +#else +#pragma message "Net debug disabled" #endif diff --git a/wled00/wled_serial.cpp b/wled00/wled_serial.cpp index 596b5791..dd03d8be 100644 --- a/wled00/wled_serial.cpp +++ b/wled00/wled_serial.cpp @@ -229,6 +229,8 @@ void handleSerial() //#ifdef WLED_DEBUG if ((millis() - startTime) > SERIAL_MAXTIME_MILLIS) { USER_PRINTLN(F("handleSerial(): need a break after >100ms of activity.")); } //#endif + #else + #pragma message "Serial protocols (AdaLight, Serial JSON, Serial LED driver) disabled" #endif // If Continuous Serial Streaming is enabled, send new LED data as bytes diff --git a/wled00/ws.cpp b/wled00/ws.cpp index 351caad4..08624b1e 100644 --- a/wled00/ws.cpp +++ b/wled00/ws.cpp @@ -313,4 +313,5 @@ void handleWs() #else void handleWs() {} void sendDataWs(AsyncWebSocketClient * client) {} +#pragma message "WebSockets disabled - no live preview." #endif From fc66dcc0ceb5b74907ce57fd62ab72669739959f Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 4 May 2024 01:44:14 +0200 Subject: [PATCH 30/42] squeezing a few KB out of builds that are close to 100% flash usage --- platformio.ini | 42 +++++++++++-------- .../usermod_v2_four_line_display_ALT.h | 2 +- wled00/wled_serial.cpp | 2 +- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/platformio.ini b/platformio.ini index c0c90a6d..19df7ac7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1067,6 +1067,7 @@ lib_deps_V4_M = ${common_mm.animartrix_lib_deps} build_flags_XL = + -D WLEDMM_SAVE_FLASH -D USERMOD_WEATHER ; WLEDMM usermod -D USERMOD_MPU6050_IMU ; gyro/accelero for USERMOD_GAMES (ONLY WORKS IF USERMOD_FOUR_LINE_DISPLAY NOT INCLUDED - I2C SHARING BUG) -D USERMOD_GAMES ; WLEDMM usermod @@ -1238,6 +1239,7 @@ build_flags = ${esp32_4MB_S_base.build_flags} -D WLED_DISABLE_LOXONE ;-D WLED_DISABLE_MQTT ;-D WLED_DISABLE_INFRARED + -D WLEDMM_SAVE_FLASH ;WLEDMM: disable the next two lines if you don't need "net Debug". It will free ~2% of flash -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 @@ -1245,15 +1247,15 @@ build_flags = ${esp32_4MB_S_base.build_flags} ; RAM: [=== ] 25.0% (used 81988 bytes from 327680 bytes) ; Flash: [========= ] 87.4% (used 1374677 bytes from 1572864 bytes) WLEDMM: Earlier 85.7 ;; optimized-for-speed build -; RAM: [=== ] 25.8% (used 84628 bytes from 327680 bytes) -; Flash: [==========] 99.4% (used 1562869 bytes from 1572864 bytes) +; RAM: [=== ] 25.4% (used 83244 bytes from 327680 bytes) +; Flash: [========= ] 93.3% (used 1466821 bytes from 1572864 bytes) [env:esp32_4MB_M] extends = esp32_4MB_M_base build_flags = ${esp32_4MB_M_base.build_flags} -D WLED_RELEASE_NAME=esp32_4MB_M -; RAM: [=== ] 25.2% (used 82628 bytes from 327680 bytes) -; Flash: [========= ] 94.3% (used 1483793 bytes from 1572864 bytes) WLEDMM: earlier 91.1 +; RAM: [=== ] 26.0% (used 85244 bytes from 327680 bytes) +; Flash: [==========] 97.4% (used 1532125 bytes from 1572864 bytes) [env:esp32_4MB_M_eth] extends = esp32_4MB_M_base @@ -1276,8 +1278,8 @@ build_flags = ${esp32_4MB_XL_base.build_flags} -D WLEDMM_SAVE_FLASH ;; a humble attempt to save a few extra bytes build_unflags = ${esp32_4MB_XL_base.build_unflags} board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv -; RAM: [=== ] 26.3% (used 86172 bytes from 327680 bytes) -; Flash: [========= ] 85.0% (used 1615569 bytes from 1900544 bytes) +; RAM: [=== ] 26.3% (used 86188 bytes from 327680 bytes) +; Flash: [========= ] 85.2% (used 1619513 bytes from 1900544 bytes) ;; standard framework build for 16MB flash, optimized for speed [env:esp32_16MB_S] @@ -1310,8 +1312,8 @@ build_flags = ${esp32_4MB_M_base.build_flags} board = esp32_16MB board_build.partitions = tools/WLED_ESP32_16MB.csv ;; WLED standard for 16MB flash: 2MB firmware, 12 MB filesystem ;board_build.partitions = tools/WLED_ESP32_16MB_9MB_FS.csv ;; WLED extended for 16MB flash: 3.2MB firmware, 9 MB filesystem - ; RAM: [== ] 24.4% (used 79916 bytes from 327680 bytes) - ; Flash: [======= ] 67.0% (used 1405701 bytes from 2097152 bytes) + ; RAM: [=== ] 26.0% (used 85244 bytes from 327680 bytes) + ; Flash: [======= ] 73.1% (used 1532125 bytes from 2097152 bytes) ;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation [env:esp32_4MB_M_debug] @@ -1364,8 +1366,8 @@ build_flags = ${esp32_4MB_M_base.build_flags} -D WLED_RELEASE_NAME=esp32_16MB_M_eth ; This will be included in the firmware.bin filename -D WLED_USE_ETHERNET -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only -; RAM: [== ] 24.5% (used 80348 bytes from 327680 bytes) -; Flash: [======= ] 69.4% (used 1455233 bytes from 2097152 bytes) +; RAM: [=== ] 26.1% (used 85452 bytes from 327680 bytes) +; Flash: [======= ] 73.3% (used 1537945 bytes from 2097152 bytes) [env:esp8266_2MB_S] @@ -1608,7 +1610,7 @@ build_unflags = ${esp32_4MB_V4_M_base.build_unflags} -D WLED_ENABLE_HUB75MATRIX ;; RAM: [=== ] 28.0% (used 91664 bytes from 327680 bytes) -;; Flash: [==========] 99.9% (used 1572053 bytes from 1572864 bytes) +;; Flash: [==========] 99.5% (used 1564945 bytes from 1572864 bytes) ;; V4 build for 16MB flash, optimized for speed [env:esp32_16MB_V4_S] @@ -1965,14 +1967,15 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -Wno-misleading-inden -D WLED_DISABLE_INFRARED ; RAM 136 bytes; FLASH 24492 bytes - disabled to stay below 100% ;; -D WLED_DISABLE_ALEXA ; RAM 116 bytes; FLASH 13524 bytes ;; -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes + -D WLEDMM_SAVE_FLASH ; -D WLED_DEBUG ; -D SR_DEBUG ; -D MIC_LOGGER lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [== ] 20.6% (used 67524 bytes from 327680 bytes) -; Flash: [==========] 98.5% (used 1549341 bytes from 1572864 bytes) +; RAM: [== ] 20.6% (used 67532 bytes from 327680 bytes) +; Flash: [==========] 98.4% (used 1547445 bytes from 1572864 bytes) # ------------------------------------------------------------------------------ @@ -2017,6 +2020,7 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_DISABLE_ALEXA ;; RAM 116 bytes; FLASH 13524 bytes ; -D WLED_DISABLE_MQTT ;; RAM 216 bytes; FLASH 16496 bytes -D WLED_DISABLE_INFRARED ;; RAM 136 bytes; FLASH 24492 bytes + -D WLEDMM_SAVE_FLASH -D LEDPIN=39 ;; onboard neopixel LED. Attach your own LEDs to GPIO 7 or GPIO 6 -D BTNPIN=0 ;-D RLYPIN=6 @@ -2035,7 +2039,7 @@ lib_ignore = OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE monitor_filters = esp32_exception_decoder ; RAM: [== ] 21.5% (used 70448 bytes from 327680 bytes) -; Flash: [==========] 99.5% (used 1434054 bytes from 1441792 bytes) !!! 99% +; Flash: [==========] 99.4% (used 1432846 bytes from 1441792 bytes) ;; MM environment for generic ESP32-S2, with PSRAM, 4MB flash (300kB filesystem to have more program space) ;; PINs assignments optimized for use with serg74 "mini shield" @@ -2070,6 +2074,7 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_DISABLE_ALEXA ;; save flash space -D WLED_DISABLE_HUESYNC ;; save flash space -D WLED_DISABLE_LOXONE ;; save flash space + -D WLEDMM_SAVE_FLASH -D AUDIOPIN=-1 -D BTNPIN=-1 -D IRPIN=-1 -D LEDPIN=16 ;; second led pin = 18 @@ -2085,8 +2090,8 @@ lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE monitor_filters = esp32_exception_decoder -; RAM: [=== ] 29.7% (used 97376 bytes from 327680 bytes) -; Flash: [======== ] 81.4% (used 1547834 bytes from 1900544 bytes) +; RAM: [== ] 21.8% (used 71304 bytes from 327680 bytes) +; Flash: [======== ] 84.0% (used 1596970 bytes from 1900544 bytes) # ------------------------------------------------------------------------------ @@ -2131,6 +2136,7 @@ build_flags = ${common.build_flags} ${esp32c3.build_flags} -D WLEDMM_WIFI_POWERON_HACK -DLOLIN_WIFI_FIX ;; use this _only_ if your device is not able to make a WiFI connection! ;-D WLED_DISABLE_INFRARED ;; save flash space ;-D WLED_DISABLE_ALEXA ;; save flash space + -D WLEDMM_SAVE_FLASH -D LEDPIN=8 ;; onboard neopixel 5x5 Matrix. Attach your own LEDs to GPIO 20 -D BTNPIN=9 ; -D STATUSLED=10 ;; onboard LED @@ -2145,7 +2151,7 @@ lib_ignore = OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE U8g2 ; not needed as we don't include USERMOD_FOUR_LINE_DISPLAY ; RAM: [=== ] 25.9% (used 84884 bytes from 327680 bytes) -; Flash: [==========] 99.1% (used 1557952 bytes from 1572864 bytes) +; Flash: [==========] 98.9% (used 1555608 bytes from 1572864 bytes) ;; MM environment for ESP32-C3 "mini" and "super mini" -> flash mode "dio" instead of "qio" (see #101) [env:esp32c3mini_dio_4MB_M] @@ -2164,7 +2170,7 @@ build_flags = ${env:esp32c3dev_4MB_M.build_flags} -D WLED_DISABLE_ADALIGHT ;; to disable serial protocols for boards with CDC USB (Serial RX will receive junk commands, unless its pulled down by resistor) -D HW_PIN_SDA=0 -D HW_PIN_SCL=1 ;; avoid pin conflicts ; RAM: [=== ] 25.8% (used 84700 bytes from 327680 bytes) -; Flash: [==========] 98.9% (used 1554906 bytes from 1572864 bytes) +; Flash: [==========] 98.7% (used 1552582 bytes from 1572864 bytes) ;; MM environment for "seeed xiao -C3" boards [env:seeed_esp32c3_4MB_S] diff --git a/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h b/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h index cc6d7b29..89854571 100644 --- a/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h +++ b/usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h @@ -488,7 +488,7 @@ void FourLineDisplayUsermod::draw2x2String(uint8_t col, uint8_t row, const char if (!typeOK || !enabled) return; if (u8x8 == nullptr) return; if (FLD_SemaphoreTake(drawMux, maxWait) != pdTRUE) return; // WLEDMM acquire draw mutex -#if defined(ARDUINO_ARCH_ESP32) && !defined(OLD_4LD_FONTS) // WLEDMM use nicer 2x2 font on ESP32 +#if defined(ARDUINO_ARCH_ESP32) && !defined(OLD_4LD_FONTS) && !defined(WLEDMM_SAVE_FLASH) // WLEDMM use nicer 2x2 font on ESP32 if (lineHeight>1) { // WLEDMM use 2x3 on 128x64 displays //u8x8->setFont(u8x8_font_profont29_2x3_r); // sans serif 2x3 u8x8->setFont(u8x8_font_courB18_2x3_r); // courier bold 2x3 diff --git a/wled00/wled_serial.cpp b/wled00/wled_serial.cpp index dd03d8be..221f21ad 100644 --- a/wled00/wled_serial.cpp +++ b/wled00/wled_serial.cpp @@ -230,7 +230,7 @@ void handleSerial() if ((millis() - startTime) > SERIAL_MAXTIME_MILLIS) { USER_PRINTLN(F("handleSerial(): need a break after >100ms of activity.")); } //#endif #else - #pragma message "Serial protocols (AdaLight, Serial JSON, Serial LED driver) disabled" + #pragma message "Serial protocols (AdaLight, Serial JSON, Serial LED driver, improv) disabled" #endif // If Continuous Serial Streaming is enabled, send new LED data as bytes From 6fa3456e007df494bd6c17f5f8a326c74e9bdad4 Mon Sep 17 00:00:00 2001 From: Michael Wyraz Date: Sat, 25 Nov 2023 16:42:39 +0100 Subject: [PATCH 31/42] Support for wiz smart button --- wled00/remote.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wled00/remote.cpp b/wled00/remote.cpp index 48a3297d..64c668c5 100644 --- a/wled00/remote.cpp +++ b/wled00/remote.cpp @@ -17,6 +17,11 @@ #define WIZMOTE_BUTTON_BRIGHT_UP 9 #define WIZMOTE_BUTTON_BRIGHT_DOWN 8 +#define WIZ_SMART_BUTTON_ON 100 +#define WIZ_SMART_BUTTON_OFF 101 +#define WIZ_SMART_BUTTON_BRIGHT_UP 102 +#define WIZ_SMART_BUTTON_BRIGHT_DOWN 103 + #ifdef WLED_DISABLE_ESPNOW void handleRemote(){} #else @@ -149,7 +154,6 @@ void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) { return; } - USER_PRINT(F("\nIncoming ESP Now Packet[")); USER_PRINT(cur_seq); USER_PRINT(F("] from sender[")); @@ -166,8 +170,11 @@ void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) { case WIZMOTE_BUTTON_NIGHT : activateNightMode(); stateUpdated(CALL_MODE_BUTTON); break; case WIZMOTE_BUTTON_BRIGHT_UP : brightnessUp(); stateUpdated(CALL_MODE_BUTTON); break; case WIZMOTE_BUTTON_BRIGHT_DOWN : brightnessDown(); stateUpdated(CALL_MODE_BUTTON); break; + case WIZ_SMART_BUTTON_ON : setOn(); break; + case WIZ_SMART_BUTTON_OFF : setOff(); break; + case WIZ_SMART_BUTTON_BRIGHT_UP : brightnessUp(); break; + case WIZ_SMART_BUTTON_BRIGHT_DOWN : brightnessDown(); break; default: break; - } last_seq = cur_seq; From ecf7acbc76af474f781764d259e49ccb4c3bf352 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 4 May 2024 13:36:56 +0200 Subject: [PATCH 32/42] AR pin config: SCK == 1 --> PDM microphone --- usermods/audioreactive/audio_reactive.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 8fa65e30..18c9ad23 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1800,6 +1800,10 @@ class AudioReactive : public Usermod { #endif delay(100); // Give that poor microphone some time to setup. + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) + if ((i2sckPin == I2S_PIN_NO_CHANGE) && ((dmType == 1) || (dmType == 4)) ) dmType = 5; // dummy user support: SCK == -1 --means--> PDM microphone + #endif + useInputFilter = 2; // default: DC blocker switch (dmType) { #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) From daec240c52b1735e17860b3bc9d424d0bbc24377 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 4 May 2024 13:55:25 +0200 Subject: [PATCH 33/42] small improvement for athom music --- platformio.ini | 7 +++++-- usermods/audioreactive/audio_reactive.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 19df7ac7..e3af913d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -2354,13 +2354,14 @@ board_build.partitions = tools/WLED_ESP32_16MB.csv ;; WLED standard for ;https://www.athom.tech/blank-1/wled-esp32-music-addressable-led-strip-controller [env:athom_music_esp32_4MB_M] extends = esp32_4MB_M_base -build_flags = ${esp32_4MB_M_base.build_flags} ${Athom_PDMmic.build_flags} +build_flags = ${esp32_4MB_M_base.build_flags} + ${Athom_PDMmic.build_flags} -D WLED_AP_SSID_UNIQUE -D WLED_RELEASE_NAME=athom_music_esp32_4MB_M -D ABL_MILLIAMPS_DEFAULT=14500 ; max 15A -D WLED_DISABLE_MQTT -D WLED_DISABLE_LOXONE -D WLED_DISABLE_ADALIGHT ;to get 4ld working - -D BTNPIN=0 -D RLYPIN=2 -D IRPIN=25 -D IRTYPE=9 -D LEDPIN=18 -D + -D BTNPIN=0 -D RLYPIN=2 -D IRPIN=25 -D IRTYPE=9 -D LEDPIN=18 -D AUDIOPIN=-1 ; -D TEMPERATURE_PIN=23 -D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global! @@ -2370,6 +2371,8 @@ build_flags = ${esp32_4MB_M_base.build_flags} ${Athom_PDMmic.build_flags} ; -D PIR_SENSOR_PIN=-1 ; -D PWM_PIN=-1 ; -D WLED_USE_MY_CONFIG +; RAM: [=== ] 25.9% (used 84948 bytes from 327680 bytes) +; Flash: [==========] 95.9% (used 1509113 bytes from 1572864 bytes) ;https://shop.myhome-control.de/Elektronik/ [env:abc_wled_controller_v43_S] diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 18c9ad23..6e4189fe 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1801,7 +1801,8 @@ class AudioReactive : public Usermod { delay(100); // Give that poor microphone some time to setup. #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) - if ((i2sckPin == I2S_PIN_NO_CHANGE) && ((dmType == 1) || (dmType == 4)) ) dmType = 5; // dummy user support: SCK == -1 --means--> PDM microphone + if ((i2sckPin == I2S_PIN_NO_CHANGE) && (i2ssdPin >= 0) && (i2swsPin >= 0) + && ((dmType == 1) || (dmType == 4)) ) dmType = 51; // dummy user support: SCK == -1 --means--> PDM microphone #endif useInputFilter = 2; // default: DC blocker From 4378bdda61d9cd7cf7c1f4d2dd2d856725d4e01a Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 4 May 2024 14:06:24 +0200 Subject: [PATCH 34/42] build no 2405040 --- platformio.ini | 2 ++ wled00/wled.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index e3af913d..60462eae 100644 --- a/platformio.ini +++ b/platformio.ini @@ -2392,6 +2392,8 @@ build_flags = ${esp32_4MB_S_base.build_flags} -D SR_DMTYPE=4 -D I2S_SDPIN=32 -D I2S_WSPIN=15 -D I2S_CKPIN=14 -D MCLK_PIN=0 ; generic i2s with mclk 0 -D SR_SQUELCH=1 -D SR_GAIN=60 ; increrase squelch if noise, in test 0 is okay, but only slightly -D SR_FREQ_PROF=1 ; Generic line in +; RAM: [=== ] 25.9% (used 84884 bytes from 327680 bytes) +; Flash: [========= ] 88.7% (used 1395249 bytes from 1572864 bytes) ; ESP32 WLED pico board with builtin ICS-43432 microphpone [env:esp32_pico_4MB_M] diff --git a/wled00/wled.h b/wled00/wled.h index 050df258..f2a99ced 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2404281 +#define VERSION 2405040 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ From 6261ecc05721aef1356ec3078115a100072b952d Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sat, 4 May 2024 14:54:22 +0200 Subject: [PATCH 35/42] Change default for ArduinoOTA (not the same as OTA) --- wled00/wled.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/wled.h b/wled00/wled.h index f2a99ced..b0697f5b 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -539,7 +539,8 @@ WLED_GLOBAL byte macroDoublePress[WLED_MAX_BUTTONS] _INIT({0}); WLED_GLOBAL bool otaLock _INIT(false); // prevents OTA firmware updates without password. ALWAYS enable if system exposed to any public networks WLED_GLOBAL bool wifiLock _INIT(false); // prevents access to WiFi settings when OTA lock is enabled #ifdef ARDUINO_ARCH_ESP32 -WLED_GLOBAL bool aOtaEnabled _INIT(true); // ArduinoOTA allows easy updates directly from the IDE. Careful, it does not auto-disable when OTA lock is on +// WLEDMM disabled as default - arduinoOTA is a relic, only useful when using ArduinoIDE +WLED_GLOBAL bool aOtaEnabled _INIT(false); // ArduinoOTA allows easy updates directly from the IDE. Careful, it does not auto-disable when OTA lock is on #else WLED_GLOBAL bool aOtaEnabled _INIT(false); // WLEDMM: start with OTA disabled, as it seems to be unstable on 8266 #endif From a78cd65dcdf7299bfba9006210fdfcf3e7482499 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 5 May 2024 21:56:01 +0200 Subject: [PATCH 36/42] output_bin.py : fix for mapfile copy The build script was not looking into the right place, so there was never a .map file dropped into build_output/map/ Builds with the newer arduino-esp32 v2.0.x framework actually generate a .map file that is placed directly next to firmware.bin --- pio-scripts/output_bins.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pio-scripts/output_bins.py b/pio-scripts/output_bins.py index 2b047780..4df40ed4 100644 --- a/pio-scripts/output_bins.py +++ b/pio-scripts/output_bins.py @@ -25,6 +25,8 @@ def _create_dirs(dirs=["firmware", "map"]): def bin_rename_copy(source, target, env): _create_dirs() variant = env["PIOENV"] + builddir = os.path.join(env["PROJECT_BUILD_DIR"], variant) + source_map = os.path.join(builddir, env["PROGNAME"] + ".map") # create string with location and file names based on variant map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant) @@ -48,7 +50,11 @@ def bin_rename_copy(source, target, env): # copy firmware.map to map/.map if os.path.isfile("firmware.map"): - shutil.move("firmware.map", map_file) + print("Found linker mapfile firmware.map") + shutil.copy("firmware.map", map_file) + if os.path.isfile(source_map): + print(f"Found linker mapfile {source_map}") + shutil.copy(source_map, map_file) def bin_gzip(source, target, env): _create_dirs() From c3a908634ad59b93957a5c7674b80b7c3cc74d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Fri, 3 May 2024 23:25:36 +0200 Subject: [PATCH 37/42] Merge pull request #3946 from freakintoddles2/0_15 Adds an API parameter to allow the user to skip to the next preset in a playlist at any time --- wled00/json.cpp | 2 ++ wled00/playlist.cpp | 3 ++- wled00/set.cpp | 3 +++ wled00/wled.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index 35d19198..64254963 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -597,6 +597,8 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) } } + doAdvancePlaylist = root[F("np")] | doAdvancePlaylist; //advances to next preset in playlist when true + stateUpdated(callMode); if (presetToRestore) currentPreset = presetToRestore; diff --git a/wled00/playlist.cpp b/wled00/playlist.cpp index 236cc324..1d6f7a99 100644 --- a/wled00/playlist.cpp +++ b/wled00/playlist.cpp @@ -137,7 +137,7 @@ void handlePlaylist() { return; // but don't progress to next extry, and don't shuffle } - if (millis() - presetCycledTime > (100*playlistEntryDur)) { +if (millis() - presetCycledTime > (100 * playlistEntryDur) || doAdvancePlaylist) { presetCycledTime = millis(); if (bri == 0 || nightlightActive) return; @@ -159,6 +159,7 @@ void handlePlaylist() { transitionDelayTemp = playlistEntries[playlistIndex].tr * 100; playlistEntryDur = playlistEntries[playlistIndex].dur; applyPreset(playlistEntries[playlistIndex].preset); + doAdvancePlaylist = false; } } diff --git a/wled00/set.cpp b/wled00/set.cpp index 3b7c8a9c..31fbb784 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -922,6 +922,9 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply) applyPreset(presetCycCurr); } + pos = req.indexOf(F("NP")); //advances to next preset in a playlist + if (pos > 0) doAdvancePlaylist = true; + //set brightness updateVal(req.c_str(), "&A=", &bri); diff --git a/wled00/wled.h b/wled00/wled.h index b0697f5b..a0e4283e 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -653,6 +653,7 @@ WLED_GLOBAL byte timerWeekday[] _INIT_N(({ 255, 255, 255, 255, 255, 255, 255, WLED_GLOBAL byte timerMonth[] _INIT_N(({28,28,28,28,28,28,28,28})); WLED_GLOBAL byte timerDay[] _INIT_N(({1,1,1,1,1,1,1,1})); WLED_GLOBAL byte timerDayEnd[] _INIT_N(({31,31,31,31,31,31,31,31})); +WLED_GLOBAL bool doAdvancePlaylist _INIT(false); //improv WLED_GLOBAL byte improvActive _INIT(0); //0: no improv packet received, 1: improv active, 2: provisioning From 44600b172276b78f8eb3467b0dad56a86661b023 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 6 May 2024 11:00:41 +0200 Subject: [PATCH 38/42] make objdump work Script update based on latest version from Tasmota * add support for all esp32 variants * add "-C" : Decode (demangle) low-level symbol names into user-level C++ names. --- pio-scripts/obj-dump.py | 19 +++++++++++++++++-- platformio.ini | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pio-scripts/obj-dump.py b/pio-scripts/obj-dump.py index 91bc3de5..174df509 100644 --- a/pio-scripts/obj-dump.py +++ b/pio-scripts/obj-dump.py @@ -1,9 +1,24 @@ # Little convenience script to get an object dump +# You may add "-S" to the objdump commandline (i.e. replace "-D -C " with "-d -S -C ") +# to get source code intermixed with disassembly (SLOW !) Import('env') def obj_dump_after_elf(source, target, env): + platform = env.PioPlatform() + board = env.BoardConfig() + mcu = board.get("build.mcu", "esp32") + print("Create firmware.asm") - env.Execute("xtensa-lx106-elf-objdump "+ "-D " + str(target[0]) + " > "+ "${PROGNAME}.asm") - + if mcu == "esp8266": + env.Execute("xtensa-lx106-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm") + if mcu == "esp32": + env.Execute("xtensa-esp32-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm") + if mcu == "esp32s2": + env.Execute("xtensa-esp32s2-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm") + if mcu == "esp32s3": + env.Execute("xtensa-esp32s3-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm") + if mcu == "esp32c3": + env.Execute("riscv32-esp-elf-objdump "+ "-D -C " + str(target[0]) + " > "+ "$BUILD_DIR/${PROGNAME}.asm") + env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", [obj_dump_after_elf]) diff --git a/platformio.ini b/platformio.ini index 60462eae..48ddc574 100644 --- a/platformio.ini +++ b/platformio.ini @@ -215,6 +215,7 @@ extra_scripts = post:pio-scripts/output_bins.py post:pio-scripts/strip-floats.py pre:pio-scripts/user_config_copy.py + ; post:pio-scripts/obj-dump.py ;; convenience script to create a disassembly dump of the firmware (hardcore debugging) # ------------------------------------------------------------------------------ # COMMON SETTINGS: From 6c0b73be32279a74e301a9de3fdc8f59f81bb875 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 6 May 2024 12:53:48 +0200 Subject: [PATCH 39/42] Update platformio.ini * added ${common_mm.NetDebug_build_flags} to de-dupliate flags * small update to pico V4 env * removed refs to non-existing file (comments only) --- platformio.ini | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/platformio.ini b/platformio.ini index 48ddc574..9471b484 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1022,6 +1022,11 @@ HUB75_build_flags = HUB75_lib_deps = https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-DMA.git @ 3.0.10 HUB75_lib_ignore = ESP32 HUB75 LED MATRIX PANEL DMA Display ;; to remove the HUB75 lib dependancy (saves a few bytes) +NetDebug_build_flags = + ;; WLEDMM: only setting WLED_DEBUG_HOST is enough, ip and port can be defined in sync settings as well + -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible + -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 + build_flags_S = -Wall -Wformat -Woverflow -Wuninitialized -Winit-self -Warray-bounds ; enables more warnings @@ -1051,9 +1056,7 @@ build_flags_M = -D USERMOD_ROTARY_ENCODER_UI -D USERMOD_AUTO_SAVE ${common_mm.animartrix_build_flags} - ;WLEDMM: only setting WLED_DEBUG_HOST is enough, ip and port can be defined in sync settings as well - -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible - -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 + ${common_mm.NetDebug_build_flags} lib_deps_M = ;https://github.com/blazoncek/OneWire.git ; includes bugfixes for inconsistent readings @@ -1127,14 +1130,12 @@ extends = esp32_4MB_S_base build_flags = ${common.build_flags_esp32} ${common_mm.build_flags_S} ${common_mm.build_flags_M} ;; we don't want common_mm.build_disable_sync_interfaces, so we cannot inherit from esp32_4MB_S_base build_unflags = ${esp32_4MB_S_base.build_unflags} lib_deps = ${esp32_4MB_S_base.lib_deps} ${common_mm.lib_deps_M} -; board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv [esp32_4MB_XL_base] extends = esp32_4MB_M_base build_flags = ${esp32_4MB_M_base.build_flags} ${common_mm.build_flags_XL} build_unflags = ${esp32_4MB_M_base.build_unflags} lib_deps = ${esp32_4MB_M_base.lib_deps} ${common_mm.lib_deps_XL} -; board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv ;common default for all V4 min environments, including -S3, -S2, -C3 [esp32_4MB_V4_S_base] @@ -1241,9 +1242,8 @@ build_flags = ${esp32_4MB_S_base.build_flags} ;-D WLED_DISABLE_MQTT ;-D WLED_DISABLE_INFRARED -D WLEDMM_SAVE_FLASH - ;WLEDMM: disable the next two lines if you don't need "net Debug". It will free ~2% of flash - -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible - -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 + ;WLEDMM: disable the next line if you don't need "net Debug". It will free ~2% of flash + ${common_mm.NetDebug_build_flags} ;; normal build ; RAM: [=== ] 25.0% (used 81988 bytes from 327680 bytes) ; Flash: [========= ] 87.4% (used 1374677 bytes from 1572864 bytes) WLEDMM: Earlier 85.7 @@ -1385,8 +1385,7 @@ build_flags = ${common.build_flags_esp8266} ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ; -D WLED_DISABLE_2D ; -UWLED_USE_MY_CONFIG - -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible - -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 + ${common_mm.NetDebug_build_flags} ; -D WLED_DEBUG ; monitor_filters = esp8266_exception_decoder ;; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation @@ -1407,8 +1406,7 @@ build_flags = ${common.build_flags_esp8266} ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ; -D WLED_DISABLE_2D ; -UWLED_USE_MY_CONFIG - -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible - -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 + ${common_mm.NetDebug_build_flags} ; -D WLED_DEBUG ; monitor_filters = esp8266_exception_decoder ;; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation @@ -1436,8 +1434,7 @@ build_flags = ${common.build_flags_esp8266} ; -D USERMOD_ARTIFX ; this is compiling but not working due to low memory on 8266 -D USERMOD_BATTERY ;; enable Battery usermod -D USERMOD_BATTERY_USE_LIPO ;; use new "discharging curve" for LiPo cells - -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible - -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 + ${common_mm.NetDebug_build_flags} ; -D WLED_DEBUG monitor_filters = esp8266_exception_decoder lib_deps = ${esp8266.lib_deps} @@ -1492,8 +1489,7 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABLE_HUESYNC ; -D WLED_DEBUG ${common.debug_flags} ;; un-comment for debug messages - -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible - -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 + ${common_mm.NetDebug_build_flags} ;; -D WLED_DISABLE_ESPNOW ;; might help in case of WiFi connectivity problems ; -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes ; -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes @@ -1533,8 +1529,7 @@ build_flags = ${common.build_flags_esp8266} -D USERMOD_FOUR_LINE_DISPLAY -D USERMOD_MPU6050_IMU ; gyro/accelero for USERMOD_GAMES (ONLY WORKS IF USERMOD_FOUR_LINE_DISPLAY NOT INCLUDED - I2C SHARING BUG) -D USERMOD_GAMES ; WLEDMM usermod - -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible - -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 + ${common_mm.NetDebug_build_flags} ; -D WLED_DEBUG monitor_filters = esp8266_exception_decoder lib_deps = ${esp8266.lib_deps} @@ -2448,6 +2443,7 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} -D WLED_WATCHDOG_TIMEOUT=0 ; -D WLED_WATCHDOG_TIMEOUT=60 -D WLED_DISABLE_ADALIGHT ;; WLEDMM this board does not have a serial-to-USB chip. Better to disable serial protocols, to avoid crashes (see upstream #3128) + ${common_mm.NetDebug_build_flags} ;; net debug is not included in normal _S builds ; -D WLED_DEBUG ; -D SR_DEBUG -D LEDPIN=2 @@ -2459,9 +2455,11 @@ build_flags = ${esp32_4MB_V4_S_base.esp32_build_flags} -D SR_ENABLE_DEFAULT ;; enable audioreactive at first start - no need to manually set "enable", then reboot ; -D WLED_USE_MY_CONFIG lib_deps = ${esp32_4MB_V4_S_base.esp32_lib_deps} -lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [=== ] 27.9% (used 91448 bytes from 327680 bytes) -; Flash: [==========] 96.2% (used 1513557 bytes from 1572864 bytes) +lib_ignore = + IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation + ${common_mm.HUB75_lib_ignore} +; RAM: [=== ] 27.9% (used 91528 bytes from 327680 bytes) +; Flash: [==========] 96.7% (used 1521457 bytes from 1572864 bytes) ; From 45d07190c99b15c24ad02409e76703612e032ee4 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 6 May 2024 20:11:53 +0200 Subject: [PATCH 40/42] -S3: show PSRAM mode (qspi or OPI) in info panel --- wled00/data/index.js | 2 +- wled00/json.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wled00/data/index.js b/wled00/data/index.js index 31726f40..4744fb38 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -702,7 +702,7 @@ ${i.psram?inforow("PSRAM ☾",((i.tpram-i.psram)/1024).toFixed(0)+"/"+(i.tpram/1 ${i.psusedram?inforow("Max used PSRAM ☾",((i.tpram-i.psusedram)/1024).toFixed(0)+" kB",", "+((i.tpram-i.psusedram)*100.0/i.tpram).toFixed(1)+"%"):""} ${i.freestack?inforow("Free stack ☾",(i.freestack/1000).toFixed(3)," kB"):""} -${i.tpram?inforow("PSRAM ☾",(i.tpram/1024/1024).toFixed(0)," MB"):""} +${i.tpram?inforow("PSRAM " + (i.psrmode?"("+i.psrmode+" mode) ":"") + " ☾",(i.tpram/1024/1024).toFixed(0)," MB"):""} ${i.e32flash?inforow("Flash mode "+i.e32flashmode+i.e32flashtext + " ☾",i.e32flash+" MB, "+i.e32flashspeed," Mhz"):""} ${i.e32model?inforow(i.e32model + " ☾",i.e32cores +" core(s),"," "+i.e32speed+" Mhz"):""} ${inforow("Environment",i.arch + " " + i.core + " (" + i.lwip + ")")} diff --git a/wled00/json.cpp b/wled00/json.cpp index 64254963..c03a61f0 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -1066,6 +1066,13 @@ void serializeInfo(JsonObject root) root[F("tpram")] = ESP.getPsramSize(); //WLEDMM root[F("psram")] = ESP.getFreePsram(); root[F("psusedram")] = ESP.getMinFreePsram(); + #if CONFIG_ESP32S3_SPIRAM_SUPPORT // WLEDMM -S3 has "qspi" or "opi" PSRAM mode + #if CONFIG_SPIRAM_MODE_OCT + root[F("psrmode")] = F("🚀 OPI"); + #elif CONFIG_SPIRAM_MODE_QUAD + root[F("psrmode")] = F("qspi 🛻"); + #endif + #endif } #else // for testing From 1d5f029b3487d1d7fe6098cab40a949768ab0e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Tue, 7 May 2024 07:35:46 +0200 Subject: [PATCH 41/42] Merge pull request #3942 from gaaat98/audioreactive-analog Enabled some audioreactive effects for single pixel strips/segments --- wled00/FX.cpp | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 6870b13a..0565c0b2 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -6776,12 +6776,13 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline. uint16_t my_sampleAgc = fmax(fmin(volumeSmth, 255.0), 0); for (size_t i=0; i 1.0f)) SEGMENT.setPixelColor(SEGENV.aux1,SEGENV.step); // "repaint" last pixel after blur uint16_t segLoc = random16(SEGLEN); + if (SEGLEN < 2) segLoc = 0; // WLEDMM just to be sure unsigned pixColor = (2*fftResult[SEGENV.aux0%16]*240)/max(1, SEGLEN-1); // WLEDMM avoid uint8 overflow, and preserve pixel parameters for redraw unsigned pixIntensity = min((unsigned)(2.0f*fftResult[SEGENV.aux0%16]), 255U); @@ -7229,13 +7231,14 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline. return FRAMETIME_FIXED; } // mode_blurz() -static const char _data_FX_MODE_BLURZ[] PROGMEM = "Blurz ☾@Fade rate,Blur;!,Color mix;!;1f;sx=48,ix=127,m12=0,si=0"; // Pixels, Beatsin +static const char _data_FX_MODE_BLURZ[] PROGMEM = "Blurz ☾@Fade rate,Blur;!,Color mix;!;01f;sx=48,ix=127,m12=0,si=0"; // Pixels, Beatsin #endif ///////////////////////// // ** DJLight // ///////////////////////// uint16_t mode_DJLight(void) { // Written by Stefan Petrick, Adapted by Will Tatam. + // No need to prevent from executing on single led strips, only mid will be set (mid = 0) const int mid = SEGLEN / 2; um_data_t *um_data; @@ -7291,13 +7294,14 @@ uint16_t mode_DJLight(void) { // Written by Stefan Petrick, Ad if (SEGENV.check1) fadeVal = constrain(fadeVal, 0, 176); // "candy factory" mode - avoid complete fade-out SEGMENT.setPixelColor(mid, color.fadeToBlackBy(fadeVal)); + // if SEGLEN equals 1 these loops won't execute for (int i = SEGLEN - 1; i > mid; i--) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i-1)); // move to the left for (int i = 0; i < mid; i++) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i+1)); // move to the right } return FRAMETIME; } // mode_DJLight() -static const char _data_FX_MODE_DJLIGHT[] PROGMEM = "DJ Light@Speed,,,,,Candy Factory;;;1f;m12=2,si=0"; // Arc, Beatsin +static const char _data_FX_MODE_DJLIGHT[] PROGMEM = "DJ Light@Speed,,,,,Candy Factory;;;01f;m12=2,si=0"; // Arc, Beatsin //////////////////// @@ -7351,6 +7355,7 @@ static const char _data_FX_MODE_FREQMAP[] PROGMEM = "Freqmap@Fade rate,Starting // ** Freqmatrix // /////////////////////// uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Pleschung. + // No need to prevent from executing on single led strips, we simply change pixel 0 each time and avoid the shift um_data_t *um_data; if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) { // add support for no audio @@ -7393,12 +7398,13 @@ uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Plesch // shift the pixels one pixel up SEGMENT.setPixelColor(0, color); + // if SEGLEN equals 1 this loop won't execute for (int i = SEGLEN - 1; i > 0; i--) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i-1)); //move to the left } return FRAMETIME; } // mode_freqmatrix() -static const char _data_FX_MODE_FREQMATRIX[] PROGMEM = "Freqmatrix@Speed,Sound effect,Low bin,High bin,Sensitivity;;;1f;c1=18,c2=48,c3=6,m12=3,si=0"; // Corner, Beatsin; notes range C3 to C7 +static const char _data_FX_MODE_FREQMATRIX[] PROGMEM = "Freqmatrix@Speed,Sound effect,Low bin,High bin,Sensitivity;;;01f;c1=18,c2=48,c3=6,m12=3,si=0"; // Corner, Beatsin; notes range C3 to C7 ////////////////////// @@ -7455,6 +7461,7 @@ static const char _data_FX_MODE_FREQPIXELS[] PROGMEM = "Freqpixels@Fade rate,Sta // As a compromise between speed and accuracy we are currently sampling with 10240Hz, from which we can then determine with a 512bin FFT our max frequency is 5120Hz. // Depending on the music stream you have you might find it useful to change the frequency mapping. uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschung. With some enhancements by @softhack007 + // As before, this effect can also work on single pixels, we just lose the shifting effect um_data_t *um_data; if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) { // add support for no audio @@ -7510,13 +7517,14 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun SEGMENT.setPixelColor(SEGLEN/2, color); // shift the pixels one pixel outwards + // if SEGLEN equals 1 these loops won't execute for (int i = SEGLEN - 1; i > SEGLEN/2; i--) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i-1)); //move to the left for (int i = 0; i < SEGLEN/2; i++) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i+1)); // move to the right } return FRAMETIME; } // mode_freqwave() -static const char _data_FX_MODE_FREQWAVE[] PROGMEM = "Freqwave@Speed,Sound effect,Low bin,High bin,Pre-amp,Musical Scale ☾;;;1f;c1=18,c2=48,m12=2,si=0"; // notes range C3 to C7, Arc, Beatsin +static const char _data_FX_MODE_FREQWAVE[] PROGMEM = "Freqwave@Speed,Sound effect,Low bin,High bin,Pre-amp,Musical Scale ☾;;;01f;c1=18,c2=48,m12=2,si=0"; // notes range C3 to C7, Arc, Beatsin /////////////////////// @@ -7599,13 +7607,14 @@ uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuli uint8_t numBins = map(SEGMENT.intensity,0,255,0,16); // Map slider to fftResult bins. for (int i=0; i Date: Tue, 7 May 2024 13:35:16 +0200 Subject: [PATCH 42/42] pico board: always protect pin 16+17 runtime detection of PICO boards, to ensure that SPIRAM pins are protected even when users install a non-pico firmware build. --- wled00/wled.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 4b2d6609..11ebcf72 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -611,10 +611,12 @@ void WLED::setup() DEBUG_PRINTLN(F("PSRAM not used.")); #endif #endif -#if defined(ARDUINO_ESP32_PICO) -// special handling for PICO-D4: gpio16+17 are in use for onboard SPI FLASH (not PSRAM) -managed_pin_type pins[] = { {16, true}, {17, true} }; -pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM); +#if defined(ARDUINO_ARCH_ESP32) + if (strncmp("ESP32-PICO", ESP.getChipModel(), 10) == 0) { // WLEDMM detect pico board at runtime + // special handling for PICO-D4: gpio16+17 are in use for onboard SPI FLASH (not PSRAM) + managed_pin_type pins[] = { {16, true}, {17, true} }; + pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM); + } #endif //DEBUG_PRINT(F("LEDs inited. heap usage ~"));