diff --git a/wled00/FX.h b/wled00/FX.h index 3aeca57124..79dba51751 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{BLACK,BLACK,BLACK} // set colors to black, will be updated to orange if segment is created as "auto segment" or from UI , start(sStart) , stop(sStop > sStart ? sStop : sStart+1) // minimum length is 1 , startY(sStartY) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 69a6152c01..7b217a0116 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1991,6 +1991,9 @@ void WS2812FX::makeAutoSegments(bool forceReset) { for (size_t i = 1; i < s; i++) { _segments.emplace_back(segStarts[i], segStops[i]); } + for (size_t i = 0; i < _segments.size(); i++) { + _segments[i].colors[0] = DEFAULT_COLOR; // set color to default orange on all segments + } DEBUGFX_PRINTF_P(PSTR("%d auto segments created.\n"), _segments.size()); } else { diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index f1471e9bf4..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:
- with brightness: (1-255)
- (disable if using boot preset to turn LEDs on)

+ Bootup brightness: (1-255)

Apply preset at boot (0 = none)

diff --git a/wled00/json.cpp b/wled00/json.cpp index b4388d27ef..535d0ed490 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -85,6 +85,9 @@ static bool deserializeSegment(JsonObject elem, byte it, byte presetId = 0) //DEBUG_PRINTLN(F("-- JSON deserialize segment.")); Segment& seg = strip.getSegment(id); + if (newSeg && presetId == 0) { + seg.colors[0] = DEFAULT_COLOR; // set color of newly created segment to warm orange as an indicator to the user + } // we do not want to make segment copy as it may use a lot of RAM (effect data and pixel buffer) // so we will create a copy of segment options and compare it with original segment when done processing SegmentCopy prev = { diff --git a/wled00/wled.cpp b/wled00/wled.cpp index e91fcca8f5..59559210b9 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -616,31 +616,35 @@ 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) + colorUpdated(CALL_MODE_INIT); // set bootup brightness immediately, do not send notification (brightness is also set for preset if used, useful for swipe etc.) + 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] = R(DEFAULT_COLOR); + colPri[1] = G(DEFAULT_COLOR); + colPri[2] = B(DEFAULT_COLOR); + colPri[3] = W(DEFAULT_COLOR); + } - strip.setTransition(transitionDelayDefault); // restore transitions + strip.setTransition(transitionDelayDefault); // restore default transition time + colorUpdated(CALL_MODE_INIT); // apply color & initiate transition, do not send notification } 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);