From 65e073e6b8807a31eff686e3649fbb6c3475663c Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 3 Jul 2023 14:01:45 +0200 Subject: [PATCH] de-optimization first version still cased some flickering. This de-optimization makes LEDs more stable. --- wled00/FX_fcn.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index bda17f8f..23f860de 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1230,11 +1230,13 @@ void WS2812FX::estimateCurrentAndLimitBri() { uint16_t scaleI = scale * 255; uint8_t scaleB = (scaleI > 255) ? 255 : scaleI; uint8_t newBri = scale8(_brightness, scaleB); - busses.setBrightness(newBri, (scaleB < 255)); //to keep brightness uniform, sets virtual busses too - softhack007: apply reductions immediately + // to keep brightness uniform, sets virtual busses too - softhack007: apply reductions immediately + //busses.setBrightness(newBri, (scaleB < 255)); // best for performance, but leaves some flickering + busses.setBrightness(newBri, true); // sub-optimal, but prevents flickering currentMilliamps = (powerSum0 * newBri) / puPerMilliamp; } else { currentMilliamps = powerSum / puPerMilliamp; - busses.setBrightness(_brightness); + busses.setBrightness(_brightness, true); // immediate = true is needed to prevent flickering } currentMilliamps += MA_FOR_ESP; //add power of ESP back to estimate currentMilliamps += pLen; //add standby power back to estimate