From e7a547bf4f7bef6acfb01900ae125b9a77aef143 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Wed, 17 Jun 2026 02:39:55 +0200 Subject: [PATCH 1/8] improve bootup behaviour for presets --- wled00/FX.h | 10 ++++++++-- wled00/data/settings_leds.htm | 2 +- wled00/wled.cpp | 37 +++++++++++++++++------------------ wled00/wled.h | 4 ++-- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/wled00/FX.h b/wled00/FX.h index 3aeca57124..be6fd1fa33 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -42,7 +42,7 @@ #define DEFAULT_MODE (uint8_t)0 #define DEFAULT_SPEED (uint8_t)128 #define DEFAULT_INTENSITY (uint8_t)128 -#define DEFAULT_COLOR (uint32_t)0xFFAA00 +#define DEFAULT_COLOR (uint32_t)0xFFA000 #define DEFAULT_C1 (uint8_t)128 #define DEFAULT_C2 (uint8_t)128 #define DEFAULT_C3 (uint8_t)16 @@ -562,7 +562,7 @@ class Segment { public: Segment(uint16_t sStart=0, uint16_t sStop=30, uint16_t sStartY = 0, uint16_t sStopY = 1) - : colors{DEFAULT_COLOR,BLACK,BLACK} + : colors{DEFAULT_COLOR,BLACK,BLACK} // create "warm orange" segment by default , start(sStart) , stop(sStop > sStart ? sStop : sStart+1) // minimum length is 1 , startY(sStartY) @@ -596,6 +596,12 @@ class Segment { , _t(nullptr) { DEBUGFX_PRINTF_P(PSTR("-- Creating segment: %p [%d,%d:%d,%d]\n"), this, (int)start, (int)stop, (int)startY, (int)stopY); + uint32_t bootTimeDelay = 5000; + #ifdef WLED_BOOTUPDELAY + bootTimeDelay += WLED_BOOTUPDELAY + #endif + if (millis() < bootTimeDelay) + colors[0] = BLACK; // at bootup create black segments so boot-up fade-in does not fade to orange // allocate render buffer (always entire segment), prefer PSRAM if DRAM is running low. Note: impact on FPS with PSRAM buffer is low (<2% with QSPI PSRAM) pixels = static_cast(allocate_buffer(length() * sizeof(uint32_t), BFRALLOC_PREFER_PSRAM | BFRALLOC_NOBYTEACCESS | BFRALLOC_CLEAR)); if (!pixels) { diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index f1471e9bf4..90d7d7fedd 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -1126,7 +1126,7 @@

General settings

Power up

Turn LEDs on after power up/reset:
- with brightness: (1-255)
+ Bootup brightness: (1-255)
(disable if using boot preset to turn LEDs on)

Apply preset at boot (0 = none)

diff --git a/wled00/wled.cpp b/wled00/wled.cpp index e91fcca8f5..3f5855b2c1 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -616,31 +616,30 @@ void WLED::beginStrip() // init offMode and relay offMode = false; // init to on state to allow proper relay init handleOnOff(true); // init relay and force off - + if (rlyPin < 0) strip.show(); // ensure LEDs are off if no relay is used + bri = 0; // start off black by default (on a fresh install this is overruled by briS as turnOnAtBoot is true) if (turnOnAtBoot) { - if (briS > 0) bri = briS; - else if (bri == 0) bri = 128; - } else { - // fix for #3196 - if (bootPreset > 0) { - // set all segments black (no transition) - for (unsigned i = 0; i < strip.getSegmentsNum(); i++) { - Segment &seg = strip.getSegment(i); - if (seg.isActive()) seg.colors[0] = BLACK; - } - colPri[0] = colPri[1] = colPri[2] = colPri[3] = 0; // needed for colorUpdated() - } - briLast = briS; bri = 0; - strip.fill(BLACK); - if (rlyPin < 0) - strip.show(); // ensure LEDs are off if no relay is used + bri = briS ? briS : 128; // load startup brightness (set in UI), fall back to mid if set to 0 to make sure LEDs turn on + // set color to warm welcoming orange (aka DEFAULT_COLOR) + colPri[0] = 255; + colPri[1] = 160; + colPri[2] = colPri[3] = 0; } - colorUpdated(CALL_MODE_INIT); // will not send notification but will initiate transition + if (bootPreset > 0) { + colPri[0] = colPri[1] = colPri[2] = colPri[3] = 0; // needed for colorUpdated() applyPreset(bootPreset, CALL_MODE_INIT); + // set all segments black (no transition), their default creation color is orange (which is needed for creating new segments in the UI) + for (unsigned i = 0; i < strip.getSegmentsNum(); i++) { + Segment &seg = strip.getSegment(i); + if (seg.isActive()) seg.colors[0] = BLACK; + } } + else + strip.setTransition(transitionDelayDefault); // restore default transition time (was set to 0 above) + + colorUpdated(CALL_MODE_INIT); // will not send notification but will initiate transition, if still zero, brightness is set immediately - strip.setTransition(transitionDelayDefault); // restore transitions } void WLED::initAP(bool resetAP) diff --git a/wled00/wled.h b/wled00/wled.h index eb2df1875e..23c1995edf 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -413,8 +413,8 @@ WLED_GLOBAL bool gammaCorrectCol _INIT(true); // use gamma correction on col WLED_GLOBAL bool gammaCorrectBri _INIT(false); // use gamma correction on brightness WLED_GLOBAL float gammaCorrectVal _INIT(2.2f); // gamma correction value -WLED_GLOBAL byte colPri[] _INIT_N(({ 255, 160, 0, 0 })); // current RGB(W) primary color. colPri[] should be updated if you want to change the color. -WLED_GLOBAL byte colSec[] _INIT_N(({ 0, 0, 0, 0 })); // current RGB(W) secondary color +WLED_GLOBAL byte colPri[] _INIT_N(({ 0, 0, 0, 0 })); // current RGB(W) primary color. colPri[] should be updated if you want to change the color. +WLED_GLOBAL byte colSec[] _INIT_N(({ 0, 0, 0, 0 })); // current RGB(W) secondary color WLED_GLOBAL byte nightlightTargetBri _INIT(0); // brightness after nightlight is over WLED_GLOBAL byte nightlightDelayMins _INIT(60); From 598e08cf4b2415d222c180eb890ee9d2d421adce Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Wed, 17 Jun 2026 02:55:28 +0200 Subject: [PATCH 2/8] bugfix --- wled00/FX.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX.h b/wled00/FX.h index be6fd1fa33..f19edb2793 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -598,7 +598,7 @@ class Segment { DEBUGFX_PRINTF_P(PSTR("-- Creating segment: %p [%d,%d:%d,%d]\n"), this, (int)start, (int)stop, (int)startY, (int)stopY); uint32_t bootTimeDelay = 5000; #ifdef WLED_BOOTUPDELAY - bootTimeDelay += WLED_BOOTUPDELAY + bootTimeDelay += WLED_BOOTUPDELAY; #endif if (millis() < bootTimeDelay) colors[0] = BLACK; // at bootup create black segments so boot-up fade-in does not fade to orange From 9b03b7826308f066b6e21db2aefffacc710c67da Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Fri, 19 Jun 2026 21:02:28 +0200 Subject: [PATCH 3/8] fix various cases and add description --- wled00/wled.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 3f5855b2c1..1a6bbeb43d 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -617,26 +617,36 @@ void WLED::beginStrip() offMode = false; // init to on state to allow proper relay init handleOnOff(true); // init relay and force off if (rlyPin < 0) strip.show(); // ensure LEDs are off if no relay is used + // note on how bootup behaviour: + // if turnOnAtBoot is false, strip is set to black. It will fade in to startup brightness and orange when turned on + // if a bootup preset is set, it will fade to that preset if it has on:true set (to default brightness) or to that preset's brightness if set + // if turnOnAtBoot is true the LEDs will fade in to orange and default brightness + // if a booup preset is set, it will start at the default brightness except if "fade" transition is used, then it will still fade from black + // there is no way to have LEDs off at boot and upon turn-on have them immediatel jump to a target brightness but users can use a playlist to do that + bri = 0; // start off black by default (on a fresh install this is overruled by briS as turnOnAtBoot is true) if (turnOnAtBoot) { - bri = briS ? briS : 128; // load startup brightness (set in UI), fall back to mid if set to 0 to make sure LEDs turn on - // set color to warm welcoming orange (aka DEFAULT_COLOR) - colPri[0] = 255; - colPri[1] = 160; - colPri[2] = colPri[3] = 0; + bri = briS; // load startup brightness (set in UI), 0 is not allowed in UI } + else briLast = briS; // go to startup brightness (set in UI) when turning on (can be overruled by a preset) if (bootPreset > 0) { colPri[0] = colPri[1] = colPri[2] = colPri[3] = 0; // needed for colorUpdated() applyPreset(bootPreset, CALL_MODE_INIT); - // set all segments black (no transition), their default creation color is orange (which is needed for creating new segments in the UI) + // note: if turn on at boot is disabled, preset will fade in from black, even if swipe is used + // if fade is used, it will always fade from black. for (unsigned i = 0; i < strip.getSegmentsNum(); i++) { Segment &seg = strip.getSegment(i); if (seg.isActive()) seg.colors[0] = BLACK; } } - else + else { + // set color to warm welcoming orange (aka DEFAULT_COLOR) if no preset loaded (will fade to this color once turned on) + colPri[0] = 255; + colPri[1] = 160; + colPri[2] = colPri[3] = 0; strip.setTransition(transitionDelayDefault); // restore default transition time (was set to 0 above) + } colorUpdated(CALL_MODE_INIT); // will not send notification but will initiate transition, if still zero, brightness is set immediately From 83cdb46f9581462fd222c8f4f648ff4252d4a566 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sat, 20 Jun 2026 07:36:28 +0200 Subject: [PATCH 4/8] typo --- wled00/wled.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 1a6bbeb43d..74bb4ca6fb 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -621,7 +621,7 @@ void WLED::beginStrip() // if turnOnAtBoot is false, strip is set to black. It will fade in to startup brightness and orange when turned on // if a bootup preset is set, it will fade to that preset if it has on:true set (to default brightness) or to that preset's brightness if set // if turnOnAtBoot is true the LEDs will fade in to orange and default brightness - // if a booup preset is set, it will start at the default brightness except if "fade" transition is used, then it will still fade from black + // if a bootup preset is set, it will start at the default brightness except if "fade" transition is used, then it will still fade from black // there is no way to have LEDs off at boot and upon turn-on have them immediatel jump to a target brightness but users can use a playlist to do that bri = 0; // start off black by default (on a fresh install this is overruled by briS as turnOnAtBoot is true) From 943f70c3f66b04ca2a94b1b338d6f71348fa5453 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sat, 20 Jun 2026 09:31:47 +0200 Subject: [PATCH 5/8] cleanup --- wled00/FX.h | 8 ++++---- wled00/wled.cpp | 7 ------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/wled00/FX.h b/wled00/FX.h index f19edb2793..85201969cb 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -596,12 +596,12 @@ class Segment { , _t(nullptr) { DEBUGFX_PRINTF_P(PSTR("-- Creating segment: %p [%d,%d:%d,%d]\n"), this, (int)start, (int)stop, (int)startY, (int)stopY); - uint32_t bootTimeDelay = 5000; + uint32_t bootupTime = 2000; // 2s should be more than enough to init bootup-segments to black #ifdef WLED_BOOTUPDELAY - bootTimeDelay += WLED_BOOTUPDELAY; + bootupTime += WLED_BOOTUPDELAY; #endif - if (millis() < bootTimeDelay) - colors[0] = BLACK; // at bootup create black segments so boot-up fade-in does not fade to orange + if (millis() < bootupTime) + colors[0] = BLACK; // at bootup create black segments so boot-up fade-in does not turn to orange for presets // allocate render buffer (always entire segment), prefer PSRAM if DRAM is running low. Note: impact on FPS with PSRAM buffer is low (<2% with QSPI PSRAM) pixels = static_cast(allocate_buffer(length() * sizeof(uint32_t), BFRALLOC_PREFER_PSRAM | BFRALLOC_NOBYTEACCESS | BFRALLOC_CLEAR)); if (!pixels) { diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 74bb4ca6fb..56d065d39b 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -631,14 +631,7 @@ void WLED::beginStrip() else briLast = briS; // go to startup brightness (set in UI) when turning on (can be overruled by a preset) if (bootPreset > 0) { - colPri[0] = colPri[1] = colPri[2] = colPri[3] = 0; // needed for colorUpdated() applyPreset(bootPreset, CALL_MODE_INIT); - // note: if turn on at boot is disabled, preset will fade in from black, even if swipe is used - // if fade is used, it will always fade from black. - for (unsigned i = 0; i < strip.getSegmentsNum(); i++) { - Segment &seg = strip.getSegment(i); - if (seg.isActive()) seg.colors[0] = BLACK; - } } else { // set color to warm welcoming orange (aka DEFAULT_COLOR) if no preset loaded (will fade to this color once turned on) From fb5780bb549b6c0ec12bbfe272f98760cb5dad3f Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sat, 20 Jun 2026 09:35:43 +0200 Subject: [PATCH 6/8] remove obsolete UI comment --- wled00/data/settings_leds.htm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 90d7d7fedd..72a12b53d4 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -1126,8 +1126,7 @@

General settings

Power up

Turn LEDs on after power up/reset:
- Bootup brightness: (1-255)
- (disable if using boot preset to turn LEDs on)

+ Bootup brightness: (1-255)

Apply preset at boot (0 = none)

From 37bfe772b9d1889acd58299f49e7dac9f99b468d Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sat, 20 Jun 2026 09:45:27 +0200 Subject: [PATCH 7/8] clarify comment --- wled00/wled.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 56d065d39b..6b39bdb260 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -617,11 +617,11 @@ void WLED::beginStrip() offMode = false; // init to on state to allow proper relay init handleOnOff(true); // init relay and force off if (rlyPin < 0) strip.show(); // ensure LEDs are off if no relay is used - // note on how bootup behaviour: - // if turnOnAtBoot is false, strip is set to black. It will fade in to startup brightness and orange when turned on - // if a bootup preset is set, it will fade to that preset if it has on:true set (to default brightness) or to that preset's brightness if set - // if turnOnAtBoot is true the LEDs will fade in to orange and default brightness - // if a bootup preset is set, it will start at the default brightness except if "fade" transition is used, then it will still fade from black + // note on how bootup behaviour works: + // if turnOnAtBoot is false: strip is set to black. It will fade in to startup brightness and orange when turned on + // if a bootup preset is set, it will fade to that preset if it has "on:true" set (to default brightness) or to that preset's brightness if set + // if turnOnAtBoot is true: the LEDs will fade in to orange and default brightness + // if a bootup preset is set, it will start at the default brightness except if "fade" transition is used, then it will still fade from black // there is no way to have LEDs off at boot and upon turn-on have them immediatel jump to a target brightness but users can use a playlist to do that bri = 0; // start off black by default (on a fresh install this is overruled by briS as turnOnAtBoot is true) From e6a21754df0cd35be75861b668e6e14b9053125b Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sat, 20 Jun 2026 10:43:34 +0200 Subject: [PATCH 8/8] always apply default transition --- wled00/wled.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 6b39bdb260..9b40a70a9f 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -617,7 +617,8 @@ void WLED::beginStrip() offMode = false; // init to on state to allow proper relay init handleOnOff(true); // init relay and force off if (rlyPin < 0) strip.show(); // ensure LEDs are off if no relay is used - // note on how bootup behaviour works: + + // Note on how bootup behaviour works: // if turnOnAtBoot is false: strip is set to black. It will fade in to startup brightness and orange when turned on // if a bootup preset is set, it will fade to that preset if it has "on:true" set (to default brightness) or to that preset's brightness if set // if turnOnAtBoot is true: the LEDs will fade in to orange and default brightness @@ -638,11 +639,10 @@ void WLED::beginStrip() colPri[0] = 255; colPri[1] = 160; colPri[2] = colPri[3] = 0; - strip.setTransition(transitionDelayDefault); // restore default transition time (was set to 0 above) } - colorUpdated(CALL_MODE_INIT); // will not send notification but will initiate transition, if still zero, brightness is set immediately - + colorUpdated(CALL_MODE_INIT); // will not send notification but will initiate transition, brightness is set immediately + strip.setTransition(transitionDelayDefault); // restore default transition time } void WLED::initAP(bool resetAP)