see https://github.com/espressif/arduino-esp32/issues/9043
"
The S3, C3, C6 and H2 that have HW CDC JTAG USB port may cause a delay when using HWCDC in Serial by activating CDC on Boot and selecting the USB Mode for Hardware CDC and JTAG. This happens when no USB application in USB Host side is started to receive the data sent by the ESP32xx.
The USB CDC buffer gets full and the Arduino HW CDC layer will timeout, by default 100ms, until give up trying to send the CDC data.
As a workaround, it is necessary to use HWCDC::setTxTimeoutMs(timeout_ms) and set it to zero.
"
this avoids heap corruption, by double-checking that "use global leds" is not configured, before trying to free ledsrgb[].
It is still a mystery why Segment::_globalLeds == nullptr.
sunset = 0 is a valid result, as the function result is in UTC and not local time .
Example: local time is UTC-8, local sunrise = 08:00am => getSunriseUTC() = 0.
So we cannot use "0" for "invalid". Using UINT16_MAX resolves the problem, and even allows to simplify calculateSunriseAndSunset() a bit.
-DALL_JSON_TO_PSRAM -DBOARD_HAS_PSRAM -D WLED_USE_PSRAM_JSON
on -S2, this *doubles* the PSRAM utilization!
before: heap used 85%, PSRAM used 13kb / 21kb
after: heap used 60%, PSRAM used 41kb / 65kb !!
Its not enough to declare "doc" as DynamicJsonPSRAMDocument - PSRAM is not yet initialized when "doc" is created. So we need a trick to get the main doc into PSRAM later, during WLED::setup().
Code is very experimental, may or may not work, and need more testing
-> disabled with "#if 0"
if random palette was used in the startup preset, all LEDs were orange until the first palette cycling happened.
This fix ensures that there is no all-orange palette initially.
According to the technical manual, GPIO 16 + 17 are used for onboard flash, so cannot be used by WLED.
example buildenv:
[env:esp32_pico]
extends = env:esp32dev_qio80
board = pico32
I've found a code spellchecker, so this is what can be corrected easily. Changes are only affecting comments, readme and a few user-visible strings. So no functional impact expected.