From 96491255f1adde9d670aa109a74154257842932f Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sat, 8 Nov 2025 13:33:18 +0000 Subject: [PATCH 01/23] Disable other envs to save CI build time --- platformio.ini | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/platformio.ini b/platformio.ini index 90a6f2a0d3..76af745bfb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,21 +10,22 @@ # ------------------------------------------------------------------------------ # CI/release binaries -default_envs = nodemcuv2 - esp8266_2m - esp01_1m_full - nodemcuv2_160 - esp8266_2m_160 - esp01_1m_full_160 - nodemcuv2_compat - esp8266_2m_compat - esp01_1m_full_compat - esp32dev - esp32dev_debug - esp32_eth - esp32_wrover +default_envs = + ;nodemcuv2 + ;esp8266_2m + ;esp01_1m_full + ;nodemcuv2_160 + ;esp8266_2m_160 + ;esp01_1m_full_160 + ;nodemcuv2_compat + ;esp8266_2m_compat + ;esp01_1m_full_compat + ;esp32dev + ;esp32dev_debug + ;esp32_eth + ;esp32_wrover ; lolin_s2_mini ;; TODO: disabled NeoEsp32RmtMethodIsr - esp32c3dev + ;esp32c3dev ; esp32s3dev_16MB_opi ;; TODO: disabled NeoEsp32RmtMethodIsr ; esp32s3dev_8MB_opi ;; TODO: disabled NeoEsp32RmtMethodIsr ;esp32s3_4M_qspi ;; TODO: disabled NeoEsp32RmtMethodIsr From 0f1055826b92add05cef8ecf389c584bc6bacfcb Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:51:07 +0200 Subject: [PATCH 02/23] ESP32-C6 buildenv due to Arduino 3.0.1, a few updated libraries are required: * Tasmota Platform - official platfomio lacks arduino support for C6 * FastLED (latest + C6 build patches) * AsyncTCP (latest + C6 build patches) * AsyncWebServer (latest + C6 build patches) * NeoPixelBus (lastest) --- platformio.ini | 72 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 76af745bfb..8b3e37fad7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -161,10 +161,12 @@ upload_speed = 115200 # ------------------------------------------------------------------------------ lib_compat_mode = strict lib_deps = - fastled/FastLED @ 3.10.1 + ; fastled/FastLED @ 3.10.1 + https://github.com/netmindz/FastLED.git#ESP32-C6 ;; patched version needed for -C6 ; IRremoteESP8266 @ 2.8.2 makuna/NeoPixelBus @ 2.8.3 - https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.2 + ; https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.2 + https://github.com/softhack007/ESPAsyncWebServer.git#ESP32-C6 ;; patched version needed for -C6 marvinroger/AsyncMqttClient @ 0.9.0 # for I2C interface ;Wire @@ -342,6 +344,72 @@ lib_deps = board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs board_build.flash_mode = qio + +[esp32c6] +;; generic definitions for all ESP32-C6 boards +platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.06.10/platform-espressif32.zip +platform_packages = +;;platform_packages = +;; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1 +;; framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip + +board = esp32-c6-devkitm-1 +build_flags = -g + -DARDUINO_ARCH_ESP32 + -DARDUINO_ARCH_ESP32C6 + -DCONFIG_IDF_TARGET_ESP32C6=1 + -D CONFIG_ASYNC_TCP_USE_WDT=0 + -DCO + -DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3 + ;; 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_CDC_ON_BOOT +lib_deps = + ;;https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 + https://github.com/softhack007/AsyncTCP.git#ESP32-C6 ;; patched version needed for -C6 + makuna/NeoPixelBus @ 2.8.0 ;; latest version neeeded for -C6 + ${env.lib_deps} + + +[env:esp32c6dev_8MB] +;; ESP32-C6 "devkit C" with 8MB flash +extends = esp32c6 +platform = ${esp32c6.platform} +platform_packages = ${esp32c6.platform_packages} +framework = arduino +board = esp32-c6-devkitc-1 + +build_unflags = ${common.build_unflags} +build_flags = ${common.build_flags} ${esp32c6.build_flags} -D WLED_RELEASE_NAME=ESP32-C6_8MB + -Wno-volatile -Wno-deprecated-declarations ;; silence compiler warnings + -Wno-cpp ;; silence '#pragma warning' messages + -D WLED_WATCHDOG_TIMEOUT=0 + ;; -DLOLIN_WIFI_FIX ; might be needed on "-C6 mini" + ;;-DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB + -DARDUINO_USB_CDC_ON_BOOT=0 ;; for serial-to-USB chip + -D WLED_DISABLE_INFRARED ;; library not not compatible with -C6 + -D WLED_DISABLE_ESPNOW ;; not sure if this will work + -D WLED_DISABLE_ALEXA ;; compile errors + -D WLED_DISABLE_WEBSOCKETS ;; not sure if this will work (hacks needed in asyncWebserver) +upload_speed = 460800 +lib_deps = ${esp32c6.lib_deps} +lib_ignore = + IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation + +board_build.partitions = ${esp32.large_partitions} +board_build.f_flash = 80000000L +board_build.flash_mode = qio +board_build.arduino.memory_type = qio_qspi +monitor_filters = esp32_exception_decoder + +[env:esp32c6dev_4MB] +;; ESP32-C6 "devkit M" with 4MB flash +extends = env:esp32c6dev_8MB +board = esp32-c6-devkitm-1 +board_build.partitions = ${esp32.default_partitions} +build_unflags = ${env:esp32c6dev_8MB.build_unflags} -D WLED_RELEASE_NAME=ESP32-C6_8MB +build_flags = ${env:esp32c6dev_8MB.build_flags} -D WLED_RELEASE_NAME=ESP32-C6_4MB + + [esp32s3] ;; generic definitions for all ESP32-S3 boards platform = ${esp32_idf_V5.platform} From cf195af7c8a6bf41f1c617d5936b3c626e1c0094 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sat, 8 Nov 2025 13:54:39 +0000 Subject: [PATCH 03/23] build only esp32c6dev_4MB --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index 8b3e37fad7..82667b0087 100644 --- a/platformio.ini +++ b/platformio.ini @@ -29,6 +29,7 @@ default_envs = ; esp32s3dev_16MB_opi ;; TODO: disabled NeoEsp32RmtMethodIsr ; esp32s3dev_8MB_opi ;; TODO: disabled NeoEsp32RmtMethodIsr ;esp32s3_4M_qspi ;; TODO: disabled NeoEsp32RmtMethodIsr + esp32c6dev_4MB ; usermods src_dir = ./wled00 From db65e30ad5b711313b2780bf3978c87a1c318ba7 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sat, 8 Nov 2025 14:02:47 +0000 Subject: [PATCH 04/23] use esp32_idf_V5.platform --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 82667b0087..cf6cd38f0a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -348,7 +348,7 @@ board_build.flash_mode = qio [esp32c6] ;; generic definitions for all ESP32-C6 boards -platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.06.10/platform-espressif32.zip +platform = ${esp32_idf_V5.platform} platform_packages = ;;platform_packages = ;; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1 From fa5aa586ecbc3951b1b3461d20d1d943e1cb378e Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 13 Jun 2024 19:10:15 +0200 Subject: [PATCH 05/23] Update platformio.ini * more debug output * added my own fork of FastLED ( looks like more bugs to solve ....) --- platformio.ini | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index cf6cd38f0a..4fb68dd529 100644 --- a/platformio.ini +++ b/platformio.ini @@ -163,7 +163,7 @@ upload_speed = 115200 lib_compat_mode = strict lib_deps = ; fastled/FastLED @ 3.10.1 - https://github.com/netmindz/FastLED.git#ESP32-C6 ;; patched version needed for -C6 + https://github.com/softhack007/FastLED.git#ESP32-C6 ;; patched version needed for -C6 ; IRremoteESP8266 @ 2.8.2 makuna/NeoPixelBus @ 2.8.3 ; https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.2 @@ -380,9 +380,13 @@ framework = arduino board = esp32-c6-devkitc-1 build_unflags = ${common.build_unflags} + -D CORE_DEBUG_LEVEL=0 + -D NDEBUG build_flags = ${common.build_flags} ${esp32c6.build_flags} -D WLED_RELEASE_NAME=ESP32-C6_8MB -Wno-volatile -Wno-deprecated-declarations ;; silence compiler warnings -Wno-cpp ;; silence '#pragma warning' messages + -D DEBUG -g3 -ggdb + -D CORE_DEBUG_LEVEL=4 -D WLED_WATCHDOG_TIMEOUT=0 ;; -DLOLIN_WIFI_FIX ; might be needed on "-C6 mini" ;;-DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB From 1bc63cac6105180fa447d164c56f7e5d1cf8b52c Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 01:37:57 +0100 Subject: [PATCH 06/23] use the same lib_deps as the "main V5" branch --- platformio.ini | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index d88801caca..00d6b33fc7 100644 --- a/platformio.ini +++ b/platformio.ini @@ -376,7 +376,7 @@ board_build.flash_mode = qio [esp32c6] ;; generic definitions for all ESP32-C6 boards platform = ${esp32_idf_V5.platform} -platform_packages = +platform_packages = ${esp32_idf_V5.platform_packages} ;;platform_packages = ;; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1 ;; framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip @@ -391,11 +391,12 @@ build_flags = -g -DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3 ;; 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_CDC_ON_BOOT + ${esp32_idf_V5.build_flags} lib_deps = ;;https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 - https://github.com/softhack007/AsyncTCP.git#ESP32-C6 ;; patched version needed for -C6 - makuna/NeoPixelBus @ 2.8.0 ;; latest version neeeded for -C6 - ${env.lib_deps} + ; https://github.com/softhack007/AsyncTCP.git#ESP32-C6 ;; patched version needed for -C6 ;; softhack007 use default V5 libraries + ; makuna/NeoPixelBus @ 2.8.0 ;; latest version neeeded for -C6 ;; softhack007 use default V5 libraries + ${esp32_idf_V5.lib_deps} [env:esp32c6dev_8MB] From 6961059220365a763ffb8631f2017fe3acdee55a Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 01:58:12 +0100 Subject: [PATCH 07/23] minor changes for consistency with other build envs --- platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 00d6b33fc7..16b1f2dd9c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -381,14 +381,14 @@ platform_packages = ${esp32_idf_V5.platform_packages} ;; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1 ;; framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip -board = esp32-c6-devkitm-1 +;; board = esp32-c6-devkitm-1 ;; board must be defined in the lower-level [env:*] buildenvs for C6-based boards build_flags = -g -DARDUINO_ARCH_ESP32 -DARDUINO_ARCH_ESP32C6 -DCONFIG_IDF_TARGET_ESP32C6=1 -D CONFIG_ASYNC_TCP_USE_WDT=0 -DCO - -DARDUINO_USB_MODE=1 ;; this flag is mandatory for ESP32-C3 + -DARDUINO_USB_MODE=1 ;; this flag is - most likely - mandatory for ESP32-C6 ;; 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_CDC_ON_BOOT ${esp32_idf_V5.build_flags} From b2d659120e5ef3855c5acbe62d90a0e25cab8f39 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 15:56:57 +0100 Subject: [PATCH 08/23] disable QuickEspNow - seems incompatible with -C6 also disabled some core debug flags --- platformio.ini | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index f0b81ef6a9..747c5c7a3a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -408,13 +408,13 @@ framework = arduino board = esp32-c6-devkitc-1 build_unflags = ${common.build_unflags} - -D CORE_DEBUG_LEVEL=0 - -D NDEBUG + ;;-D CORE_DEBUG_LEVEL=0 + ;;-D NDEBUG build_flags = ${common.build_flags} ${esp32c6.build_flags} -D WLED_RELEASE_NAME=ESP32-C6_8MB -Wno-volatile -Wno-deprecated-declarations ;; silence compiler warnings -Wno-cpp ;; silence '#pragma warning' messages - -D DEBUG -g3 -ggdb - -D CORE_DEBUG_LEVEL=4 + ;;-D DEBUG -g3 -ggdb + ;;-D CORE_DEBUG_LEVEL=4 -D WLED_WATCHDOG_TIMEOUT=0 ;; -DLOLIN_WIFI_FIX ; might be needed on "-C6 mini" ;;-DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB @@ -423,10 +423,12 @@ build_flags = ${common.build_flags} ${esp32c6.build_flags} -D WLED_RELEASE_NAME= -D WLED_DISABLE_ESPNOW ;; not sure if this will work -D WLED_DISABLE_ALEXA ;; compile errors -D WLED_DISABLE_WEBSOCKETS ;; not sure if this will work (hacks needed in asyncWebserver) + -D WLED_DISABLE_ESPNOW ;; ToDO: temporarily disabled, until we find a solution for esp-now build errors with -C6 upload_speed = 460800 lib_deps = ${esp32c6.lib_deps} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation + QuickEspNow ; ToDO: disabled until we find a compatible version board_build.partitions = ${esp32.large_partitions} board_build.f_flash = 80000000L From 62ca377060541dcc6539ce44cd6cfbe494c1a675 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 16:29:51 +0100 Subject: [PATCH 09/23] remove special FASTLED_NO_FASTLED hack this was a temporary hack needed one year ago; FastLED should be compatible with -C6 now. --- platformio.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 747c5c7a3a..a037f30ade 100644 --- a/platformio.ini +++ b/platformio.ini @@ -163,9 +163,9 @@ upload_speed = 115200 # ------------------------------------------------------------------------------ lib_compat_mode = strict lib_deps = - ; fastled/FastLED @ 3.10.1 - https://github.com/softhack007/FastLED.git#ESP32-C6 ;; patched version needed for -C6 -; IRremoteESP8266 @ 2.8.2 + fastled/FastLED @ 3.10.1 + ;; https://github.com/softhack007/FastLED.git#ESP32-C6 ;; patched version for -C6 + ; IRremoteESP8266 @ 2.8.2 https://github.com/netmindz/NeoPixelBus.git#2f05279a4a9f56875fb85482e6ec4e17078accc3 ;; CORE3 with log fix https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.2 marvinroger/AsyncMqttClient @ 0.9.0 From 70235450e8e175e025dbb9abaf984161961c64bd Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 17:03:44 +0100 Subject: [PATCH 10/23] treat C6 similar to C3 trying to reduce compile errors in bus_wrapper.h ... plus some preparation for P4 support --- wled00/bus_wrapper.h | 24 ++++++++++++------------ wled00/const.h | 7 ++++--- wled00/wled.h | 10 +++++----- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index 0bc3cc4ec5..c1dbcef720 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -245,7 +245,7 @@ typedef NeoEsp32I2s0Apa106Method X1Apa106Method; typedef NeoEsp32I2s0Ws2805Method X1Ws2805Method; typedef NeoEsp32I2s0Tm1914Method X1Tm1914Method; -#elif !defined(CONFIG_IDF_TARGET_ESP32C3) +#elif !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) // regular ESP32 will use I2S1 typedef NeoEsp32I2s1Ws2812xMethod X1Ws2812xMethod; typedef NeoEsp32I2s1Sk6812Method X1Sk6812Method; @@ -461,7 +461,7 @@ class PolyBus { case I_32_RN_TM1914_3: beginTM1914(busPtr); break; case I_32_RN_SM16825_5: (static_cast(busPtr))->Begin(); break; // I2S1 bus or parellel buses - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3: if (_useParallelI2S) (static_cast(busPtr))->Begin(); else (static_cast(busPtr))->Begin(); break; case I_32_I2_NEO_4: if (_useParallelI2S) (static_cast(busPtr))->Begin(); else (static_cast(busPtr))->Begin(); break; case I_32_I2_400_3: if (_useParallelI2S) (static_cast(busPtr))->Begin(); else (static_cast(busPtr))->Begin(); break; @@ -493,7 +493,7 @@ class PolyBus { static void* create(uint8_t busType, uint8_t* pins, uint16_t len, uint8_t channel) { // NOTE: "channel" is only used on ESP32 (and its variants) for RMT channel allocation - #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) + #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) if (_useParallelI2S && (channel >= 8)) { // Parallel I2S channels are to be used first, so subtract 8 to get the RMT channel number channel -= 8; @@ -573,7 +573,7 @@ class PolyBus { case I_32_RN_TM1914_3: busPtr = new B_32_RN_TM1914_3(len, pins[0], (NeoBusChannel)channel); break; case I_32_RN_SM16825_5: busPtr = new B_32_RN_SM16825_5(len, pins[0], (NeoBusChannel)channel); break; // I2S1 bus or paralell buses - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3: if (_useParallelI2S) busPtr = new B_32_IP_NEO_3(len, pins[0]); else busPtr = new B_32_I2_NEO_3(len, pins[0]); break; case I_32_I2_NEO_4: if (_useParallelI2S) busPtr = new B_32_IP_NEO_4(len, pins[0]); else busPtr = new B_32_I2_NEO_4(len, pins[0]); break; case I_32_I2_400_3: if (_useParallelI2S) busPtr = new B_32_IP_400_3(len, pins[0]); else busPtr = new B_32_I2_400_3(len, pins[0]); break; @@ -672,7 +672,7 @@ class PolyBus { case I_32_RN_TM1914_3: (static_cast(busPtr))->Show(consistent); break; case I_32_RN_SM16825_5: (static_cast(busPtr))->Show(consistent); break; // I2S1 bus or paralell buses - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3: if (_useParallelI2S) (static_cast(busPtr))->Show(consistent); else (static_cast(busPtr))->Show(consistent); break; case I_32_I2_NEO_4: if (_useParallelI2S) (static_cast(busPtr))->Show(consistent); else (static_cast(busPtr))->Show(consistent); break; case I_32_I2_400_3: if (_useParallelI2S) (static_cast(busPtr))->Show(consistent); else (static_cast(busPtr))->Show(consistent); break; @@ -768,7 +768,7 @@ class PolyBus { case I_32_RN_TM1914_3: return (static_cast(busPtr))->CanShow(); break; case I_32_RN_SM16825_5: return (static_cast(busPtr))->CanShow(); break; // I2S1 bus or paralell buses - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3: if (_useParallelI2S) return (static_cast(busPtr))->CanShow(); else return (static_cast(busPtr))->CanShow(); break; case I_32_I2_NEO_4: if (_useParallelI2S) return (static_cast(busPtr))->CanShow(); else return (static_cast(busPtr))->CanShow(); break; case I_32_I2_400_3: if (_useParallelI2S) return (static_cast(busPtr))->CanShow(); else return (static_cast(busPtr))->CanShow(); break; @@ -890,7 +890,7 @@ class PolyBus { case I_32_RN_TM1914_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col)); break; case I_32_RN_SM16825_5: (static_cast(busPtr))->SetPixelColor(pix, Rgbww80Color(col.R*257, col.G*257, col.B*257, cctWW*257, cctCW*257)); break; // I2S1 bus or paralell buses - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3: if (_useParallelI2S) (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col)); else (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col)); break; case I_32_I2_NEO_4: if (_useParallelI2S) (static_cast(busPtr))->SetPixelColor(pix, col); else (static_cast(busPtr))->SetPixelColor(pix, col); break; case I_32_I2_400_3: if (_useParallelI2S) (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col)); else (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col)); break; @@ -987,7 +987,7 @@ class PolyBus { case I_32_RN_TM1914_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; case I_32_RN_SM16825_5: { Rgbww80Color c = (static_cast(busPtr))->GetPixelColor(pix); col = RGBW32(c.R/257,c.G/257,c.B/257,max(c.WW,c.CW)/257); } break; // will not return original W // I2S1 bus or paralell buses - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3: col = (_useParallelI2S) ? (static_cast(busPtr))->GetPixelColor(pix) : (static_cast(busPtr))->GetPixelColor(pix); break; case I_32_I2_NEO_4: col = (_useParallelI2S) ? (static_cast(busPtr))->GetPixelColor(pix) : (static_cast(busPtr))->GetPixelColor(pix); break; case I_32_I2_400_3: col = (_useParallelI2S) ? (static_cast(busPtr))->GetPixelColor(pix) : (static_cast(busPtr))->GetPixelColor(pix); break; @@ -1102,7 +1102,7 @@ class PolyBus { case I_32_RN_TM1914_3: delete (static_cast(busPtr)); break; case I_32_RN_SM16825_5: delete (static_cast(busPtr)); break; // I2S1 bus or paralell buses - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3: if (_useParallelI2S) delete (static_cast(busPtr)); else delete (static_cast(busPtr)); break; case I_32_I2_NEO_4: if (_useParallelI2S) delete (static_cast(busPtr)); else delete (static_cast(busPtr)); break; case I_32_I2_400_3: if (_useParallelI2S) delete (static_cast(busPtr)); else delete (static_cast(busPtr)); break; @@ -1199,7 +1199,7 @@ class PolyBus { case I_32_RN_TM1914_3: size = (static_cast(busPtr))->PixelsSize()*2; break; case I_32_RN_SM16825_5: size = (static_cast(busPtr))->PixelsSize()*2; break; // I2S1 bus or paralell buses (front + DMA; DMA = front * cadence, aligned to 4 bytes) - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3: size = (_useParallelI2S) ? (static_cast(busPtr))->PixelsSize()*4 : (static_cast(busPtr))->PixelsSize()*4; break; case I_32_I2_NEO_4: size = (_useParallelI2S) ? (static_cast(busPtr))->PixelsSize()*4 : (static_cast(busPtr))->PixelsSize()*4; break; case I_32_I2_400_3: size = (_useParallelI2S) ? (static_cast(busPtr))->PixelsSize()*4 : (static_cast(busPtr))->PixelsSize()*4; break; @@ -1278,7 +1278,7 @@ class PolyBus { case I_32_RN_2805_5 : size = (size + 2*count)*2; break; // 5 channels case I_32_RN_SM16825_5: size = (size + 2*count)*2*2; break; // 16bit, 5 channels // I2S1 bus or paralell I2S1 buses (1x front, does not include DMA buffer which is front*cadence, a bit(?) more for LCD) - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) case I_32_I2_NEO_3 : // fallthrough case I_32_I2_400_3 : // fallthrough case I_32_I2_TM2_3 : // fallthrough @@ -1365,7 +1365,7 @@ class PolyBus { if (num > 4) return I_NONE; if (num > 3) offset = 1; // only one I2S0 (use last to allow Audioreactive) } - #elif defined(CONFIG_IDF_TARGET_ESP32C3) + #elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32P4) // On ESP32-C3 only the first 2 RMT channels are usable for transmitting if (num > 1) return I_NONE; //if (num > 1) offset = 1; // I2S not supported yet (only 1 I2S) diff --git a/wled00/const.h b/wled00/const.h index ac48838435..f7ac69b613 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -62,7 +62,8 @@ constexpr size_t FIXED_PALETTE_COUNT = DYNAMIC_PALETTE_COUNT + FASTLED_PALETTE_C #include "driver/ledc.h" // needed for analog/LEDC channel counts #endif #define WLED_MAX_ANALOG_CHANNELS (LEDC_CHANNEL_MAX*LEDC_SPEED_MODE_MAX) - #if defined(CONFIG_IDF_TARGET_ESP32C3) // 2 RMT, 6 LEDC, only has 1 I2S but NPB does not support it ATM + #if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) + // 2 RMT, 6 LEDC, only has 1 I2S but NPB does not support it ATM #define WLED_MAX_DIGITAL_CHANNELS 2 //#define WLED_MAX_ANALOG_CHANNELS 6 #define WLED_MIN_VIRTUAL_BUSSES 4 // no longer used for bus creation but used to distinguish S2/S3 in UI @@ -472,7 +473,7 @@ static_assert(WLED_MAX_BUSSES <= 32, "WLED_MAX_BUSSES exceeds hard limit"); #define MAX_LEDS 1536 //can't rely on memory limit to limit this to 1536 LEDs #elif defined(CONFIG_IDF_TARGET_ESP32S2) #define MAX_LEDS 2048 //due to memory constraints S2 - #elif defined(CONFIG_IDF_TARGET_ESP32C3) + #elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) #define MAX_LEDS 4096 #else #define MAX_LEDS 16384 @@ -485,7 +486,7 @@ static_assert(WLED_MAX_BUSSES <= 32, "WLED_MAX_BUSSES exceeds hard limit"); #else #if defined(ARDUINO_ARCH_ESP32S2) #define MAX_LED_MEMORY 16384 - #elif defined(ARDUINO_ARCH_ESP32C3) + #elif defined(ARDUINO_ARCH_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) #define MAX_LED_MEMORY 32768 #else #define MAX_LED_MEMORY 65536 diff --git a/wled00/wled.h b/wled00/wled.h index 79c75c10a4..9046a36557 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -154,7 +154,7 @@ #endif #ifdef WLED_ENABLE_DMX - #if defined(ESP8266) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2) + #if defined(ESP8266) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32S2) #include "src/dependencies/dmx/ESPDMX.h" #else //ESP32 #include "src/dependencies/dmx/SparkFunDMX.h" @@ -327,7 +327,7 @@ WLED_GLOBAL bool rlyOpenDrain _INIT(RLYODRAIN); #define IRTYPE 0 #endif -#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2) || (defined(RX) && defined(TX)) +#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32P4) || defined(CONFIG_IDF_TARGET_ESP32S2) || (defined(RX) && defined(TX)) // use RX/TX as set by the framework - these boards do _not_ have RX=3 and TX=1 constexpr uint8_t hardwareRX = RX; constexpr uint8_t hardwareTX = TX; @@ -388,7 +388,7 @@ WLED_GLOBAL bool noWifiSleep _INIT(false); WLED_GLOBAL bool force802_3g _INIT(false); #endif // WLED_SAVE_RAM #ifdef ARDUINO_ARCH_ESP32 - #if defined(LOLIN_WIFI_FIX) && (defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)) + #if defined(LOLIN_WIFI_FIX) && (defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)) WLED_GLOBAL uint8_t txPower _INIT(WIFI_POWER_8_5dBm); #else WLED_GLOBAL uint8_t txPower _INIT(WIFI_POWER_19_5dBm); @@ -415,7 +415,7 @@ WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load WLED_GLOBAL bool useGlobalLedBuffer _INIT(false); // double buffering disabled on ESP8266 #else WLED_GLOBAL bool useGlobalLedBuffer _INIT(true); // double buffering enabled on ESP32 - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) WLED_GLOBAL bool useParallelI2S _INIT(false); // parallel I2S for ESP32 #endif #endif @@ -469,7 +469,7 @@ WLED_GLOBAL bool arlsDisableGammaCorrection _INIT(true); // activate if WLED_GLOBAL bool arlsForceMaxBri _INIT(false); // enable to force max brightness if source has very dark colors that would be black #ifdef WLED_ENABLE_DMX - #if defined(ESP8266) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2) + #if defined(ESP8266) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32S2) WLED_GLOBAL DMXESPSerial dmx; #else //ESP32 WLED_GLOBAL SparkFunDMX dmx; From 1de36ca0da883493d521eb908a4715328b5ac5e4 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 17:15:04 +0100 Subject: [PATCH 11/23] more "C6 is like C3" adjustments --- wled00/FX_fcn.cpp | 4 ++-- wled00/set.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index f2a474a486..47ef23cd40 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1161,7 +1161,7 @@ void WS2812FX::finalizeInit() { BusManager::removeAll(); unsigned digitalCount = 0; - #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) + #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) // determine if it is sensible to use parallel I2S outputs on ESP32 (i.e. more than 5 outputs = 1 I2S + 4 RMT) unsigned maxLedsOnBus = 0; unsigned busType = 0; @@ -1191,7 +1191,7 @@ void WS2812FX::finalizeInit() { unsigned memB = bus.memUsage(Bus::isDigital(bus.type) && !Bus::is2Pin(bus.type) ? digitalCount++ : 0); // does not include DMA/RMT buffer mem += memB; // estimate maximum I2S memory usage (only relevant for digital non-2pin busses) - #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(ESP8266) + #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) && !defined(ESP8266) #if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S3) const bool usesI2S = ((useParallelI2S && digitalCount <= 8) || (!useParallelI2S && digitalCount == 1)); #elif defined(CONFIG_IDF_TARGET_ESP32S2) diff --git a/wled00/set.cpp b/wled00/set.cpp index 087e9b39f2..b1831cf9e7 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -155,7 +155,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) Bus::setCCTBlend(cctBlending); Bus::setGlobalAWMode(request->arg(F("AW")).toInt()); strip.setTargetFps(request->arg(F("FR")).toInt()); - #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) + #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) useParallelI2S = request->hasArg(F("PR")); #endif From 2df4c58de89950d33d8fe15d11fd44d83081612b Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 17:22:16 +0100 Subject: [PATCH 12/23] disable touch button code on C6 similar to C3 --- wled00/button.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/button.cpp b/wled00/button.cpp index 8ab2363acb..651f12cf18 100644 --- a/wled00/button.cpp +++ b/wled00/button.cpp @@ -109,7 +109,7 @@ bool isButtonPressed(uint8_t b) break; case BTN_TYPE_TOUCH: case BTN_TYPE_TOUCH_SWITCH: - #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) + #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) #ifdef SOC_TOUCH_VERSION_2 //ESP32 S2 and S3 provide a function to check touch state (state is updated in interrupt) if (touchInterruptGetLastStatus(pin)) return true; #else From 3f441f0605684dd4b226f46d704ab7fda5ea1083 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 17:31:41 +0100 Subject: [PATCH 13/23] guess what ... more "C6 is like C3" ifdefs needed --- wled00/cfg.cpp | 4 ++-- wled00/json.cpp | 2 +- wled00/util.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 47ba152c96..2bc3fe4503 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -165,7 +165,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { uint8_t cctBlending = hw_led[F("cb")] | Bus::getCCTBlend(); Bus::setCCTBlend(cctBlending); strip.setTargetFps(hw_led["fps"]); //NOP if 0, default 42 FPS - #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) + #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) CJSON(useParallelI2S, hw_led[F("prl")]); #endif @@ -933,7 +933,7 @@ void serializeConfig(JsonObject root) { hw_led[F("cb")] = Bus::getCCTBlend(); hw_led["fps"] = strip.getTargetFps(); hw_led[F("rgbwm")] = Bus::getGlobalAWMode(); // global auto white mode override - #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) + #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) hw_led[F("prl")] = BusManager::hasParallelOutput(); #endif diff --git a/wled00/json.cpp b/wled00/json.cpp index 35fde73c69..22ebcf7b03 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -811,7 +811,7 @@ void serializeInfo(JsonObject root) wifi_info[F("txPower")] = (int) WiFi.getTxPower(); wifi_info[F("sleep")] = (bool) WiFi.getSleep(); #endif - #if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) + #if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32P4) root[F("arch")] = "esp32"; #else root[F("arch")] = ESP.getChipModel(); diff --git a/wled00/util.cpp b/wled00/util.cpp index 391e2873fb..7165006dda 100644 --- a/wled00/util.cpp +++ b/wled00/util.cpp @@ -633,7 +633,7 @@ int32_t hw_random(int32_t lowerlimit, int32_t upperlimit) { // PSRAM compile time checks to provide info for misconfigured env #if defined(BOARD_HAS_PSRAM) - #if defined(IDF_TARGET_ESP32C3) || defined(ESP8266) + #if defined(IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32C61) || defined(ESP8266) #error "ESP32-C3 and ESP8266 with PSRAM is not supported, please remove BOARD_HAS_PSRAM definition" #else #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) // PSRAM fix only needed for classic esp32 @@ -694,7 +694,7 @@ static void *validateFreeHeap(void *buffer) { void *d_malloc(size_t size) { void *buffer; - #if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) + #if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32P4) // the newer ESP32 variants have byte-accessible fast RTC memory that can be used as heap, access speed is on-par with DRAM // the system does prefer normal DRAM until full, since free RTC memory is ~7.5k only, its below the minimum heap threshold and needs to be allocated explicitly // use RTC RAM for small allocations to improve fragmentation or if DRAM is running low From c73935dd369ed0e25af9ecc041e6000d29bc346a Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 17:36:33 +0100 Subject: [PATCH 14/23] small fix missing || --- wled00/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/util.cpp b/wled00/util.cpp index 7165006dda..8b592050b7 100644 --- a/wled00/util.cpp +++ b/wled00/util.cpp @@ -694,7 +694,7 @@ static void *validateFreeHeap(void *buffer) { void *d_malloc(size_t size) { void *buffer; - #if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32P4) + #if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32P4) // the newer ESP32 variants have byte-accessible fast RTC memory that can be used as heap, access speed is on-par with DRAM // the system does prefer normal DRAM until full, since free RTC memory is ~7.5k only, its below the minimum heap threshold and needs to be allocated explicitly // use RTC RAM for small allocations to improve fragmentation or if DRAM is running low From c096c5bb8f9e84f3558b47d6894bef0bc60091ef Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 17:53:04 +0100 Subject: [PATCH 15/23] fix for old-style WLED_RELEASE_NAME --- platformio.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index a037f30ade..4e44b1e814 100644 --- a/platformio.ini +++ b/platformio.ini @@ -410,7 +410,7 @@ board = esp32-c6-devkitc-1 build_unflags = ${common.build_unflags} ;;-D CORE_DEBUG_LEVEL=0 ;;-D NDEBUG -build_flags = ${common.build_flags} ${esp32c6.build_flags} -D WLED_RELEASE_NAME=ESP32-C6_8MB +build_flags = ${common.build_flags} ${esp32c6.build_flags} -D WLED_RELEASE_NAME=\"ESP32-C6_8MB\" -Wno-volatile -Wno-deprecated-declarations ;; silence compiler warnings -Wno-cpp ;; silence '#pragma warning' messages ;;-D DEBUG -g3 -ggdb @@ -441,8 +441,8 @@ monitor_filters = esp32_exception_decoder extends = env:esp32c6dev_8MB board = esp32-c6-devkitm-1 board_build.partitions = ${esp32.default_partitions} -build_unflags = ${env:esp32c6dev_8MB.build_unflags} -D WLED_RELEASE_NAME=ESP32-C6_8MB -build_flags = ${env:esp32c6dev_8MB.build_flags} -D WLED_RELEASE_NAME=ESP32-C6_4MB +build_unflags = ${env:esp32c6dev_8MB.build_unflags} -D WLED_RELEASE_NAME=\"ESP32-C6_8MB\" +build_flags = ${env:esp32c6dev_8MB.build_flags} -D WLED_RELEASE_NAME=\"ESP32-C6_4MB\" [esp32s3] From 9f12301128850455320716f3abd980097fb63bab Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 1 Dec 2025 23:59:50 +0100 Subject: [PATCH 16/23] esp32c6 inherits build_unflags and lib_ignore from V5 buildenv --- platformio.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 1b3aca518b..70e88defe5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -389,6 +389,7 @@ platform_packages = ${esp32_idf_V5.platform_packages} ;; framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip ;; board = esp32-c6-devkitm-1 ;; board must be defined in the lower-level [env:*] buildenvs for C6-based boards +build_unflags = ${esp32_idf_V5.build_unflags} build_flags = -g -DARDUINO_ARCH_ESP32 -DARDUINO_ARCH_ESP32C6 @@ -404,6 +405,7 @@ lib_deps = ; https://github.com/softhack007/AsyncTCP.git#ESP32-C6 ;; patched version needed for -C6 ;; softhack007 use default V5 libraries ; makuna/NeoPixelBus @ 2.8.0 ;; latest version neeeded for -C6 ;; softhack007 use default V5 libraries ${esp32_idf_V5.lib_deps} +lib_ignore = ${esp32_idf_V5.lib_ignore} [env:esp32c6dev_8MB] @@ -414,7 +416,7 @@ platform_packages = ${esp32c6.platform_packages} framework = arduino board = esp32-c6-devkitc-1 -build_unflags = ${common.build_unflags} +build_unflags = ${esp32c6.build_unflags} ;;-D CORE_DEBUG_LEVEL=0 ;;-D NDEBUG build_flags = ${common.build_flags} ${esp32c6.build_flags} -D WLED_RELEASE_NAME=\"ESP32-C6_8MB\" @@ -433,7 +435,7 @@ build_flags = ${common.build_flags} ${esp32c6.build_flags} -D WLED_RELEASE_NAME= -D WLED_DISABLE_ESPNOW ;; ToDO: temporarily disabled, until we find a solution for esp-now build errors with -C6 upload_speed = 460800 lib_deps = ${esp32c6.lib_deps} -lib_ignore = +lib_ignore = ${esp32c6.lib_ignore} IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation QuickEspNow ; ToDO: disabled until we find a compatible version From f88fd073a3d7a13e8004b786f910911c7e43c831 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 2 Dec 2025 00:00:31 +0100 Subject: [PATCH 17/23] temporary workaround for #5145 --- pio-scripts/set_metadata.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pio-scripts/set_metadata.py b/pio-scripts/set_metadata.py index 7c8c223038..f7e7aa1a02 100644 --- a/pio-scripts/set_metadata.py +++ b/pio-scripts/set_metadata.py @@ -100,15 +100,16 @@ def add_wled_metadata_flags(env, node): if not has_def(cdefs, "WLED_REPO"): repo = get_github_repo() if repo: + print(f"repo = {repo}") cdefs.append(("WLED_REPO", f"\\\"{repo}\\\"")) cdefs.append(("WLED_VERSION", WLED_VERSION)) - # This transforms the node in to a Builder; it cannot be modified again - return env.Object( - node, - CPPDEFINES=cdefs - ) + # Return the node unmodified - middleware should not create new build targets + print(f"version = {WLED_VERSION}") + # Instead, modify the environment's CPPDEFINES before the file is compiled + env["CPPDEFINES"] = cdefs + return node env.AddBuildMiddleware( add_wled_metadata_flags, From d3e92f26c05eea238d503bd1fe3e6d067b82b602 Mon Sep 17 00:00:00 2001 From: Karan Vijayakumar Date: Thu, 27 Nov 2025 02:39:07 +0900 Subject: [PATCH 18/23] Fix ESP32-C6 runtime crash and improve compatibility - Fix IPAddress comparison with 0U causing null pointer dereference in initConnection() - Add bounds checking for selectedWiFi index before array access - Add ESP32-C6 conditional for touch sensor exclusion (C6 has no capacitive touch) - Add deferResponse() wrapper for C6's patched ESPAsyncWebServer - Add early return in esp32RMTInvertIdle() for C6 (no RMT support) - Add ESP32-C6 BitBang bus creation in bus_wrapper.h - Update platformio.ini with proper C6 build flags and dependencies - Use patched FastLED, AsyncTCP, and ESPAsyncWebServer forks for C6 support --- .vscode/extensions.json | 3 +-- wled00/bus_manager.cpp | 5 +++++ wled00/fcn_declare.h | 11 +++++++++++ wled00/json.cpp | 2 +- wled00/network.cpp | 4 ++-- wled00/set.cpp | 2 +- wled00/wled.h | 5 +++++ wled00/wled_server.cpp | 2 +- 8 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 080e70d08b..8057bc70a7 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,6 @@ { - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format "recommendations": [ + "pioarduino.pioarduino-ide", "platformio.platformio-ide" ], "unwantedRecommendations": [ diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 60925e1495..e2e28cebc0 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -1242,6 +1242,10 @@ void BusManager::removeAll() { // If enabled, RMT idle level is set to HIGH when off // to prevent leakage current when using an N-channel MOSFET to toggle LED power void BusManager::esp32RMTInvertIdle() { +#if defined(CONFIG_IDF_TARGET_ESP32C6) + // ESP32-C6 uses BitBang method, not RMT - nothing to do here + return; +#else bool idle_out; unsigned rmt = 0; unsigned u = 0; @@ -1272,6 +1276,7 @@ void BusManager::esp32RMTInvertIdle() { rmt_set_idle_level(ch, idle_out, lvl); u++; } +#endif } #endif diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index d950b16655..5bea2b5c36 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -553,6 +553,17 @@ void serveJsonError(AsyncWebServerRequest* request, uint16_t code, uint16_t erro void serveSettings(AsyncWebServerRequest* request, bool post = false); void serveSettingsJS(AsyncWebServerRequest* request); +// ESP32-C6 compatibility: deferResponse not available in patched ESPAsyncWebServer fork +// Use this inline function which falls back to sending a 503 error +inline void deferResponse(AsyncWebServerRequest* request) { +#if defined(CONFIG_IDF_TARGET_ESP32C6) + // deferResponse not available, send 503 Service Unavailable instead + request->send(503, F("text/plain"), F("Server busy, try again")); +#else + request->deferResponse(); +#endif +} + //ws.cpp void handleWs(); void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len); diff --git a/wled00/json.cpp b/wled00/json.cpp index 22ebcf7b03..76de82513e 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -1135,7 +1135,7 @@ void serveJson(AsyncWebServerRequest* request) } if (!requestJSONBufferLock(17)) { - request->deferResponse(); + deferResponse(request); return; } // releaseJSONBufferLock() will be called when "response" is destroyed (from AsyncWebServer) diff --git a/wled00/network.cpp b/wled00/network.cpp index 174df1c631..60a6162b5b 100644 --- a/wled00/network.cpp +++ b/wled00/network.cpp @@ -296,14 +296,14 @@ int findWiFi(bool doScan) { } else if (status >= 0) { // status contains number of found networks (including duplicate SSIDs with different BSSID) DEBUG_PRINTF_P(PSTR("WiFi: Found %d SSIDs. @ %lus\n"), status, millis()/1000); int rssi = -9999; - int selected = selectedWiFi; + int selected = (selectedWiFi < multiWiFi.size()) ? selectedWiFi : 0; // ensure valid starting index for (int o = 0; o < status; o++) { DEBUG_PRINTF_P(PSTR(" SSID: %s (BSSID: %s) RSSI: %ddB\n"), WiFi.SSID(o).c_str(), WiFi.BSSIDstr(o).c_str(), WiFi.RSSI(o)); for (unsigned n = 0; n < multiWiFi.size(); n++) if (!strcmp(WiFi.SSID(o).c_str(), multiWiFi[n].clientSSID)) { bool foundBSSID = memcmp(multiWiFi[n].bssid, WiFi.BSSID(o), 6) == 0; // find the WiFi with the strongest signal (but keep priority of entry if signal difference is not big) - if (foundBSSID || (n < selected && WiFi.RSSI(o) > rssi-10) || WiFi.RSSI(o) > rssi) { + if (foundBSSID || (n < (unsigned)selected && WiFi.RSSI(o) > rssi-10) || WiFi.RSSI(o) > rssi) { rssi = foundBSSID ? 0 : WiFi.RSSI(o); // RSSI is only ever negative selected = n; } diff --git a/wled00/set.cpp b/wled00/set.cpp index b1831cf9e7..bf02e6de3c 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -655,7 +655,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) if (subPage == SUBPAGE_UM) { if (!requestJSONBufferLock(5)) { - request->deferResponse(); + deferResponse(request); return; } diff --git a/wled00/wled.h b/wled00/wled.h index 9046a36557..eec373d3a9 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -921,7 +921,12 @@ WLED_GLOBAL bool ledStatusState _INIT(false); // the current LED state #endif // server library objects +#if defined(CONFIG_IDF_TARGET_ESP32C6) +// ESP32-C6 uses patched ESPAsyncWebServer fork with simpler constructor +WLED_GLOBAL AsyncWebServer server _INIT_N(((80))); +#else WLED_GLOBAL AsyncWebServer server _INIT_N(((80, {0, WLED_REQUEST_MAX_QUEUE, WLED_REQUEST_MIN_HEAP, WLED_REQUEST_HEAP_USAGE}))); +#endif #ifdef WLED_ENABLE_WEBSOCKETS WLED_GLOBAL AsyncWebSocket ws _INIT_N((("/ws"))); #endif diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index 7a455453cd..fbcebef9c5 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -393,7 +393,7 @@ void initServer() bool isConfig = false; if (!requestJSONBufferLock(14)) { - request->deferResponse(); + deferResponse(request); return; } From ec44fd167a74a42bfab767c1c42a952b00bb9727 Mon Sep 17 00:00:00 2001 From: Karan Vijayakumar Date: Thu, 27 Nov 2025 03:10:39 +0900 Subject: [PATCH 19/23] Add ESP32-C6 pin validation for strapping and USB-JTAG pins --- wled00/pin_manager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wled00/pin_manager.cpp b/wled00/pin_manager.cpp index 709263e1a3..729e845039 100644 --- a/wled00/pin_manager.cpp +++ b/wled00/pin_manager.cpp @@ -232,6 +232,13 @@ bool PinManager::isPinOk(byte gpio, bool output) if (gpio > 21 && gpio < 33) return false; // 22 to 32: not connected + SPI FLASH // JTAG: GPIO39-42 are usually used for inline debugging // GPIO46 is input only and pulled down + #elif defined(CONFIG_IDF_TARGET_ESP32C6) + // strapping pins: 8, 9, 15 + // GPIO 0-23 directly usable, 24-30 are for SPI flash + if (gpio > 23 && gpio < 31) return false; // 24-30 SPI FLASH + #if ARDUINO_USB_CDC_ON_BOOT == 1 || ARDUINO_USB_DFU_ON_BOOT == 1 + if (gpio == 12 || gpio == 13) return false; // 12-13 USB-JTAG + #endif #else if ((strncmp_P(PSTR("ESP32-U4WDH"), ESP.getChipModel(), 11) == 0) || // this is the correct identifier, but.... From c92abb8dfcfc957d868393b0c8d8fe2891ffde8e Mon Sep 17 00:00:00 2001 From: Karan Vijayakumar Date: Sat, 29 Nov 2025 21:09:08 +0900 Subject: [PATCH 20/23] Address PR comments: cleanup and safety improvements - Revert VSCode extension changes - Remove unused QuickDebug dependency - Revert GifDecoder hash to short form - Harden selectedWiFi index calculation in network.cpp --- wled00/network.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/network.cpp b/wled00/network.cpp index 60a6162b5b..4602faedcc 100644 --- a/wled00/network.cpp +++ b/wled00/network.cpp @@ -296,14 +296,14 @@ int findWiFi(bool doScan) { } else if (status >= 0) { // status contains number of found networks (including duplicate SSIDs with different BSSID) DEBUG_PRINTF_P(PSTR("WiFi: Found %d SSIDs. @ %lus\n"), status, millis()/1000); int rssi = -9999; - int selected = (selectedWiFi < multiWiFi.size()) ? selectedWiFi : 0; // ensure valid starting index + size_t selected = (static_cast(selectedWiFi) < multiWiFi.size()) ? static_cast(selectedWiFi) : 0; // ensure valid starting index for (int o = 0; o < status; o++) { DEBUG_PRINTF_P(PSTR(" SSID: %s (BSSID: %s) RSSI: %ddB\n"), WiFi.SSID(o).c_str(), WiFi.BSSIDstr(o).c_str(), WiFi.RSSI(o)); for (unsigned n = 0; n < multiWiFi.size(); n++) if (!strcmp(WiFi.SSID(o).c_str(), multiWiFi[n].clientSSID)) { bool foundBSSID = memcmp(multiWiFi[n].bssid, WiFi.BSSID(o), 6) == 0; // find the WiFi with the strongest signal (but keep priority of entry if signal difference is not big) - if (foundBSSID || (n < (unsigned)selected && WiFi.RSSI(o) > rssi-10) || WiFi.RSSI(o) > rssi) { + if (foundBSSID || (n < selected && WiFi.RSSI(o) > rssi-10) || WiFi.RSSI(o) > rssi) { rssi = foundBSSID ? 0 : WiFi.RSSI(o); // RSSI is only ever negative selected = n; } From e4d6848d1b3b5776d2610d6c12b23911d1a05335 Mon Sep 17 00:00:00 2001 From: Karan Vijayakumar Date: Sat, 29 Nov 2025 21:10:41 +0900 Subject: [PATCH 21/23] Revert .vscode/extensions.json --- .vscode/extensions.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 8057bc70a7..bca82dcaae 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,5 @@ { "recommendations": [ - "pioarduino.pioarduino-ide", "platformio.platformio-ide" ], "unwantedRecommendations": [ From d2c13135b60951b7ec131ac05bda587fdc939604 Mon Sep 17 00:00:00 2001 From: Karan Vijayakumar Date: Sat, 29 Nov 2025 21:18:45 +0900 Subject: [PATCH 22/23] Fully revert .vscode/extensions.json to base branch --- .vscode/extensions.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index bca82dcaae..080e70d08b 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,4 +1,6 @@ { + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format "recommendations": [ "platformio.platformio-ide" ], From 4ebbd866c497512453eff74e0e68a33a47c38523 Mon Sep 17 00:00:00 2001 From: Karan Vijayakumar Date: Sat, 29 Nov 2025 21:28:31 +0900 Subject: [PATCH 23/23] Use Aircoookie/ESPAsyncWebServer v2.4.2 instead of softhack007 fork - Upgrade to newer ESPAsyncWebServer that has deferResponse() and queue features - Remove deferResponse() wrapper function from fcn_declare.h - Remove AsyncWebServer constructor conditional from wled.h - Revert json.cpp, set.cpp, wled_server.cpp to use native deferResponse() This addresses @willmmiles feedback to use the proper library instead of workarounds. --- wled00/fcn_declare.h | 11 ----------- wled00/json.cpp | 2 +- wled00/set.cpp | 2 +- wled00/wled.h | 5 ----- wled00/wled_server.cpp | 2 +- 5 files changed, 3 insertions(+), 19 deletions(-) diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 5bea2b5c36..d950b16655 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -553,17 +553,6 @@ void serveJsonError(AsyncWebServerRequest* request, uint16_t code, uint16_t erro void serveSettings(AsyncWebServerRequest* request, bool post = false); void serveSettingsJS(AsyncWebServerRequest* request); -// ESP32-C6 compatibility: deferResponse not available in patched ESPAsyncWebServer fork -// Use this inline function which falls back to sending a 503 error -inline void deferResponse(AsyncWebServerRequest* request) { -#if defined(CONFIG_IDF_TARGET_ESP32C6) - // deferResponse not available, send 503 Service Unavailable instead - request->send(503, F("text/plain"), F("Server busy, try again")); -#else - request->deferResponse(); -#endif -} - //ws.cpp void handleWs(); void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len); diff --git a/wled00/json.cpp b/wled00/json.cpp index 76de82513e..22ebcf7b03 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -1135,7 +1135,7 @@ void serveJson(AsyncWebServerRequest* request) } if (!requestJSONBufferLock(17)) { - deferResponse(request); + request->deferResponse(); return; } // releaseJSONBufferLock() will be called when "response" is destroyed (from AsyncWebServer) diff --git a/wled00/set.cpp b/wled00/set.cpp index bf02e6de3c..b1831cf9e7 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -655,7 +655,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) if (subPage == SUBPAGE_UM) { if (!requestJSONBufferLock(5)) { - deferResponse(request); + request->deferResponse(); return; } diff --git a/wled00/wled.h b/wled00/wled.h index eec373d3a9..9046a36557 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -921,12 +921,7 @@ WLED_GLOBAL bool ledStatusState _INIT(false); // the current LED state #endif // server library objects -#if defined(CONFIG_IDF_TARGET_ESP32C6) -// ESP32-C6 uses patched ESPAsyncWebServer fork with simpler constructor -WLED_GLOBAL AsyncWebServer server _INIT_N(((80))); -#else WLED_GLOBAL AsyncWebServer server _INIT_N(((80, {0, WLED_REQUEST_MAX_QUEUE, WLED_REQUEST_MIN_HEAP, WLED_REQUEST_HEAP_USAGE}))); -#endif #ifdef WLED_ENABLE_WEBSOCKETS WLED_GLOBAL AsyncWebSocket ws _INIT_N((("/ws"))); #endif diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index fbcebef9c5..7a455453cd 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -393,7 +393,7 @@ void initServer() bool isConfig = false; if (!requestJSONBufferLock(14)) { - deferResponse(request); + request->deferResponse(); return; }