Compare commits

..

10 Commits

Author SHA1 Message Date
Frank Möhle c02c5ca775 Merge branch 'main' into backport_5435 2026-06-20 16:51:17 +02:00
Frank 779cfa1904 implement review feedback
* clarify #ifdef condition in waitForLEDs()
* move strip.waitForLEDs() before file exists checks  (exists() can cause flickering)
* use MEDUIM timeout in image loader
* correct misunderstood comment in wled.cpp
2026-06-20 16:19:12 +02:00
Frank 01e81c286a short wait in sendDataWs()
getFreeHeapSize() can cause glitches.
2026-06-19 23:04:20 +02:00
Frank 098908d994 fix ancient typo 2026-06-19 23:03:23 +02:00
Frank 16d94e7b87 minor improvements (suggested by the bunny)
* space before comment
* use isUpdating() - not strip.isUpdating() - in waitForLEDs()
2026-06-19 22:46:26 +02:00
Frank adbd8e8ee3 wait for LEDs after beginStrip()
prevents flickering at startup
2026-06-19 22:45:04 +02:00
Frank 0be9f2302d fox comment
comment should match real timeout
2026-06-19 21:20:59 +02:00
Frank 71ca244b46 modernization for 16.0.0
* use constants instead of raw timeouts
* simplify usage - in many cases we don't need #ifdef any more
* missed one "wait" on image_loader
2026-06-19 21:19:38 +02:00
Frank 37de1ce2bd overlooked one 2026-06-19 20:32:05 +02:00
Frank Möhle b4bb5fe4bd (0.15.x) wait for LEDs output to finish before OS calls that potentially suspend interrupts (#5435)
* adding strip.waitForLEDs(waitMS) function
* wait for LEDs output to complete before file writing
* wait before ESP.getFreeHeap() - main loop
* wait before file close (upload) and before  getFreeHeap() (json info)
* avoid losing "trigger" events due to strip.suspend
---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-06-19 20:26:17 +02:00
44 changed files with 290 additions and 602 deletions
+2 -2
View File
@@ -134,8 +134,8 @@ main # Main development trunk (daily/nightly) 17.0.0-dev. Target
Background Info:
- PSRAM access is up to 15× slower than DRAM on ESP32 (dual-SPI bus), 310× slower than DRAM on ESP32-S3/-S2 with quad-SPI bus. On ESP32-S3 with octal PSRAM (`CONFIG_SPIRAM_MODE_OCT`), the penalty is smaller (~2×) because the 8-line DTR bus can transfer 8 bits in parallel. On ESP32-P4 with hex PSRAM (`CONFIG_SPIRAM_MODE_HEX`), the 16-line bus runs at 200 MHz which brings it on-par with DRAM.
- Consider that ESP32 often crashes when the largest available DRAM chunk gets below 10 KB.
- PSRAM access is up to 18× slower than DRAM on ESP32 (dual-SPI bus), 310× slower than DRAM on ESP32-S3/-S2 with quad-SPI bus. On ESP32-S3 with octal PSRAM (`CONFIG_SPIRAM_MODE_OCT`), the penalty is smaller (~2×) because the 8-line DTR bus can transfer 8 bits in parallel. On ESP32-P4 with hex PSRAM (`CONFIG_SPIRAM_MODE_HEX`), the 16-line bus runs at 200 MHz which brings it on-par with DRAM.
- Consider that ESP32 often crashes when the largest DRAM chunk gets below 10 KB.
### Preprocessor / Feature Flags
- Feature toggling: `WLED_DISABLE_*` and `WLED_ENABLE_*` flags (exact names matter!)
@@ -29,7 +29,6 @@ License along with NeoPixel. If not, see
#pragma once
#if defined(ARDUINO_ARCH_ESP32)
#if !defined(WLED_USE_SHARED_RMT) // V5 fix: don't compile this file on unsupported platforms
// Use the NeoEspRmtSpeed types from the driver-based implementation
#include <NeoPixelBus.h>
@@ -468,4 +467,3 @@ typedef NeoEsp32RmtHI7Ws2805InvertedMethod NeoEsp32RmtHI7Ws2814InvertedMethod;
#endif // !defined(CONFIG_IDF_TARGET_ESP32C3)
#endif
#endif
+6 -7
View File
@@ -5,17 +5,15 @@
*
*/
#if defined(__XTENSA__) && defined(ESP32)
#include "esp_idf_version.h"
#include "sdkconfig.h"
/* If the Bluetooth driver has hooked the high-priority interrupt, we piggyback on it and don't need this. */
#if !defined(CONFIG_BTDM_CTRL_HLI) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
#if defined(__XTENSA__) && defined(ESP32) && !defined(CONFIG_BTDM_CTRL_HLI)
#include <freertos/xtensa_context.h>
#include "sdkconfig.h"
#include "soc/soc.h"
/* If the Bluetooth driver has hooked the high-priority interrupt, we piggyback on it and don't need this. */
#ifndef CONFIG_BTDM_CTRL_HLI
/*
Select interrupt based on system check level
- Base ESP32: could be 4 or 5, depends on platform config
@@ -260,5 +258,6 @@ _highint_stack_switch:
.global ld_include_hli_vectors_rmt
ld_include_hli_vectors_rmt:
#endif // CONFIG_BTDM_CTRL_HLI
#endif // XTensa
@@ -29,7 +29,7 @@ License along with NeoPixel. If not, see
#include <Arduino.h>
#if defined(ARDUINO_ARCH_ESP32) && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
#if defined(ARDUINO_ARCH_ESP32)
#include <algorithm>
#include "esp_idf_version.h"
@@ -504,4 +504,4 @@ esp_err_t NeoEsp32RmtHiMethodDriver::WaitForTxDone(rmt_channel_t channel, TickTy
return rv;
}
#endif
#endif
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "wled",
"version": "17.0.0-devV5",
"version": "17.0.0-dev",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wled",
"version": "17.0.0-devV5",
"version": "17.0.0-dev",
"license": "ISC",
"dependencies": {
"clean-css": "^5.3.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wled",
"version": "17.0.0-devV5",
"version": "17.0.0-dev",
"description": "Tools for WLED project",
"main": "tools/cdata.js",
"directories": {
-12
View File
@@ -1,12 +0,0 @@
# FastLED exports some weak cxx symbols as a way of managing integration with C-only
# projects that cause it to be preferentially linked instead of unused code being
# discarded like other libraries. This causes not only bloat of the final binaries
# but can incorrectly invoke some of their driver framework on some platforms.
#
# Solve this problem by moving the cxx library up in the linker command line, so
# that it will be chosen over FastLED's.
Import("env")
if "-lcxx" in env["LIBS"]:
env["LIBS"].remove("-lcxx")
env["LIBS"].insert(0, "-lcxx")
+93 -203
View File
@@ -10,34 +10,29 @@
# ------------------------------------------------------------------------------
# CI/release binaries
default_envs =
; nodemcuv2
; esp8266_2m
; esp01_1m_full
nodemcuv2_160 ;; 8266 regression test build
; esp8266_2m_160
; esp01_1m_full_160
; nodemcuv2_compat
; esp8266_2m_compat
; esp01_1m_full_compat
esp32dev_V4 ;; V4 regression test build
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
lolin_s2_mini
esp32c3dev
; esp32s3dev_16MB_opi ;; TODO: disabled NeoEsp32RmtMethodIsr
; esp32s3dev_8MB_opi ;; TODO: disabled NeoEsp32RmtMethodIsr
esp32s3_4M_qspi ;; TODO: disabled NeoEsp32RmtMethodIsr
esp32c3dev_qio
; esp32S3_wroom2 ;; TODO: disabled NeoEsp32RmtMethodIsr
; esp32s3dev_16MB_opi ;; TODO: disabled NeoEsp32RmtMethodIsr
esp32s3dev_8MB_opi ;; TODO: disabled NeoEsp32RmtMethodIsr
; esp32s3dev_8MB_qspi ;; TODO: disabled NeoEsp32RmtMethodIsr
; esp32s3dev_8MB_none ;; TODO: disabled NeoEsp32RmtMethodIsr
; esp32s3_4M_qspi ;; TODO: disabled NeoEsp32RmtMethodIsr
; usermods ;; TODO: disabled until the core is building
esp32S3_wroom2
esp32s3dev_16MB_opi
esp32s3dev_8MB_opi
esp32s3dev_8MB_qspi
esp32s3dev_8MB_none
esp32s3_4M_qspi
usermods
src_dir = ./wled00
data_dir = ./wled00/data
@@ -103,9 +98,6 @@ ldscript_2m512k = eagle.flash.2m512.ld
ldscript_2m1m = eagle.flash.2m1m.ld
ldscript_4m1m = eagle.flash.4m1m.ld
default_usermods = ;; TODO: add back audioreactive once V5 compatible
;; default_usermods = wizlights animartrix ;; for testing
[scripts_defaults]
extra_scripts =
pre:pio-scripts/set_metadata.py
@@ -115,7 +107,6 @@ extra_scripts =
pre:pio-scripts/user_config_copy.py
pre:pio-scripts/load_usermods.py
pre:pio-scripts/build_ui.py
;;post:pio-scripts/fastled_cxx_workaround.py
post:pio-scripts/validate_modules.py ;; double-check the build output usermods
; post:pio-scripts/obj-dump.py ;; convenience script to create a disassembly dump of the firmware (hardcore debugging)
@@ -138,15 +129,33 @@ upload_speed = 115200
# ------------------------------------------------------------------------------
lib_compat_mode = strict
lib_deps =
crankyoldgit/IRremoteESP8266 @ 2.9.0
;; neopixelbus dependancy moved into [8266] and [esp32_all_variants] sections
ESPAsyncWebServerWLED = git+https://github.com/Aircoookie/ESPAsyncWebServer#ac44e32abf2a69ae650412fb6bc193c59ccac38a
IRremoteESP8266 @ 2.8.2
https://github.com/Makuna/NeoPixelBus.git#a0919d1c10696614625978dd6fb750a1317a14ce
https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.2
marvinroger/AsyncMqttClient @ 0.9.0
# for I2C interface
;Wire
# ESP-NOW library
;gmag11/QuickESPNow @ ~0.7.0
https://github.com/blazoncek/QuickESPNow.git#optional-debug
#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
#olikraus/U8g2 #@ ~2.33.15
#For Dallas sensor uncomment following
#paulstoffregen/OneWire @ ~2.3.8
#For BME280 sensor uncomment following
#BME280 @ ~3.0.0
;adafruit/Adafruit BMP280 Library @ 2.1.0
;adafruit/Adafruit CCS811 Library @ 1.0.4
;adafruit/Adafruit Si7021 Library @ 1.4.0
#For MAX1704x Lipo Monitor / Fuel Gauge uncomment following
; https://github.com/adafruit/Adafruit_BusIO @ 1.14.5
; https://github.com/adafruit/Adafruit_MAX1704X @ 1.0.2
#For MPU6050 IMU uncomment follwoing
;electroniccats/MPU6050 @1.0.1
# SHT85
;robtillaart/SHT85@~0.3.3
extra_scripts = ${scripts_defaults.extra_scripts}
@@ -210,6 +219,7 @@ build_flags =
-D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 ;; in case of linker errors like "section `.text1' will not fit in region `iram1_0_seg'"
; -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED ;; (experimental) adds some extra heap, but may cause slowdown
-D NON32XFER_HANDLER ;; ask forgiveness for PROGMEM misuse
lib_deps =
#https://github.com/lorol/LITTLEFS.git
ESPAsyncTCP @ 1.2.2
@@ -217,7 +227,6 @@ lib_deps =
ESP8266PWM
https://github.com/tignioj/ArduinoUZlib.git#20aff95cd80c141f80bdbf66895409a0046d2c2f
${env.lib_deps}
https://github.com/Makuna/NeoPixelBus.git#a0919d1c10696614625978dd6fb750a1317a14ce ;; standard NPB version used in main branch
monitor_filters = esp8266_exception_decoder
@@ -254,22 +263,20 @@ lib_deps_compat =
[esp32_all_variants]
lib_deps =
esp32async/AsyncTCP @ 3.4.10
esp32async/AsyncTCP @ 3.4.7
bitbank2/AnimatedGIF@^1.4.7
https://github.com/Aircoookie/GifDecoder.git#bc3af189b6b1e06946569f6b4287f0b79a860f8e
NeoPixelBus = git+https://github.com/Makuna/NeoPixelBus#76afe832f74b0738a3fa1bba0caf389ade9e7693
build_flags =
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_ASYNC_TCP_STACK_SIZE=8192
-D WLED_ENABLE_GIF
[esp32]
platform = ${esp32_idf_V5.platform}
platform = ${esp32_idf_V4.platform}
platform_packages =
build_unflags = ${esp32_idf_V5.build_unflags}
build_flags = ${esp32_idf_V5.build_flags}
lib_deps = ${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
build_unflags = ${common.build_unflags}
build_flags = ${esp32_idf_V4.build_flags}
lib_deps = ${esp32_idf_V4.lib_deps}
monitor_filters = esp32_exception_decoder
tiny_partitions = tools/WLED_ESP32_2MB_noOTA.csv
@@ -284,6 +291,7 @@ board_build.partitions = ${esp32.default_partitions} ;; default partioning for
AR_build_flags = ;; -fsingle-precision-constant ;; forces ArduinoFFT to use float math (2x faster)
AR_lib_deps = ;; for pre-usermod-library platformio_override compatibility
[esp32_idf_V4]
;; build environment for ESP32 using ESP-IDF 4.4.x / arduino-esp32 v2.0.5
;; *** important: build flags from esp32_idf_V4 are inherited by _all_ esp32-based MCUs: esp32, esp32s2, esp32s3, esp32c3
@@ -313,45 +321,12 @@ lib_deps =
${esp32_all_variants.lib_deps}
https://github.com/someweisguy/esp_dmx.git#47db25d8c515e76fabcf5fc5ab0b786f98eeade0
${env.lib_deps}
lib_ignore =
[esp32_idf_V5]
;; build environment for ESP32 using ESP-IDF 5.3.4 / arduino-esp32 v3.1.10
platform = https://github.com/tasmota/platform-espressif32/releases/download/2026.02.30/platform-espressif32.zip
platform_packages =
build_unflags = ${common.build_unflags}
-Wno-volatile ;; avoid warning on .c files: "-Wno-volatile only applies to c++ files"
build_flags = -g
;;-Wno-deprecated ;; disables a ton of warnings: implicit capture of 'this' via '[=]' is deprecated in C++20 [-Wdeprecated]
-Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one
-DARDUINO_ARCH_ESP32
; -DESP32=ESP32 ;; disabled to avoid compiler warning: "ESP32" redefined
${esp32_all_variants.build_flags}
-D WLED_USE_SHARED_RMT ;; ToDO: check if NeoESP32RmtHI is still needed with V5 (see discussion in PR#4838)
-D WLED_DISABLE_INFRARED ;; TODO: remove once we have updated library for V5
-D WLED_DISABLE_MQTT ;; TODO: remove once we have updated library for V5
-D WLED_ENABLE_DMX_INPUT
-D ESP32_ARDUINO_NO_RGB_BUILTIN ;; avoids RMT driver abort on startup "E (98) rmt(legacy): CONFLICT! driver_ng is not allowed to be used with the legacy driver"
lib_deps =
${esp32_all_variants.lib_deps}
https://github.com/netmindz/esp_dmx/#esp-idf-v5-fixes
${env.lib_deps}
lib_ignore =
NeoESP32RmtHI
[v5_pioarduino_workaround]
# This is a disgusting workaround for a pioarduino "feature": if you don't ever mention lib_archive in your platformio.ini
# it forces it off globally, causing unused code from all libraries to be included even if you don't use it.
# This causes FastLED to activate its driver framework, stealing hardware resources we want to use.
# To work around this, all that we have to do is mention lib_archive in any section, even if it's never used; then
# pioarduino believes we know what we're doing, and lets us do what we want.
lib_archive = yes
[esp32s2]
;; generic definitions for all ESP32-S2 boards
platform = ${esp32_idf_V5.platform}
platform_packages = ${esp32_idf_V5.platform_packages}
build_unflags = ${esp32_idf_V5.build_unflags}
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = -g
-DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32S2
@@ -361,18 +336,17 @@ build_flags = -g
-DARDUINO_USB_MODE=0 ;; this flag is mandatory for ESP32-S2 !
;; 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}
${esp32_idf_V4.build_flags}
lib_deps =
${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
${esp32_idf_V4.lib_deps}
board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs
monitor_filters = esp32_exception_decoder
[esp32c3]
;; generic definitions for all ESP32-C3 boards
platform = ${esp32_idf_V5.platform}
platform_packages = ${esp32_idf_V5.platform_packages}
build_unflags = ${esp32_idf_V5.build_unflags}
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = -g
-DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32C3
@@ -381,21 +355,20 @@ 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}
${esp32_idf_V4.build_flags}
lib_deps =
${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
${esp32_idf_V4.lib_deps}
board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs
board_build.flash_mode = qio
monitor_filters = esp32_exception_decoder
[esp32s3]
;; generic definitions for all ESP32-S3 boards
platform = ${esp32_idf_V5.platform}
platform_packages = ${esp32_idf_V5.platform_packages}
build_unflags = ${esp32_idf_V5.build_unflags}
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${common.build_unflags}
build_flags = -g
;; -DESP32 ;; disabled to avoid compiler warning: "ESP32" redefined
-DESP32
-DARDUINO_ARCH_ESP32
-DARDUINO_ARCH_ESP32S3
-DCONFIG_IDF_TARGET_ESP32S3=1
@@ -403,14 +376,14 @@ 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
${esp32_idf_V5.build_flags}
${esp32_idf_V4.build_flags}
lib_deps =
${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
${esp32_idf_V4.lib_deps}
board_build.partitions = ${esp32.large_partitions} ;; default partioning for 8MB flash - can be overridden in build envs
upload_speed = 921600
monitor_filters = esp32_exception_decoder
# ------------------------------------------------------------------------------
# WLED BUILDS
# ------------------------------------------------------------------------------
@@ -438,7 +411,7 @@ extends = env:nodemcuv2
board_build.f_cpu = 160000000L
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP8266_160\" #-DWLED_DISABLE_2D
-D WLED_DISABLE_PARTICLESYSTEM2D
custom_usermods = ${common.default_usermods}
custom_usermods = audioreactive
[env:esp8266_2m]
extends = esp8266
@@ -465,7 +438,7 @@ board_build.f_cpu = 160000000L
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP02_160\"
-D WLED_DISABLE_PARTICLESYSTEM1D
-D WLED_DISABLE_PARTICLESYSTEM2D
custom_usermods = ${common.default_usermods}
custom_usermods = audioreactive
[env:esp8266_2m_min]
;; Minimal-feature build for ESP02 (2MB flash).
@@ -519,76 +492,35 @@ build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=
-D WLED_DISABLE_PIXELFORGE
;; custom_usermods = audioreactive ;; pushed program flash size over the limits
[env:esp32dev_V4]
;; uses V4 framework - for checking that the code still builds in V4
board = esp32dev
platform = ${esp32_idf_V4.platform}
platform_packages = ${esp32_idf_V4.platform_packages}
build_unflags = ${esp32_idf_V4.build_unflags}
-D WLED_ENABLE_DMX_INPUT ;; TODO: fix lots of compile errors in dmx_input.cpp
custom_usermods = ${common.default_usermods}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_V4\" #-D WLED_DISABLE_BROWNOUT_DET
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
-D WLED_USE_ETHERNET -D RLYPIN=-1 -D BTNPIN=-1 ;; TODO: this is just for testing - remove before merging to main
lib_deps = ${esp32_idf_V4.lib_deps}
lib_ignore = ${esp32_idf_V4.lib_ignore}
esp_dmx ;; TODO: fix lots of compile errors in dmx_input.cpp
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = dio
[env:esp32dev]
extends = esp32
board = esp32dev
platform = ${esp32_idf_V5.platform}
platform_packages = ${esp32_idf_V5.platform_packages}
build_unflags = ${esp32_idf_V5.build_unflags}
custom_usermods = ${common.default_usermods}
build_flags = ${common.build_flags} ${esp32_idf_V5.build_flags} -D WLED_RELEASE_NAME=\"ESP32\" #-D WLED_DISABLE_BROWNOUT_DET
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32\" #-D WLED_DISABLE_BROWNOUT_DET
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
lib_deps = ${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = dio
[env:esp32dev_debug]
extends = env:esp32dev
build_type = debug
monitor_filters = esp32_exception_decoder
upload_speed = 921600
build_unflags = ${esp32_idf_V5.build_unflags}
-D WLED_RELEASE_NAME=\"ESP32\"
build_flags = ${common.build_flags} ${esp32_idf_V5.build_flags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags}
-D WLED_DEBUG
-D WLED_RELEASE_NAME=\"ESP32_DEBUG\"
-DARDUINO_USB_CDC_ON_BOOT=0
[env:esp32dev_8M]
board = esp32dev
platform = ${esp32_idf_V5.platform}
platform_packages = ${esp32_idf_V5.platform_packages}
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32_idf_V5.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V5.build_flags} -D WLED_RELEASE_NAME=\"ESP32_8M\" #-D WLED_DISABLE_BROWNOUT_DET
extends = env:esp32dev
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_8M\" #-D WLED_DISABLE_BROWNOUT_DET
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
lib_deps = ${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.large_partitions}
board_upload.flash_size = 8MB
board_upload.maximum_size = 8388608
; board_build.f_flash = 80000000L
[env:esp32dev_16M]
board = esp32dev
platform = ${esp32_idf_V5.platform}
platform_packages = ${esp32_idf_V5.platform_packages}
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32_idf_V5.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V5.build_flags} -D WLED_RELEASE_NAME=\"ESP32_16M\" #-D WLED_DISABLE_BROWNOUT_DET
extends = env:esp32dev
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_16M\" #-D WLED_DISABLE_BROWNOUT_DET
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
lib_deps = ${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
@@ -597,36 +529,28 @@ board_build.f_flash = 80000000L
[env:esp32_eth]
extends = esp32
board = esp32-poe
platform = ${esp32_idf_V5.platform}
platform_packages = ${esp32_idf_V5.platform_packages}
upload_speed = 921600
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32_idf_V5.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V5.build_flags} -D WLED_RELEASE_NAME=\"ESP32_Ethernet\" -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1
-D SR_DMTYPE=-1 -D AUDIOPIN=-1 -D I2S_SDPIN=-1 -D I2S_WSPIN=-1 -D I2S_CKPIN=-1 -D MCLK_PIN=-1 ;; force AR to not allocate any PINs at startup
-D DATA_PINS=4 ;; default led pin = 16 conflicts with pins used for ethernet
; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only => uncomment if your board uses ETH_CLOCK_GPIO0_OUT, ETH_CLOCK_GPIO16_OUT, ETH_CLOCK_GPIO17_OUT
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
lib_deps = ${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_Ethernet\" -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1
-D SR_DMTYPE=-1 -D AUDIOPIN=-1 -D I2S_SDPIN=-1 -D I2S_WSPIN=-1 -D I2S_CKPIN=-1 -D MCLK_PIN=-1 ;; force AR to not allocate any PINs at startup
-D DATA_PINS=4 ;; default led pin = 16 conflicts with pins used for ethernet
; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only => uncomment if your board uses ETH_CLOCK_GPIO0_OUT, ETH_CLOCK_GPIO16_OUT, ETH_CLOCK_GPIO17_OUT
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = dio
[env:esp32_wrover]
extends = esp32_idf_V5
extends = esp32_idf_V4
board = ttgo-t7-v14-mini32
board_build.f_flash = 80000000L
board_build.flash_mode = qio
board_build.partitions = ${esp32.extended_partitions}
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32_idf_V5.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V5.build_flags} -D WLED_RELEASE_NAME=\"ESP32_WROVER\"
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_WROVER\"
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
-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 DATA_PINS=25
lib_deps = ${esp32_idf_V5.lib_deps}
[env:esp32c3dev]
extends = esp32c3
board = esp32-c3-devkitm-1
@@ -637,8 +561,6 @@ build_flags = ${common.build_flags} ${esp32c3.build_flags} -D WLED_RELEASE_NAME=
-DARDUINO_USB_CDC_ON_BOOT=1 ;; for virtual CDC USB
;-DARDUINO_USB_CDC_ON_BOOT=0 ;; for serial-to-USB chip
upload_speed = 460800
build_unflags = ${esp32c3.build_unflags}
lib_deps = ${esp32c3.lib_deps}
board_build.flash_mode = dio ; safe default, required for OTA updates to 0.16 from older version which used dio (must match the bootloader!)
[env:esp32c3dev_qio]
@@ -651,18 +573,12 @@ board_build.flash_mode = qio ; qio is faster and works on almost all boards (som
extends = esp32s3
board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
board_build.arduino.memory_type = qio_opi ;; use with PSRAM: 8MB or 16MB
platform = ${esp32s3.platform}
platform_packages = ${esp32s3.platform_packages}
upload_speed = 921600
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32s3.build_unflags}
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_16MB_opi\"
-D WLED_WATCHDOG_TIMEOUT=0
;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
-D ARDUINO_USB_CDC_ON_BOOT=1 ;; -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM
lib_deps = ${esp32s3.lib_deps}
lib_ignore = ${esp32s3.lib_ignore}
board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
@@ -674,19 +590,12 @@ board_build.flash_mode = qio
extends = esp32s3
board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM support
board_build.arduino.memory_type = qio_opi ;; use with PSRAM: 8MB or 16MB
platform = ${esp32s3.platform}
platform_packages = ${esp32s3.platform_packages}
upload_speed = 921600
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32s3.build_unflags}
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_8MB_opi\"
-D WLED_WATCHDOG_TIMEOUT=0
;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
-D ARDUINO_USB_CDC_ON_BOOT=1 ;; -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM
lib_deps = ${esp32s3.lib_deps}
lib_ignore = ${esp32s3.lib_ignore}
board_build.partitions = ${esp32.large_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio
@@ -721,9 +630,7 @@ board_build.flash_mode = qio
extends = esp32s3
board = esp32s3camlcd ;; this is the only standard board with "opi_opi"
board_build.arduino.memory_type = opi_opi
upload_speed = 921600
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32s3.build_unflags}
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_WROOM-2\"
-D WLED_WATCHDOG_TIMEOUT=0
-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
@@ -733,9 +640,6 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=
-D BTNPIN=0 -D RLYPIN=16 -D IRPIN=17 -D AUDIOPIN=-1
;;-D WLED_DEBUG
-D SR_DMTYPE=1 -D I2S_SDPIN=13 -D I2S_CKPIN=14 -D I2S_WSPIN=15 -D MCLK_PIN=4 ;; I2S mic
lib_deps = ${esp32s3.lib_deps}
lib_ignore = ${esp32s3.lib_ignore}
board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
@@ -759,17 +663,13 @@ board_upload.maximum_size = 33554432
[env:esp32s3_4M_qspi]
;; ESP32-S3, with 4MB FLASH and <= 4MB PSRAM (memory_type: qio_qspi)
extends = esp32s3
board = lolin_s3_mini ;; -S3 mini, 4MB flash 2MB PSRAM
upload_speed = 921600
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32s3.build_unflags}
board = lolin_s3_mini ;; -S3 mini, 4MB flash 2MB PSRAM
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_4M_qspi\"
-DARDUINO_USB_CDC_ON_BOOT=1 ;; -DARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM
-DLOLIN_WIFI_FIX ; seems to work much better with this
-D WLED_WATCHDOG_TIMEOUT=0
lib_deps = ${esp32s3.lib_deps}
lib_ignore = ${esp32s3.lib_ignore}
board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio
@@ -794,8 +694,7 @@ extends = esp32s2
board = lolin_s2_mini
board_build.flash_mode = qio
board_build.f_flash = 80000000L
custom_usermods = ${common.default_usermods}
build_unflags = ${esp32s2.build_unflags}
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S2\"
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MSC_ON_BOOT=0
@@ -810,22 +709,13 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=
-D HW_PIN_DATASPI=11
-D HW_PIN_MISOSPI=9
; -D STATUSLED=15
lib_deps = ${esp32s2.lib_deps}
lib_ignore = ${esp32s2.lib_ignore}
[env:usermods]
board = esp32dev
platform = ${esp32_idf_V5.platform}
platform_packages = ${esp32_idf_V5.platform_packages}
build_unflags = ${esp32_idf_V5.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V5.build_flags} -D WLED_RELEASE_NAME=\"ESP32_USERMODS\"
extends = env:esp32dev
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_USERMODS\"
-DTOUCH_CS=9
lib_deps = ${esp32_idf_V5.lib_deps}
lib_ignore = ${esp32_idf_V5.lib_ignore}
monitor_filters = esp32_exception_decoder
board_build.flash_mode = dio
;custom_usermods = * ; Expands to all usermods in usermods folder
custom_usermods = ; ToDO: fix usermods build once the main V5 build works without errors and warnings
custom_usermods = * ; Expands to all usermods in usermods folder
board_build.partitions = ${esp32.extreme_partitions} ; We're gonna need a bigger boat
+13 -11
View File
@@ -1,20 +1,20 @@
#
# This file is autogenerated by pip-compile with Python 3.13
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile
# pip-compile requirements.in
#
ajsonrpc==1.2.0
# via platformio
anyio==4.10.0
anyio==4.8.0
# via starlette
bottle==0.13.4
bottle==0.13.2
# via platformio
certifi==2025.8.3
certifi==2025.1.31
# via requests
charset-normalizer==3.4.3
charset-normalizer==3.4.1
# via requests
click==8.1.7
click==8.1.8
# via
# platformio
# uvicorn
@@ -30,9 +30,9 @@ idna==3.10
# requests
marshmallow==3.26.1
# via platformio
packaging==25.0
packaging==24.2
# via marshmallow
platformio==6.1.18
platformio==6.1.17
# via -r requirements.in
pyelftools==0.32
# via platformio
@@ -44,13 +44,15 @@ semantic-version==2.10.0
# via platformio
sniffio==1.3.1
# via anyio
starlette==0.46.2
starlette==0.45.3
# via platformio
tabulate==0.9.0
# via platformio
typing-extensions==4.12.2
# via anyio
urllib3==2.5.0
# via requests
uvicorn==0.34.3
uvicorn==0.34.0
# via platformio
wsproto==1.2.0
# via platformio
+2 -2
View File
@@ -1,5 +1,5 @@
#include "wled.h"
#if defined(USERMOD_DHT_MQTT) && defined(WLED_DISABLE_MQTT)
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
@@ -246,4 +246,4 @@ class UsermodDHT : public Usermod {
static UsermodDHT dht;
REGISTER_USERMOD(dht);
REGISTER_USERMOD(dht);
+2 -5
View File
@@ -129,14 +129,11 @@ class PWMFanUsermod : public Usermod {
if (pwmChannel == 255) { //no more free LEDC channels
deinitPWMfan(); return;
}
// configure LED PWM functionalitites - ESP-IDF 5.x API
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
ledcAttach(pwmPin, 25000, 8); // New API: ledcAttach(pin, freq, resolution)
#else
// configure LED PWM functionalitites
ledcSetup(pwmChannel, 25000, 8);
// attach the channel to the GPIO to be controlled
ledcAttachPin(pwmPin, pwmChannel);
#endif
#endif
DEBUG_PRINTLN(F("Fan PWM sucessfully initialized."));
}
+1 -1
View File
@@ -196,7 +196,7 @@ class St7789DisplayUsermod : public Usermod {
// Check if values which are shown on display changed from the last time.
if ((((apActive) ? String(apSSID) : WiFi.SSID()) != knownSsid) ||
(knownIp != (apActive ? IPAddress(4, 3, 2, 1) : WLEDNetwork.localIP())) ||
(knownIp != (apActive ? IPAddress(4, 3, 2, 1) : Network.localIP())) ||
(knownBrightness != bri) ||
(knownEffectSpeed != strip.getMainSegment().speed) ||
(knownEffectIntensity != strip.getMainSegment().intensity) ||
@@ -234,11 +234,11 @@ class QuinLEDAnPentaUsermod : public Usermod
bool oledCheckForNetworkChanges()
{
if (lastKnownNetworkConnected != WLEDNetwork.isConnected() || lastKnownIp != WLEDNetwork.localIP()
if (lastKnownNetworkConnected != Network.isConnected() || lastKnownIp != Network.localIP()
|| lastKnownWiFiConnected != WiFi.isConnected() || lastKnownSsid != WiFi.SSID()
|| lastKnownApActive != apActive || lastKnownApSsid != apSSID || lastKnownApPass != apPass || lastKnownApChannel != apChannel) {
lastKnownNetworkConnected = WLEDNetwork.isConnected();
lastKnownIp = WLEDNetwork.localIP();
lastKnownNetworkConnected = Network.isConnected();
lastKnownIp = Network.localIP();
lastKnownWiFiConnected = WiFi.isConnected();
lastKnownSsid = WiFi.SSID();
lastKnownApActive = apActive;
@@ -71,7 +71,6 @@ String HttpPullLightControl::generateUniqueId() {
unsigned char shaResult[20]; // SHA1 produces a hash of 20 bytes (which is 40 HEX characters)
mbedtls_sha1_context ctx;
mbedtls_sha1_init(&ctx);
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
status = mbedtls_sha1_starts_ret(&ctx);
if (status != 0) {
DEBUG_PRINTLN(F("Error starting SHA1 checksum calculation"));
@@ -84,21 +83,6 @@ String HttpPullLightControl::generateUniqueId() {
if (status != 0) {
DEBUG_PRINTLN(F("Error finishing SHA1 checksum calculation"));
}
#else
// function names have changed in esp-idf V5
status = mbedtls_sha1_starts(&ctx);
if (status != 0) {
DEBUG_PRINTLN(F("Error starting SHA1 checksum calculation"));
}
status = mbedtls_sha1_update(&ctx, reinterpret_cast<const unsigned char*>(input.c_str()), input.length());
if (status != 0) {
DEBUG_PRINTLN(F("Error feeding update buffer into ongoing SHA1 checksum calculation"));
}
status = mbedtls_sha1_finish(&ctx, shaResult);
if (status != 0) {
DEBUG_PRINTLN(F("Error finishing SHA1 checksum calculation"));
}
#endif
mbedtls_sha1_free(&ctx);
// Convert the Hash to a hexadecimal string
@@ -264,7 +264,7 @@ void FourLineDisplayUsermod::setup() {
// interfaces here
void FourLineDisplayUsermod::connected() {
knownSsid = WiFi.SSID(); //apActive ? apSSID : WiFi.SSID(); //apActive ? WiFi.softAPSSID() :
knownIp = WLEDNetwork.localIP(); //apActive ? IPAddress(4, 3, 2, 1) : WLEDNetwork.localIP();
knownIp = Network.localIP(); //apActive ? IPAddress(4, 3, 2, 1) : Network.localIP();
networkOverlay(PSTR("NETWORK INFO"),7000);
}
+10 -1
View File
@@ -810,6 +810,11 @@ class Segment {
friend class ParticleSystem1D;
};
// max wait times when waiting until !strip.isUpdating() - use with waitForLEDs(...)
constexpr unsigned STRIP_WAIT_VERYSHORT = 25; // 25 ms - when risk of flickering is low but delays should be avoided
constexpr unsigned STRIP_WAIT_SHORT = 50; // 50 ms - for cases where fluent animations are most important, and risk of flickering is low
constexpr unsigned STRIP_WAIT_MEDIUM = 150; // 150 ms - good balance to avoid flickering on -C3 (good up to 4000 ws2812b LEDs per pin)
// main "strip" class (108 bytes)
class WS2812FX {
typedef void (*mode_ptr)(); // pointer to mode function
@@ -910,6 +915,11 @@ class WS2812FX {
{ if (_segments.size() < getMaxSegments()) _segments.emplace_back(sStart,sStop,sStartY,sStopY); }
inline void suspend() { _suspend = true; } // will suspend (and canacel) strip.service() execution
inline void resume() { _suspend = false; } // will resume strip.service() execution
inline bool isSuspended() const { return _suspend; } // true if strip.service() execution is suspended
// be nice, but not too nice - wait until LEDs are idle, or maxWaitMS have passed
// on 8266 this call will _not_ wait outside of the main loop context
// returns isUpdating() status after waiting
bool waitForLEDs(unsigned maxWaitMS, bool always = false) const;
void restartRuntime();
void setTransitionMode(bool t);
@@ -923,7 +933,6 @@ class WS2812FX {
inline bool isServicing() const { return _isServicing; } // returns true if strip.service() is executing
inline bool hasWhiteChannel() const { return _hasWhiteChannel; } // returns true if strip contains separate white chanel
inline bool isOffRefreshRequired() const { return _isOffRefreshRequired; } // returns true if strip requires regular updates (i.e. TM1814 chipset)
inline bool isSuspended() const { return _suspend; } // returns true if strip.service() execution is suspended
inline bool needsUpdate() const { return _triggered; } // returns true if strip received a trigger() request
// uint8_t paletteBlend; // obsolete - use global paletteBlend instead of strip.paletteBlend
+30 -2
View File
@@ -29,7 +29,9 @@
19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25]}
*/
static_assert(MAX_NUM_SEGMENTS >= WLED_MAX_BUSSES, "Max segments must be at least max number of busses!");
#if MAX_NUM_SEGMENTS < WLED_MAX_BUSSES
#error "Max segments must be at least max number of busses!"
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -1835,6 +1837,33 @@ void WS2812FX::waitForIt() {
#endif
};
/**
* Be nice, but not too nice - wait until LEDs are idle, or maxWaitMS milliseconds have passed.
* always=true enforces waiting even when using the RMTHI driver.
* On 8266 this call will _not_ wait outside the main loop context.
* Function returns isUpdating() status after waiting.
**/
bool WS2812FX::waitForLEDs(unsigned maxWaitMS, bool always) const {
#ifdef ARDUINO_ARCH_ESP32
#if !defined(WLED_USE_SHARED_RMT) && !defined(__riscv)
// shortcut: don't wait if we have the RMTHI driver, unless requested with "always = true"
if (!always) return isUpdating();
#endif
unsigned long waitStart = millis();
while (isUpdating() && (millis() - waitStart < maxWaitMS)) delay(1);
#else
if (can_yield()) {
// If we are in a yieldable context (main loop), wait until the LEDs output finishes
yield();
unsigned long waitStart = millis();
while (isUpdating() && (millis() - waitStart < maxWaitMS)) delay(1);
yield();
}
#endif
return isUpdating();
}
void WS2812FX::setTargetFps(unsigned fps) {
if (fps <= 250) _targetFps = fps;
if (_targetFps > 0) _frametime = 1000 / _targetFps;
@@ -2171,7 +2200,6 @@ bool WS2812FX::deserializeMap(unsigned n) {
int index = atoi(number);
if (index < 0 || index > 65535) index = 0xFFFF; // prevent integer wrap around
customMappingTable[customMappingSize++] = index;
if (end != nullptr) break; // array closing ']' was in this chunk; stop before atoi() coerces trailing JSON keys into bogus entries
if (customMappingSize >= getLengthTotal()) break;
} else break; // there was nothing to read, stop
}
+1 -10
View File
@@ -452,13 +452,8 @@ BusPwm::BusPwm(const BusConfig &bc)
pinMode(_pins[i], OUTPUT);
#else
unsigned channel = _ledcStart + i;
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
ledcSetup(channel, _frequency, _depth - (dithering*4)); // with dithering _frequency doesn't really matter as resolution is 8 bit
ledcAttachPin(_pins[i], channel);
#else
ledcAttachChannel(_pins[i], _frequency, _depth - (dithering*4), channel);
// LEDC timer reset credit @dedehai
#endif
// LEDC timer reset credit @dedehai
uint8_t group = (channel / 8), timer = ((channel / 2) % 4); // same fromula as in ledcSetup()
ledc_timer_rst((ledc_mode_t)group, (ledc_timer_t)timer); // reset timer so all timers are almost in sync (for phase shift)
@@ -628,11 +623,7 @@ void BusPwm::deallocatePins() {
#ifdef ESP8266
digitalWrite(_pins[i], LOW); //turn off PWM interrupt
#else
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
if (_ledcStart < WLED_MAX_ANALOG_CHANNELS) ledcDetachPin(_pins[i]);
#else
if (_ledcStart < WLED_MAX_ANALOG_CHANNELS) ledcDetach(_pins[i]);
#endif
#endif
}
#ifdef ARDUINO_ARCH_ESP32
@@ -753,7 +744,7 @@ size_t BusNetwork::getPins(uint8_t* pinArray) const {
#ifdef ARDUINO_ARCH_ESP32
void BusNetwork::resolveHostname() {
static std::shared_ptr<AsyncDNS> DNSlookup; // TODO: make this dynamic? requires to handle the callback properly
if (WLEDNetwork.isConnected()) {
if (Network.isConnected()) {
IPAddress clnt;
if (strlen(cmDNS) > 0) {
clnt = MDNS.queryHost(_hostname);
+1 -4
View File
@@ -5,7 +5,6 @@
//#define NPB_CONF_4STEP_CADENCE
#include "NeoPixelBus.h"
//Hardware SPI Pins
#define P_8266_HS_MOSI 13
#define P_8266_HS_CLK 14
@@ -246,9 +245,7 @@
#endif
// RMT driver selection
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#define NeoEsp32RmtMethod(x) NeoEsp32RmtX ## x ## Method
#elif !defined(WLED_USE_SHARED_RMT) && !defined(__riscv)
#if !defined(WLED_USE_SHARED_RMT) && !defined(__riscv)
#include <NeoEsp32RmtHIMethod.h>
#define NeoEsp32RmtMethod(x) NeoEsp32RmtHIN ## x ## Method
#else
+6 -20
View File
@@ -73,13 +73,7 @@ constexpr size_t WLED_MAX_USERMOD_PALETTES = WLED_USERMOD_PALETTE_ID_BASE -
#if !defined(LEDC_CHANNEL_MAX) || !defined(LEDC_SPEED_MODE_MAX)
#include "driver/ledc.h" // needed for analog/LEDC channel counts
#endif
// define -> constexpr to avoid preprocessor errors and enum arithmetic warnings from newer compilers
#ifdef WLED_MAX_ANALOG_CHANNELS
#undef WLED_MAX_ANALOG_CHANNELS // avoid clash between macro name and constexpr constant
#endif
constexpr size_t WLED_MAX_ANALOG_CHANNELS = static_cast<size_t>(LEDC_CHANNEL_MAX) * static_cast<size_t>(LEDC_SPEED_MODE_MAX);
#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
#define WLED_MAX_RMT_CHANNELS 2 // ESP32-C3 has 2 RMT output channels
#define WLED_MAX_I2S_CHANNELS 0 // I2S not supported by NPB
@@ -96,17 +90,10 @@ constexpr size_t WLED_MAX_USERMOD_PALETTES = WLED_USERMOD_PALETTE_ID_BASE -
//#define WLED_MAX_ANALOG_CHANNELS 8
#define WLED_PLATFORM_ID 3 // used in UI to distinguish ESP type in UI, needs a proper fix!
#else
#if defined(CONFIG_IDF_TARGET_ESP32) // classic esp32
#define WLED_MAX_RMT_CHANNELS 8 // ESP32 has 8 RMT output channels
#define WLED_MAX_I2S_CHANNELS 8 // I2S parallel output supported by NPB
//#define WLED_MAX_ANALOG_CHANNELS 16
#define WLED_PLATFORM_ID 4 // used in UI to distinguish ESP type in UI, needs a proper fix!
#else // all other risc-v based boards: same as C3
#define WLED_MAX_RMT_CHANNELS 2 // ESP32-C3 has 2 RMT output channels
#define WLED_MAX_I2S_CHANNELS 0 // I2S not supported by NPB
//#define WLED_MAX_ANALOG_CHANNELS 6
#define WLED_PLATFORM_ID 1 // used in UI to distinguish ESP types - falls back to "C3" until we have a proper fix!
#endif
#define WLED_MAX_RMT_CHANNELS 8 // ESP32 has 8 RMT output channels
#define WLED_MAX_I2S_CHANNELS 8 // I2S parallel output supported by NPB
//#define WLED_MAX_ANALOG_CHANNELS 16
#define WLED_PLATFORM_ID 4 // used in UI to distinguish ESP type in UI, needs a proper fix!
#endif
#define WLED_MAX_TIMERS 64 // maximum number of timers
#define WLED_MAX_DIGITAL_CHANNELS (WLED_MAX_RMT_CHANNELS + WLED_MAX_I2S_CHANNELS)
@@ -116,8 +103,7 @@ constexpr size_t WLED_MAX_USERMOD_PALETTES = WLED_USERMOD_PALETTE_ID_BASE -
#ifdef WLED_MAX_BUSSES
#undef WLED_MAX_BUSSES
#endif
// define -> constexpr to align with definition of WLED_MAX_ANALOG_CHANNELS
constexpr size_t WLED_MAX_BUSSES = WLED_MAX_DIGITAL_CHANNELS + WLED_MAX_ANALOG_CHANNELS;
#define WLED_MAX_BUSSES (WLED_MAX_DIGITAL_CHANNELS+WLED_MAX_ANALOG_CHANNELS)
static_assert(WLED_MAX_BUSSES <= 32, "WLED_MAX_BUSSES exceeds hard limit");
// Maximum number of pins per output. 5 for RGBCCT analog LEDs.
+21 -68
View File
@@ -1,7 +1,6 @@
#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
@@ -10,8 +9,8 @@
#include "dmx_input.h"
#include <rdm/responder.h>
void rdmPersonalityChangedCb(dmx_port_t dmxPort, rdm_header_t *request_header,
rdm_header_t *response_header, void *context)
void rdmPersonalityChangedCb(dmx_port_t dmxPort, const rdm_header_t *header,
void *context)
{
DMXInput *dmx = static_cast<DMXInput *>(context);
@@ -20,16 +19,16 @@ void rdmPersonalityChangedCb(dmx_port_t dmxPort, rdm_header_t *request_header,
return;
}
if (response_header->cc == RDM_CC_SET_COMMAND_RESPONSE) {
if (header->cc == RDM_CC_SET_COMMAND_RESPONSE) {
const uint8_t personality = dmx_get_current_personality(dmx->inputPortNum);
DMXMode = std::min(DMX_MODE_PRESET, std::max(DMX_MODE_SINGLE_RGB, int(personality)));
configNeedsWrite = true;
DEBUG_PRINTF("DMX personality changed to: %d\n", DMXMode);
DEBUG_PRINTF("DMX personality changed to to: %d\n", DMXMode);
}
}
void rdmAddressChangedCb(dmx_port_t dmxPort, rdm_header_t *request_header,
rdm_header_t *response_header, void *context)
void rdmAddressChangedCb(dmx_port_t dmxPort, const rdm_header_t *header,
void *context)
{
DMXInput *dmx = static_cast<DMXInput *>(context);
@@ -38,7 +37,7 @@ void rdmAddressChangedCb(dmx_port_t dmxPort, rdm_header_t *request_header,
return;
}
if (response_header->cc == RDM_CC_SET_COMMAND_RESPONSE) {
if (header->cc == RDM_CC_SET_COMMAND_RESPONSE) {
const uint16_t addr = dmx_get_start_address(dmx->inputPortNum);
DMXAddress = std::min(512, int(addr));
configNeedsWrite = true;
@@ -48,13 +47,14 @@ void rdmAddressChangedCb(dmx_port_t dmxPort, rdm_header_t *request_header,
static dmx_config_t createConfig()
{
dmx_config_t config = DMX_CONFIG_DEFAULT;
dmx_config_t config;
config.pd_size = 255;
config.dmx_start_address = DMXAddress;
config.model_id = 0;
config.product_category = RDM_PRODUCT_CATEGORY_FIXTURE;
config.software_version_id = VERSION;
strcpy(config.device_label, "WLED_MM");
#if 0
// softhack007: ToDO: current code from main does not work in V5 yet
const std::string dmxWledVersionString = "WLED_V" + std::to_string(VERSION);
strncpy(config.software_version_label, dmxWledVersionString.c_str(), 32);
config.software_version_label[32] = '\0'; // zero termination in case versionString string was longer than 32 chars
@@ -83,51 +83,10 @@ static dmx_config_t createConfig()
config.personality_count = 10;
// rdm personalities are numbered from 1, thus we can just set the DMXMode directly.
config.current_personality = DMXMode;
#else
// fallback code
const std::string DmxVersionString = "WLED_V" + std::to_string(VERSION);
config.software_version_label = DmxVersionString.c_str();
#endif
return config;
}
static dmx_personality_t personalities[10];
static void createPersonalities()
{
// Initialize personalities array
strncpy(personalities[0].description, "SINGLE_RGB", 32);
personalities[0].footprint = 3;
strncpy(personalities[1].description, "SINGLE_DRGB", 32);
personalities[1].footprint = 4;
strncpy(personalities[2].description, "EFFECT", 32);
personalities[2].footprint = 15;
strncpy(personalities[3].description, "MULTIPLE_RGB", 32);
personalities[3].footprint = std::min(512, int(strip.getLengthTotal()) * 3);
strncpy(personalities[4].description, "MULTIPLE_DRGB", 32);
personalities[4].footprint = std::min(512, int(strip.getLengthTotal()) * 3 + 1);
strncpy(personalities[5].description, "MULTIPLE_RGBW", 32);
personalities[5].footprint = std::min(512, int(strip.getLengthTotal()) * 4);
strncpy(personalities[6].description, "EFFECT_W", 32);
personalities[6].footprint = 18;
strncpy(personalities[7].description, "EFFECT_SEGMENT", 32);
personalities[7].footprint = std::min(512, strip.getSegmentsNum() * 15);
strncpy(personalities[8].description, "EFFECT_SEGMENT_W", 32);
personalities[8].footprint = std::min(512, strip.getSegmentsNum() * 18);
strncpy(personalities[9].description, "PRESET", 32);
personalities[9].footprint = 1;
}
void dmxReceiverTask(void *context)
{
DMXInput *instance = static_cast<DMXInput *>(context);
@@ -144,11 +103,10 @@ void dmxReceiverTask(void *context)
bool DMXInput::installDriver()
{
const auto config = createConfig();
createPersonalities();
const auto config = createConfig();
DEBUG_PRINTF("DMX port: %u\n", inputPortNum);
if (!dmx_driver_install(inputPortNum, &config, personalities, 10)) {
if (!dmx_driver_install(inputPortNum, &config, DMX_INTR_FLAGS_DEFAULT)) {
DEBUG_PRINTF("Error: Failed to install dmx driver\n");
return false;
}
@@ -158,14 +116,8 @@ bool DMXInput::installDriver()
DEBUG_PRINTF("DMX enable pin is: %u\n", enPin);
dmx_set_pin(inputPortNum, txPin, rxPin, enPin);
// Set initial DMX start address and personality
dmx_set_start_address(inputPortNum, DMXAddress);
dmx_set_current_personality(inputPortNum, DMXMode);
// Register RDM callbacks for start address and personality changes
rdm_register_dmx_start_address(inputPortNum, rdmAddressChangedCb, this);
rdm_register_dmx_personality(inputPortNum, 10, rdmPersonalityChangedCb, this);
rdm_register_dmx_personality(inputPortNum, rdmPersonalityChangedCb, this);
initialized = true;
return true;
}
@@ -199,9 +151,9 @@ void DMXInput::init(int8_t rxPin, int8_t txPin, int8_t enPin, uint8_t inputPortN
const bool pinsAllocated = PinManager::allocateMultiplePins(pins, 3, PinOwner::DMX_INPUT);
if (!pinsAllocated) {
DEBUG_PRINTF("DMXInput: Error: Failed to allocate pins for DMX_INPUT. Pins already in use:\n");
DEBUG_PRINTF("rx in use by: %hhd\n", PinManager::getPinOwner(rxPin));
DEBUG_PRINTF("tx in use by: %hhd\n", PinManager::getPinOwner(txPin));
DEBUG_PRINTF("en in use by: %hhd\n", PinManager::getPinOwner(enPin));
DEBUG_PRINTF("rx in use by: %s\n", PinManager::getPinOwner(rxPin));
DEBUG_PRINTF("tx in use by: %s\n", PinManager::getPinOwner(txPin));
DEBUG_PRINTF("en in use by: %s\n", PinManager::getPinOwner(enPin));
return;
}
@@ -295,11 +247,12 @@ void DMXInput::enable()
bool DMXInput::isIdentifyOn() const
{
bool identify = false;
uint8_t identify = 0;
const bool gotIdentify = rdm_get_identify_device(inputPortNum, &identify);
// gotIdentify should never be false because it is a default parameter in rdm
// but just in case we check for it anyway
return identify && gotIdentify;
return bool(identify) && gotIdentify;
}
void DMXInput::checkAndUpdateConfig()
@@ -324,4 +277,4 @@ void DMXInput::checkAndUpdateConfig()
}
}
#endif
#endif
+4 -4
View File
@@ -42,12 +42,12 @@ private:
void updateInternal();
// is invoked whenver the dmx start address is changed via rdm
friend void rdmAddressChangedCb(dmx_port_t dmxPort, rdm_header_t *request_header,
rdm_header_t *response_header, void *context);
friend void rdmAddressChangedCb(dmx_port_t dmxPort, const rdm_header_t *header,
void *context);
// is invoked whenever the personality is changed via rdm
friend void rdmPersonalityChangedCb(dmx_port_t dmxPort, rdm_header_t *request_header,
rdm_header_t *response_header, void *context);
friend void rdmPersonalityChangedCb(dmx_port_t dmxPort, const rdm_header_t *header,
void *context);
/// The internal dmx task.
/// This is the main loop of the dmx receiver. It never returns.
+2 -2
View File
@@ -457,7 +457,7 @@ static void prepareArtnetPollReply(ArtPollReply *reply) {
reply->reply_opcode = ARTNET_OPCODE_OPPOLLREPLY;
IPAddress localIP = WLEDNetwork.localIP();
IPAddress localIP = Network.localIP();
for (unsigned i = 0; i < 4; i++) {
reply->reply_ip[i] = localIP[i];
}
@@ -532,7 +532,7 @@ static void prepareArtnetPollReply(ArtPollReply *reply) {
// A DMX to / from Art-Net device
reply->reply_style = 0x00;
WLEDNetwork.localMAC(reply->reply_mac);
Network.localMAC(reply->reply_mac);
for (unsigned i = 0; i < 4; i++) {
reply->reply_bind_ip[i] = localIP[i];
-11
View File
@@ -3,13 +3,6 @@
#define WLED_FCN_DECLARE_H
#include <dynarray.h>
// dummy macro for 8266
#ifndef ARDUINO_ARCH_ESP32
#ifndef ESP_IDF_VERSION_VAL
#define ESP_IDF_VERSION_VAL(n1,n2,n3) 500
#endif
#endif
#include "colors.h"
/*
@@ -458,12 +451,8 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL
int16_t extractModeDefaults(uint8_t mode, const char *segVar);
void checkSettingsPIN(const char *pin);
uint16_t crc16(const unsigned char* data_p, size_t length);
#if !defined(ARDUINO_ARCH_ESP32) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)) // ToDO: verify that this works correctly in V5
String computeSHA1(const String& input);
String getDeviceId();
#endif
uint16_t beat88(uint16_t beats_per_minute_88, uint32_t timebase = 0);
uint16_t beat16(uint16_t beats_per_minute, uint32_t timebase = 0);
uint8_t beat8(uint16_t beats_per_minute, uint32_t timebase = 0);
+16 -1
View File
@@ -34,13 +34,24 @@ static File f; // don't export to other cpp files
//wrapper to find out how long closing takes
void closeFile() {
if (!doCloseFile || !f) { doCloseFile = false; return; } // file not open, or no request to close -> nothing to do, nothing to wait
#ifdef WLED_DEBUG_FS
DEBUGFS_PRINT(F("Close -> "));
uint32_t s = millis();
#endif
doCloseFile = false; // consume flag early, to reduce the time window for concurrent closing attempts from several tasks.
// f.close() may enter flash critical sections (interrupts/cache paused), so we wait for LED transmission to finish first to avoid WS281x glitches
// This is most relevant on ESP32-C3/C5/C6, where the RMT driver is very sensitive to interrupt timing.
bool haveSuspended = false;
#if defined(WLED_USE_SHARED_RMT) || defined(__riscv) || !defined(ARDUINO_ARCH_ESP32)
if (!strip.isSuspended()) { strip.suspend(); haveSuspended = true; } // prevent that a new strip.show() starts after waiting
strip.waitForLEDs(STRIP_WAIT_MEDIUM); // be nice, but not too nice. Waits up to 150ms
#endif
f.close(); // "if (f)" check is aleady done inside f.close(), and f cannot be nullptr -> no need for double checking before closing the file handle.
if (haveSuspended) strip.resume(); // end of critical section - new LEDs updates are allowed again
DEBUGFS_PRINTF("took %lu ms\n", millis() - s);
doCloseFile = false;
}
//find() that reads and buffers data from file stream in 256-byte blocks.
@@ -437,6 +448,7 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){
}
}
#endif
strip.waitForLEDs(STRIP_WAIT_SHORT); // wait for LEDs before file access (not using strip.suspend(), to avoid effect stuttering)
if(WLED_FS.exists(path) || WLED_FS.exists(path + ".gz")) {
request->send(request->beginResponse(WLED_FS, path, {}, request->hasArg(F("download")), {}));
return true;
@@ -447,6 +459,7 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){
// copy a file, delete destination file if incomplete to prevent corrupted files
bool copyFile(const char* src_path, const char* dst_path) {
DEBUG_PRINTF("copyFile from %s to %s\n", src_path, dst_path);
strip.waitForLEDs(STRIP_WAIT_MEDIUM, true); // wait for LEDs before file access (not using strip.suspend(), to avoid effect stuttering)
if(!WLED_FS.exists(src_path)) {
DEBUG_PRINTLN(F("file not found"));
return false;
@@ -485,6 +498,7 @@ bool copyFile(const char* src_path, const char* dst_path) {
// compare two files, return true if identical
bool compareFiles(const char* path1, const char* path2) {
DEBUG_PRINTF("compareFile %s and %s\n", path1, path2);
strip.waitForLEDs(STRIP_WAIT_SHORT); // wait for LEDs before file access (not using strip.suspend(), to avoid effect stuttering)
if (!WLED_FS.exists(path1) || !WLED_FS.exists(path2)) {
DEBUG_PRINTLN(F("file not found"));
return false;
@@ -543,6 +557,7 @@ bool restoreFile(const char* filename) {
char backupname[32];
snprintf_P(backupname, sizeof(backupname), s_backup_fmt, filename + 1); // skip leading '/' in filename
strip.waitForLEDs(STRIP_WAIT_MEDIUM); // wait for LEDs before file existence checking
if (!WLED_FS.exists(backupname)) {
DEBUG_PRINTLN(F("no backup found"));
return false;
+2 -4
View File
@@ -28,10 +28,7 @@ int fileReadCallback(void) {
}
int fileReadBlockCallback(void * buffer, int numberOfBytes) {
#ifdef CONFIG_IDF_TARGET_ESP32C3
unsigned t0 = millis();
while (strip.isUpdating() && (millis() - t0 < 150)) yield(); // be nice, but not too nice. Waits up to 150ms to avoid glitches
#endif
strip.waitForLEDs(STRIP_WAIT_MEDIUM);
return file.read((uint8_t*)buffer, numberOfBytes);
}
@@ -137,6 +134,7 @@ byte renderImageToSegment(Segment &seg) {
DEBUG_PRINTF_P(PSTR("GIF decoder unsupported file: %s\n"), lastFilename);
return IMAGE_ERROR_UNSUPPORTED_FORMAT;
}
strip.waitForLEDs(STRIP_WAIT_MEDIUM);
if (file) file.close();
if (!openGif(lastFilename)) {
gifDecodeFailed = true;
+3 -3
View File
@@ -94,7 +94,7 @@ void handleImprovPacket() {
case ImprovRPCType::Request_State: {
unsigned improvState = 0x02; //authorized
if (WLED_WIFI_CONFIGURED) improvState = 0x03; //provisioning
if (WLEDNetwork.isConnected()) improvState = 0x04; //provisioned
if (Network.isConnected()) improvState = 0x04; //provisioned
sendImprovStateResponse(improvState, false);
if (improvState == 0x04) sendImprovIPRPCResult(ImprovRPCType::Request_State);
break;
@@ -178,10 +178,10 @@ void sendImprovRPCResult(ImprovRPCType type, uint8_t n_strings, const char **str
}
void sendImprovIPRPCResult(ImprovRPCType type) {
if (WLEDNetwork.isConnected())
if (Network.isConnected())
{
char urlStr[64];
IPAddress localIP = WLEDNetwork.localIP();
IPAddress localIP = Network.localIP();
unsigned len = sprintf(urlStr, "http://%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
if (len > 24) return; //sprintf fail?
const char *str[1] = {urlStr};
+4 -4
View File
@@ -699,9 +699,7 @@ void serializeInfo(JsonObject root)
root[F("cn")] = F(WLED_CODENAME);
root[F("release")] = releaseString;
root[F("repo")] = repoString;
#if !defined(ARDUINO_ARCH_ESP32) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)) // ToDO: verify that this works correctly in V5
root[F("deviceId")] = getDeviceId();
#endif
JsonObject leds = root.createNestedObject(F("leds"));
leds[F("count")] = strip.getLengthTotal();
@@ -851,6 +849,8 @@ void serializeInfo(JsonObject root)
root[F("lwip")] = LWIP_VERSION_MAJOR;
#endif
// calling ESP.getFreeHeap() during led update causes glitches on C3 and possibly on 8266, too
strip.waitForLEDs(STRIP_WAIT_SHORT); // be nice, but not too nice. Waits up to 50ms. No need to suspend effects - ESP.getFreeHeap() will not need much time
root[F("freeheap")] = getFreeHeapSize();
#if defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM)
// Report PSRAM information
@@ -902,9 +902,9 @@ void serializeInfo(JsonObject root)
root[F("product")] = F(WLED_PRODUCT_NAME);
root["mac"] = escapedMac;
char s[16] = "";
if (WLEDNetwork.isConnected())
if (Network.isConnected())
{
IPAddress localIP = WLEDNetwork.localIP();
IPAddress localIP = Network.localIP();
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
}
root["ip"] = s;
+1 -3
View File
@@ -126,6 +126,7 @@ void stateUpdated(byte callMode) {
jsonTransitionOnce = false;
transitionActive = false;
applyFinalBri();
strip.trigger();
} else {
if (transitionActive) {
briOld = briT;
@@ -231,10 +232,7 @@ void handleNightlight() {
{
for (unsigned i=0; i<4; i++) colPri[i] = colNlT[i]+ ((colSec[i] - colNlT[i])*nper); // fading from actual color to secondary color
}
uint16_t transitionduration = strip.getTransition();
strip.setTransition(0); // temporary disable transition and set color & brightness directly, (hacky fix for #5620)
colorUpdated(CALL_MODE_NO_NOTIFY);
strip.setTransition(transitionduration); // restore transition time to previous value. Note: this needs proper fixing by disabling transitions completely in nightlight mode, reference implementation https://github.com/blazoncek/WLED/commit/c01a6b774969b652c30e383073958302042fd1f9
}
if (nper >= 1) //nightlight duration over
{
-50
View File
@@ -1,50 +0,0 @@
#include "wled.h"
#ifdef ESP32
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
#include "mbedtls/sha1.h"
#include "SHA1Builder.h"
// Wrapper functions to map mbedtls SHA1 calls to Arduino SHA1Builder
// This is needed because ESP-IDF 5.x disables SHA1 in mbedtls by default
struct mbedtls_sha1_context_wrapper {
SHA1Builder builder;
};
extern "C" {
void mbedtls_sha1_init(mbedtls_sha1_context *ctx) {
// Allocate wrapper
auto* wrapper = new mbedtls_sha1_context_wrapper();
*(void**)ctx = wrapper;
}
int mbedtls_sha1_starts(mbedtls_sha1_context *ctx) {
auto* wrapper = *(mbedtls_sha1_context_wrapper**)ctx;
wrapper->builder.begin();
return 0;
}
int mbedtls_sha1_update(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen) {
auto* wrapper = *(mbedtls_sha1_context_wrapper**)ctx;
wrapper->builder.add((const uint8_t*)input, ilen);
return 0;
}
int mbedtls_sha1_finish(mbedtls_sha1_context *ctx, unsigned char output[20]) {
auto* wrapper = *(mbedtls_sha1_context_wrapper**)ctx;
wrapper->builder.calculate();
wrapper->builder.getBytes(output);
return 0;
}
void mbedtls_sha1_free(mbedtls_sha1_context *ctx) {
auto* wrapper = *(mbedtls_sha1_context_wrapper**)ctx;
delete wrapper;
}
} // extern "C"
#endif
#endif
+5 -16
View File
@@ -148,10 +148,10 @@ const ethernet_settings ethernetBoards[] = {
// Gledopto Series With Ethernet
{
1, // eth_address,
5, // eth_power,
23, // eth_mdc,
33, // eth_mdio,
1, // eth_address,
5, // eth_power,
23, // eth_mdc,
33, // eth_mdio,
ETH_PHY_LAN8720, // eth_type,
ETH_CLOCK_GPIO0_IN // eth_clk_mode
},
@@ -257,16 +257,6 @@ bool initEthernet()
}
#endif
#if defined(ESP_IDF_VERSION) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
if (!ETH.begin( // parameter order in V5 has changed
(eth_phy_type_t) es.eth_type,
(int32_t) es.eth_address,
(int) es.eth_mdc,
(int) es.eth_mdio,
(int) es.eth_power,
(eth_clock_mode_t) es.eth_clk_mode
)) {
#else
if (!ETH.begin(
(uint8_t) es.eth_address,
(int) es.eth_power,
@@ -275,7 +265,6 @@ bool initEthernet()
(eth_phy_type_t) es.eth_type,
(eth_clock_mode_t) es.eth_clk_mode
)) {
#endif
DEBUG_PRINTLN(F("initE: ETH.begin() failed"));
// de-allocate the allocated pins
for (managed_pin_type mpt : pinsToAllocate) {
@@ -441,7 +430,7 @@ void WiFiEvent(WiFiEvent_t event)
DEBUG_PRINTF_P(PSTR("WiFi-E: AP Client Connected (%d) @ %lus.\n"), (int)apClients, millis()/1000);
break;
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
DEBUG_PRINT(F("WiFi-E: IP address: ")); DEBUG_PRINTLN(WLEDNetwork.localIP());
DEBUG_PRINT(F("WiFi-E: IP address: ")); DEBUG_PRINTLN(Network.localIP());
break;
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
// followed by IDLE and SCAN_DONE
+2 -10
View File
@@ -197,11 +197,7 @@ void handleNetworkTime()
if (millis() - ntpPacketSentTime > 10000)
{
#ifdef ARDUINO_ARCH_ESP32 // I had problems using udp.flush() on 8266
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
while (ntpUdp.parsePacket() > 0) ntpUdp.clear(); // flush() is deprecated in arduino-esp32 3.x.y
#else
while (ntpUdp.parsePacket() > 0) ntpUdp.flush(); // flush any existing packets
#endif
while (ntpUdp.parsePacket() > 0) ntpUdp.flush(); // flush any existing packets
#endif
if (!ntpServerIP.fromString(ntpServerName)) // check if server is IP or domain
{
@@ -290,11 +286,7 @@ static bool checkNTPResponse()
int cb = ntpUdp.parsePacket();
if (cb < NTP_MIN_PACKET_SIZE) {
#ifdef ARDUINO_ARCH_ESP32 // I had problems using udp.flush() on 8266
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
if (cb > 0) ntpUdp.clear(); // flush() is deprecated in arduino-esp32 3.x.y
#else
if (cb > 0) ntpUdp.flush(); // this avoids memory leaks on esp32
#endif
if (cb > 0) ntpUdp.flush(); // this avoids memory leaks on esp32
#endif
return false;
}
+4 -2
View File
@@ -13,8 +13,8 @@ constexpr size_t METADATA_OFFSET = 256; // ESP32: metadata appears afte
// Bootloader is at fixed offset 0x1000 (4KB), 0x0000 (0KB), or 0x2000 (8KB), and is typically 32KB
// Bootloader offsets for different MCUs => see https://github.com/wled/WLED/issues/5064
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32C61)
constexpr size_t BOOTLOADER_OFFSET = 0x0000; // esp32-S3, esp32-C3 and (future support) esp32-c6, esp32-c61
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
constexpr size_t BOOTLOADER_OFFSET = 0x0000; // esp32-S3, esp32-C3 and (future support) esp32-c6
constexpr size_t BOOTLOADER_SIZE = 0x8000; // 32KB, typical bootloader size
#define BOOTLOADER_OTA_UNSUPPORTED // still needs validation on these platforms.
#elif defined(CONFIG_IDF_TARGET_ESP32P4) || defined(CONFIG_IDF_TARGET_ESP32C5)
@@ -239,6 +239,7 @@ static bool beginOTA(AsyncWebServerRequest *request, UpdateContext* context)
UsermodManager::onUpdateBegin(true); // notify usermods that update is about to begin (some may require task de-init)
strip.suspend();
strip.waitForLEDs(STRIP_WAIT_MEDIUM, true); // always wait for LED transmissions to finish
backupConfig(); // backup current config in case the update ends badly
strip.resetSegments(); // free as much memory as you can
context->needsRestart = true;
@@ -759,6 +760,7 @@ bool initBootloaderOTA(AsyncWebServerRequest *request) {
#endif
lastEditTime = millis(); // make sure PIN does not lock during update
strip.suspend();
strip.waitForLEDs(STRIP_WAIT_SHORT, true); // be sure that LED transmissions have finished
strip.resetSegments();
// Check available heap before attempting allocation
@@ -76,7 +76,7 @@ bool ESPAsyncE131::initMulticast(uint16_t port, uint16_t universe, uint8_t n) {
ip4_addr_t ifaddr;
ip4_addr_t multicast_addr;
ifaddr.addr = static_cast<uint32_t>(WLEDNetwork.localIP());
ifaddr.addr = static_cast<uint32_t>(Network.localIP());
for (uint8_t i = 1; i < n; i++) {
multicast_addr.addr = static_cast<uint32_t>(IPAddress(239, 255,
(((universe + i) >> 8) & 0xff), (((universe + i) >> 0)
+8 -28
View File
@@ -18,14 +18,6 @@
#include "Arduino.h"
// dummy macro for 8266
#ifndef ARDUINO_ARCH_ESP32
#ifndef ESP_IDF_VERSION_VAL
#define ESP_IDF_VERSION_VAL(n1,n2,n3) 500
#define ESPALEXA_DEFINED_ESP_IDF_VERSION_VAL 1 // remember to undef this later
#endif
#endif
//you can use these defines for library config in your sketch. Just use them before #include <Espalexa.h>
//#define ESPALEXA_ASYNC
@@ -224,7 +216,7 @@ private:
void serveDescription()
{
EA_DEBUGLN("# Responding to description.xml ... #\n");
IPAddress localIP = WLEDNetwork.localIP();
IPAddress localIP = Network.localIP();
char s[16];
snprintf(s, sizeof(s), "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
char buf[1024];
@@ -260,10 +252,10 @@ private:
#ifdef ESPALEXA_ASYNC
if (serverAsync == nullptr) {
serverAsync = new AsyncWebServer(80);
serverAsync->onNotFound([this](AsyncWebServerRequest *request){server = request; serveNotFound();}); // fix: implicit capture of "this"
serverAsync->onNotFound([=](AsyncWebServerRequest *request){server = request; serveNotFound();});
}
serverAsync->onRequestBody([this](AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total){ // fix: implicit capture of "this"
serverAsync->onRequestBody([=](AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total){
char b[len +1];
b[len] = 0;
memcpy(b, data, len);
@@ -272,9 +264,9 @@ private:
EA_DEBUGLN(body);
});
#ifndef ESPALEXA_NO_SUBPAGE
serverAsync->on("/espalexa", HTTP_GET, [this](AsyncWebServerRequest *request){server = request; servePage();});
serverAsync->on("/espalexa", HTTP_GET, [=](AsyncWebServerRequest *request){server = request; servePage();});
#endif
serverAsync->on("/description.xml", HTTP_GET, [this](AsyncWebServerRequest *request){server = request; serveDescription();}); // fix: implicit capture of "this"
serverAsync->on("/description.xml", HTTP_GET, [=](AsyncWebServerRequest *request){server = request; serveDescription();});
serverAsync->begin();
#else
@@ -298,7 +290,7 @@ private:
//respond to UDP SSDP M-SEARCH
void respondToSearch()
{
IPAddress localIP = WLEDNetwork.localIP();
IPAddress localIP = Network.localIP();
char s[16];
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
@@ -358,7 +350,7 @@ public:
#ifdef ARDUINO_ARCH_ESP32
udpConnected = espalexaUdp.beginMulticast(IPAddress(239, 255, 255, 250), 1900);
#else
udpConnected = espalexaUdp.beginMulticast(WLEDNetwork.localIP(), IPAddress(239, 255, 255, 250), 1900);
udpConnected = espalexaUdp.beginMulticast(Network.localIP(), IPAddress(239, 255, 255, 250), 1900);
#endif
if (udpConnected){
@@ -393,11 +385,7 @@ public:
espalexaUdp.read(packetBuffer, packetSize);
packetBuffer[packetSize] = 0;
#if defined(ARDUINO_ARCH_ESP32) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
espalexaUdp.clear(); // flush() is deprecated in arduino-esp32 3.x.y
#else
espalexaUdp.flush();
#endif
espalexaUdp.flush();
if (!discoverable) return; //do not reply to M-SEARCH if not discoverable
const char* request = (const char *) packetBuffer;
@@ -645,12 +633,4 @@ public:
~Espalexa(){} //note: Espalexa is NOT meant to be destructed
};
// dummy macro cleanup
#ifndef ARDUINO_ARCH_ESP32
#ifdef ESPALEXA_DEFINED_ESP_IDF_VERSION_VAL
#undef ESP_IDF_VERSION_VAL
#undef ESPALEXA_DEFINED_ESP_IDF_VERSION_VAL
#endif
#endif
#endif
+7 -7
View File
@@ -1,6 +1,6 @@
#include "Network.h"
IPAddress WLEDNetworkClass::localIP()
IPAddress NetworkClass::localIP()
{
IPAddress localIP;
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
@@ -17,7 +17,7 @@ IPAddress WLEDNetworkClass::localIP()
return INADDR_NONE;
}
IPAddress WLEDNetworkClass::subnetMask()
IPAddress NetworkClass::subnetMask()
{
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
if (ETH.localIP()[0] != 0) {
@@ -30,7 +30,7 @@ IPAddress WLEDNetworkClass::subnetMask()
return IPAddress(255, 255, 255, 0);
}
IPAddress WLEDNetworkClass::gatewayIP()
IPAddress NetworkClass::gatewayIP()
{
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
if (ETH.localIP()[0] != 0) {
@@ -43,7 +43,7 @@ IPAddress WLEDNetworkClass::gatewayIP()
return INADDR_NONE;
}
void WLEDNetworkClass::localMAC(uint8_t* MAC)
void NetworkClass::localMAC(uint8_t* MAC)
{
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
// ETH.macAddress(MAC); // Does not work because of missing ETHClass:: in ETH.ccp
@@ -71,12 +71,12 @@ void WLEDNetworkClass::localMAC(uint8_t* MAC)
return;
}
bool WLEDNetworkClass::isConnected()
bool NetworkClass::isConnected()
{
return (WiFi.localIP()[0] != 0 && WiFi.status() == WL_CONNECTED) || isEthernet();
}
bool WLEDNetworkClass::isEthernet()
bool NetworkClass::isEthernet()
{
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
return (ETH.localIP()[0] != 0) && ETH.linkUp();
@@ -84,4 +84,4 @@ bool WLEDNetworkClass::isEthernet()
return false;
}
WLEDNetworkClass WLEDNetwork;
NetworkClass Network;
+2 -2
View File
@@ -8,7 +8,7 @@
#ifndef Network_h
#define Network_h
class WLEDNetworkClass
class NetworkClass
{
public:
IPAddress localIP();
@@ -19,6 +19,6 @@ public:
bool isEthernet();
};
extern WLEDNetworkClass WLEDNetwork;
extern NetworkClass Network;
#endif
+3 -3
View File
@@ -196,7 +196,7 @@ void notify(byte callMode, bool followUp)
#endif
{
DEBUG_PRINTLN(F("UDP sending packet."));
IPAddress broadcastIp = ~uint32_t(WLEDNetwork.subnetMask()) | uint32_t(WLEDNetwork.gatewayIP());
IPAddress broadcastIp = ~uint32_t(Network.subnetMask()) | uint32_t(Network.gatewayIP());
notifierUdp.beginPacket(broadcastIp, udpPort);
notifierUdp.write(udpOut, WLEDPACKETSIZE); // TODO: add actual used buffer size
notifierUdp.endPacket();
@@ -517,7 +517,7 @@ void handleNotifications()
}
}
localIP = WLEDNetwork.localIP();
localIP = Network.localIP();
//notifier and UDP realtime
if (!packetSize || packetSize > UDP_IN_MAXSIZE) return;
if (!isSupp && notifierUdp.remoteIP() == localIP) return; //don't process broadcasts we send ourselves
@@ -701,7 +701,7 @@ void sendSysInfoUDP()
{
if (!udp2Connected) return;
IPAddress ip = WLEDNetwork.localIP();
IPAddress ip = Network.localIP();
if (!ip || ip == IPAddress(255,255,255,255)) ip = IPAddress(4,3,2,1);
// TODO: make a nice struct of it and clean up
+2 -35
View File
@@ -14,11 +14,6 @@
#endif
#include "mbedtls/sha1.h" // for SHA1 on ESP32
#include "esp_efuse.h"
#include "esp_chip_info.h"
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "SHA1Builder.h"
#include <esp_mac.h> // V5 requirement
#endif
#endif
@@ -1273,8 +1268,6 @@ uint8_t perlin8(uint16_t x, uint16_t y, uint16_t z) {
return (((perlin3D_raw((uint32_t)x << 8, (uint32_t)y << 8, (uint32_t)z << 8, true) * 2015) >> 10) + 33168) >> 8; //scale to 16 bit, offset, then scale to 8bit
}
#if !defined(ARDUINO_ARCH_ESP32) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)) // ToDO: validate behaviour in V5
// Platform-agnostic SHA1 computation from String input
String computeSHA1(const String& input) {
#ifdef ESP8266
@@ -1284,19 +1277,11 @@ String computeSHA1(const String& input) {
unsigned char shaResult[20]; // SHA1 produces 20 bytes
mbedtls_sha1_context ctx;
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
mbedtls_sha1_init(&ctx);
mbedtls_sha1_starts_ret(&ctx);
mbedtls_sha1_update_ret(&ctx, (const unsigned char*)input.c_str(), input.length());
mbedtls_sha1_finish_ret(&ctx, shaResult);
mbedtls_sha1_free(&ctx);
#else
mbedtls_sha1_init(&ctx);
mbedtls_sha1_starts(&ctx);
mbedtls_sha1_update(&ctx, (const unsigned char*)input.c_str(), input.length());
mbedtls_sha1_finish(&ctx, shaResult);
mbedtls_sha1_free(&ctx);
#endif
// Convert to hexadecimal string
char hexString[41];
@@ -1310,32 +1295,20 @@ String computeSHA1(const String& input) {
}
#ifdef ESP32
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "esp_adc_cal.h" // deprecated API
//#include "esp_adc/adc_cali.h" // new API
//#include "esp_adc/adc_cali_scheme.h" // new API
#else
#include "esp_adc_cal.h"
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4,4,7) // backwards compatibility patch
#define ADC_ATTEN_DB_12 ADC_ATTEN_DB_11
#endif
#endif
String generateDeviceFingerprint() {
uint32_t fp[2] = {0, 0}; // create 64 bit fingerprint
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
esp_efuse_mac_get_default((uint8_t*)fp);
fp[1] ^= ESP.getFlashChipSize();
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
fp[0] ^= chip_info.full_revision | (chip_info.model << 16);
#else
fp[0] ^= chip_info.revision | (chip_info.model << 16);
#endif
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
// mix in ADC calibration data - legacy adc calibration API is not supported on new MCUs (-C5, -C6, -C61, -P4)
// mix in ADC calibration data:
esp_adc_cal_characteristics_t ch;
#if (SOC_ADC_MAX_BITWIDTH == 13) || (CONFIG_SOC_ADC_RTC_MAX_BITWIDTH == 13) // S2 has 13 bit ADC
#if SOC_ADC_MAX_BITWIDTH == 13 // S2 has 13 bit ADC
constexpr auto myBIT_WIDTH = ADC_WIDTH_BIT_13;
#else
constexpr auto myBIT_WIDTH = ADC_WIDTH_BIT_12;
@@ -1353,11 +1326,6 @@ String generateDeviceFingerprint() {
fp[1] ^= ch.high_curve[i];
}
}
#else
// some extra salt, instead of ADC calibration
fp[0] ^= chip_info.features | chip_info.cores << 16;
fp[1] ^= ESP.getFlashSourceFrequencyMHz() | ESP.getFlashClockDivider() << 8 ;
#endif
char fp_string[17]; // 16 hex chars + null terminator
sprintf(fp_string, "%08X%08X", fp[1], fp[0]);
return String(fp_string);
@@ -1395,5 +1363,4 @@ String getDeviceId() {
return cachedDeviceId;
}
#endif // V5/V6 workaround
+14 -24
View File
@@ -110,7 +110,7 @@ void WLED::loop()
{
if (apActive) dnsServer.processNextRequest();
#ifdef WLED_ENABLE_AOTA
if (WLEDNetwork.isConnected() && aOtaEnabled && !otaLock && correctPIN) ArduinoOTA.handle();
if (Network.isConnected() && aOtaEnabled && !otaLock && correctPIN) ArduinoOTA.handle();
#endif
handleNightlight();
yield();
@@ -174,12 +174,9 @@ void WLED::loop()
#ifdef ESP8266
uint32_t heap = getFreeHeapSize(); // ESP8266 needs ~8k of free heap for UI to work properly
#else
#ifdef CONFIG_IDF_TARGET_ESP32C3
// calling getContiguousFreeHeap() during led update causes glitches on C3
// this can (probably) be removed once RMT driver for C3 is fixed
unsigned t0 = millis();
while (strip.isUpdating() && (millis() - t0 < 150)) delay(1); // be nice, but not too nice. Waits up to 150ms
#endif
strip.waitForLEDs(STRIP_WAIT_MEDIUM); // be nice, but not too nice. Waits up to 150ms - we are in the main loop, so a new strip.show() cannot start while waiting
uint32_t heap = getContiguousFreeHeap(); // ESP32 family needs ~10k of contiguous free heap for UI to work properly
#endif
if (heap < MIN_HEAP_SIZE - 1024) heapDanger+=5; // allow 1k of "wiggle room" for things that do not respect min heap limits
@@ -312,7 +309,7 @@ void WLED::loop()
lastWifiState = WiFi.status();
DEBUG_PRINTF_P(PSTR("State time: %lu\n"), wifiStateChangedTime);
DEBUG_PRINTF_P(PSTR("NTP last sync: %lu\n"), ntpLastSyncTime);
DEBUG_PRINTF_P(PSTR("Client IP: %u.%u.%u.%u\n"), WLEDNetwork.localIP()[0], WLEDNetwork.localIP()[1], WLEDNetwork.localIP()[2], WLEDNetwork.localIP()[3]);
DEBUG_PRINTF_P(PSTR("Client IP: %u.%u.%u.%u\n"), Network.localIP()[0], Network.localIP()[1], Network.localIP()[2], Network.localIP()[3]);
if (loops > 0) { // avoid division by zero
DEBUG_PRINTF_P(PSTR("Loops/sec: %u\n"), loops / 30);
DEBUG_PRINTF_P(PSTR("Loop time[ms]: %u/%lu\n"), avgLoopMillis/loops, maxLoopMillis);
@@ -494,6 +491,7 @@ void WLED::setup()
DEBUG_PRINTLN(F("Initializing strip"));
beginStrip();
strip.waitForLEDs(STRIP_WAIT_MEDIUM); // prevent flickering - beginStrip() calls strip.show()
DEBUG_PRINTF_P(PSTR("heap %u\n"), getFreeHeapSize());
DEBUG_PRINTLN(F("Usermods setup"));
@@ -590,9 +588,7 @@ void WLED::setup()
#endif
#if defined(ARDUINO_ARCH_ESP32) && defined(LWIP_IPV6)
#if ESP_IDF_VERSION_MAJOR < 5 // ToDO: clarify if esp-idf v5.x still needs this patch
installIPv6RABlocker(); // Work around unsolicited RA overwriting IPv4 DNS servers
#endif
#endif
#if WLED_WATCHDOG_TIMEOUT > 0
@@ -600,7 +596,7 @@ void WLED::setup()
#endif
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DISABLE_BROWNOUT_DET)
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1); //enable brownout detector
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1); //re-enable brownout detector
#endif
markOTAvalid();
}
@@ -720,16 +716,10 @@ void WLED::initConnection()
WiFi.setHostname(hostname);
#endif
if (multiWiFi.empty()) { // guard: handle empty WiFi list safely
WiFi.config(IPAddress((uint32_t)0), IPAddress((uint32_t)0), IPAddress((uint32_t)0));
if (multiWiFi[selectedWiFi].staticIP != 0U && multiWiFi[selectedWiFi].staticGW != 0U) {
WiFi.config(multiWiFi[selectedWiFi].staticIP, multiWiFi[selectedWiFi].staticGW, multiWiFi[selectedWiFi].staticSN, dnsAddress);
} else {
if (selectedWiFi >= multiWiFi.size()) selectedWiFi = 0; // guard: ensure valid index
if (multiWiFi[selectedWiFi].staticIP != IPAddress((uint32_t)0) &&
multiWiFi[selectedWiFi].staticGW != IPAddress((uint32_t)0)) { // guard: compare as IPAddress to avoid pointer overload
WiFi.config(multiWiFi[selectedWiFi].staticIP, multiWiFi[selectedWiFi].staticGW, multiWiFi[selectedWiFi].staticSN, dnsAddress);
} else {
WiFi.config(IPAddress((uint32_t)0), IPAddress((uint32_t)0), IPAddress((uint32_t)0));
}
WiFi.config(IPAddress((uint32_t)0), IPAddress((uint32_t)0), IPAddress((uint32_t)0));
}
lastReconnectAttempt = millis();
@@ -839,7 +829,7 @@ void WLED::initInterfaces()
DEBUG_PRINTLN(F("Init STA interfaces"));
#ifndef WLED_DISABLE_HUESYNC
IPAddress ipAddress = WLEDNetwork.localIP();
IPAddress ipAddress = Network.localIP();
if (hueIP[0] == 0) {
hueIP[0] = ipAddress[0];
hueIP[1] = ipAddress[1];
@@ -925,7 +915,7 @@ void WLED::handleConnection()
if (stac != stacO) {
stacO = stac;
DEBUG_PRINTF_P(PSTR("Connected AP clients: %d\n"), (int)stac);
if (!WLEDNetwork.isConnected() && wifiConfigured) { // trying to connect, but not connected
if (!Network.isConnected() && wifiConfigured) { // trying to connect, but not connected
if (stac)
WiFi.disconnect(); // disable search so that AP can work
else
@@ -934,7 +924,7 @@ void WLED::handleConnection()
}
}
if (!WLEDNetwork.isConnected()) {
if (!Network.isConnected()) {
if (interfacesInited) {
if (scanDone && multiWiFi.size() > 1) {
DEBUG_PRINTLN(F("WiFi scan initiated on disconnect."));
@@ -978,7 +968,7 @@ void WLED::handleConnection()
} else if (!interfacesInited) { //newly connected
DEBUG_PRINTLN();
DEBUG_PRINT(F("Connected! IP address: "));
DEBUG_PRINTLN(WLEDNetwork.localIP());
DEBUG_PRINTLN(Network.localIP());
#ifdef ARDUINO_ARCH_ESP32
esp_wifi_set_storage(WIFI_STORAGE_RAM); // disable further updates of NVM credentials to prevent wear on flash (same as WiFi.persistent(false) but updates immediately, arduino wifi deficiency workaround)
#endif
@@ -1003,7 +993,7 @@ void WLED::handleConnection()
}
// If status LED pin is allocated for other uses, does nothing
// else blink at 1Hz when WLEDNetwork.isConnected() is false (no WiFi, ?? no Ethernet ??)
// else blink at 1Hz when Network.isConnected() is false (no WiFi, ?? no Ethernet ??)
// else blink at 2Hz when MQTT is enabled but not connected
// else turn the status LED off
#if defined(STATUSLED)
@@ -1017,7 +1007,7 @@ void WLED::handleStatusLED()
}
#endif
if (WLEDNetwork.isConnected()) {
if (Network.isConnected()) {
c = RGBW32(0,255,0,0);
ledStatusType = 2;
} else if (WLED_MQTT_CONNECTED) {
+1 -13
View File
@@ -75,18 +75,6 @@
// Library inclusions.
#include <Arduino.h>
// buildenv sanity check
#if !defined(ESP32) && !defined(ESP8266)
#error neither ESP32 nor ESP8266 defined. Please fix your build environment.
#endif
#if defined(ESP8266) && (defined(ARDUINO_ARCH_ESP32) || defined(ESP32))
#error both ESP8266 and ESP32/ARDUINO_ARCH_ESP32 defined. Please fix your build environment.
#endif
#if (defined(ARDUINO_ARCH_ESP32) && !defined(ESP32)) || (defined(ESP32) && !defined(ARDUINO_ARCH_ESP32))
#error either ESP32 or ARDUINO_ARCH_ESP32 not defined. Please fix your build environment.
#endif
#ifdef ESP8266
#include <ESP8266WiFi.h>
#ifdef WLED_ENABLE_WPA_ENTERPRISE
@@ -1035,7 +1023,7 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
WLED_GLOBAL unsigned loops _INIT(0);
#endif
#define WLED_CONNECTED (WLEDNetwork.isConnected())
#define WLED_CONNECTED (Network.isConnected())
#ifndef WLED_AP_SSID_UNIQUE
#define WLED_SET_AP_SSID() do { \
+8 -1
View File
@@ -60,7 +60,7 @@ static bool inSubnet(const IPAddress &ip, const IPAddress &subnet, const IPAddre
}
static bool inSameSubnet(const IPAddress &client) {
return inSubnet(client, WLEDNetwork.localIP(), WLEDNetwork.subnetMask());
return inSubnet(client, Network.localIP(), Network.subnetMask());
}
static bool inLocalSubnet(const IPAddress &client) {
@@ -212,7 +212,14 @@ static void handleUpload(AsyncWebServerRequest *request, const String& filename,
request->_tempFile.write(data,len);
}
if (isFinal) {
bool haveSuspended = false;
#if defined(WLED_USE_SHARED_RMT) || defined(__riscv) || !defined(ARDUINO_ARCH_ESP32)
if (!strip.isSuspended()) { strip.suspend(); haveSuspended = true; } // prevent that a new strip.show() starts after waiting
strip.waitForLEDs(STRIP_WAIT_SHORT, true); // calling file.close() during LEDs sendout can cause glitches on C3 and on 8266
#endif
request->_tempFile.close();
if (haveSuspended) strip.resume();
if (filename.indexOf(F("cfg.json")) >= 0) { // check for filename with or without slash
doReboot = true;
request->send(200, FPSTR(CONTENT_TYPE_PLAIN), F("Config restore ok.\nRebooting..."));
+1
View File
@@ -153,6 +153,7 @@ void sendDataWs(AsyncWebSocketClient * client)
DEBUG_PRINTF_P(PSTR("JSON buffer size: %u for WS request (%u).\n"), pDoc->memoryUsage(), len);
// the following may no longer be necessary as heap management has been fixed by @willmmiles in AWS
strip.waitForLEDs(STRIP_WAIT_VERYSHORT); // wait for LEDs ouptut to finish - prevents glitches on -C3
size_t heap1 = getFreeHeapSize();
DEBUG_PRINTF_P(PSTR("heap %u\n"), getFreeHeapSize());
AsyncWebSocketBuffer buffer(len);
+3 -3
View File
@@ -295,14 +295,14 @@ void getSettingsJS(byte subPage, Print& settingsScript)
settingsScript.print(F("gId('ethd').style.display='none';"));
#endif
if (WLEDNetwork.isConnected()) //is connected
if (Network.isConnected()) //is connected
{
char s[32];
IPAddress localIP = WLEDNetwork.localIP();
IPAddress localIP = Network.localIP();
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
if (WLEDNetwork.isEthernet()) strcat_P(s ,PSTR(" (Ethernet)"));
if (Network.isEthernet()) strcat_P(s ,PSTR(" (Ethernet)"));
#endif
printSetClassElementHTML(settingsScript,PSTR("sip"),0,s);
} else