Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 bootupTime = 2000; // 2s should be more than enough to init bootup-segments to black
#ifdef WLED_BOOTUPDELAY
bootupTime += WLED_BOOTUPDELAY;
#endif
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<uint32_t*>(allocate_buffer(length() * sizeof(uint32_t), BFRALLOC_PREFER_PSRAM | BFRALLOC_NOBYTEACCESS | BFRALLOC_CLEAR));
if (!pixels) {
Expand Down
3 changes: 1 addition & 2 deletions wled00/data/settings_leds.htm
Original file line number Diff line number Diff line change
Expand Up @@ -1126,8 +1126,7 @@ <h2>General settings</h2>
<div class="sec">
<h3>Power up</h3>
Turn LEDs on after power up/reset: <input type="checkbox" name="BO"><br>
with brightness: <input name="CA" type="number" class="m" min="1" max="255" required> (1-255)<br>
<i>(disable if using boot preset to turn LEDs on)</i><br><br>
Bootup brightness: <input name="CA" type="number" class="m" min="1" max="255" required> (1-255)<br><br>
Apply preset <input name="BP" type="number" class="m" min="0" max="250" required> at boot (0 = none)<br><br>
</div>
<div class="sec">
Expand Down
38 changes: 20 additions & 18 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,31 +616,33 @@ 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

// 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)
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; // load startup brightness (set in UI), 0 is not allowed in UI
}
colorUpdated(CALL_MODE_INIT); // will not send notification but will initiate transition
else briLast = briS; // go to startup brightness (set in UI) when turning on (can be overruled by a preset)

if (bootPreset > 0) {
applyPreset(bootPreset, CALL_MODE_INIT);
}
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 transitions
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)
Expand Down
4 changes: 2 additions & 2 deletions wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading