From dd214f9bffe2167842d3cdcebf9b5c89149344e5 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 27 Jul 2022 16:30:17 +0200 Subject: [PATCH] autosave fix: moved stateChanged to a better location #218 Moved the additional `stateChanged = true` to a better location. Only enable the code when compiling with Autosave usermod - There is a risk that the fix triggers unnecessary WS broadcasts . stateChanged forces stateUpdated() which calls applyFinalBri() ... --- wled00/led.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wled00/led.cpp b/wled00/led.cpp index 94703c5e74..60f8663a61 100644 --- a/wled00/led.cpp +++ b/wled00/led.cpp @@ -86,13 +86,15 @@ void applyBri() { if (!realtimeMode || !arlsForceMaxBri) { strip.setBrightness(scaledBri(briT)); - stateChanged = true; //WLEDSR temporary fix, until solved in upstream } } //applies global brightness and sets it as the "current" brightness (no transition) void applyFinalBri() { +#ifdef USERMOD_AUTO_SAVE //WLEDSR - make autosave mod happy. A bit dangerous, as it may trigger unnecessary WS broadcasts (and other notificatios) + if (briOld != bri) stateChanged = true; //WLEDSR temporary fix, until solved in upstream +#endif briOld = bri; briT = bri; applyBri();