diff --git a/wled00/FX.h b/wled00/FX.h index e3c170f7..622bda22 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -650,6 +650,7 @@ class WS2812FX { void handle_palette(void); bool + shouldStartBus = false, _useRgbw = false, _skipFirstMode, _triggered; diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 56fdb98a..ad459aba 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -396,6 +396,18 @@ void WS2812FX::setBrightness(uint8_t b) { { _segments[i].setOption(SEG_OPTION_FREEZE, false); } + #if LEDPIN == LED_BUILTIN + if (!shouldStartBus) + shouldStartBus = true; + #endif + } else { + #if LEDPIN == LED_BUILTIN + if (shouldStartBus) { + shouldStartBus = false; + const uint8_t ty = _useRgbw ? 2 : 1; + bus->Begin((NeoPixelType)ty, _lengthRaw); + } + #endif } if (SEGENV.next_time > millis() + 22 && millis() - _lastShow > MIN_SHOW_DELAY) show();//apply brightness change immediately if no refresh soon } diff --git a/wled00/button.cpp b/wled00/button.cpp index 3c7b7f14..280a571a 100644 --- a/wled00/button.cpp +++ b/wled00/button.cpp @@ -87,7 +87,7 @@ void handleIO() { lastOnTime = millis(); if (offMode) - { + { #if RLYPIN >= 0 digitalWrite(RLYPIN, RLYMDE); #endif @@ -95,9 +95,15 @@ void handleIO() } } else if (millis() - lastOnTime > 600) { - #if RLYPIN >= 0 - if (!offMode) digitalWrite(RLYPIN, !RLYMDE); - #endif + if (!offMode) { + #if LEDPIN == LED_BUILTIN + pinMode(LED_BUILTIN, OUTPUT); + digitalWrite(LED_BUILTIN, HIGH); + #endif + #if RLYPIN >= 0 + digitalWrite(RLYPIN, !RLYMDE); + #endif + } offMode = true; }