ABL optimization
this optimization avoids to apply brightness two times . NeoPixelBusLg has already applied global brightness at sPC. Due to internal working of the Lg bus, its sufficient to only post-apply scaling, and set the new (scaled) brightness for the next frame.
This commit is contained in:
parent
d48a96599f
commit
fa281a0df0
@ -1232,12 +1232,12 @@ void WS2812FX::estimateCurrentAndLimitBri() {
|
|||||||
uint8_t scaleB = (scaleI > 255) ? 255 : scaleI;
|
uint8_t scaleB = (scaleI > 255) ? 255 : scaleI;
|
||||||
uint8_t newBri = scale8(_brightness, scaleB);
|
uint8_t newBri = scale8(_brightness, scaleB);
|
||||||
// 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
|
if (scaleB < 255) busses.setBrightness(scaleB, true); // NPB-LG has already applied brightness, so its suffifient to post-apply scaling
|
||||||
busses.setBrightness(newBri, true); // sub-optimal, but prevents flickering
|
busses.setBrightness(newBri, false); // set new brightness for next frame
|
||||||
currentMilliamps = (powerSum0 * newBri) / puPerMilliamp;
|
currentMilliamps = (powerSum0 * newBri) / puPerMilliamp;
|
||||||
} else {
|
} else {
|
||||||
currentMilliamps = powerSum / puPerMilliamp;
|
currentMilliamps = powerSum / puPerMilliamp;
|
||||||
busses.setBrightness(_brightness, true); // immediate = true is needed to prevent flickering
|
busses.setBrightness(_brightness, false); // set new brightness for next frame
|
||||||
}
|
}
|
||||||
currentMilliamps += MA_FOR_ESP; //add power of ESP back to estimate
|
currentMilliamps += MA_FOR_ESP; //add power of ESP back to estimate
|
||||||
currentMilliamps += pLen; //add standby power back to estimate
|
currentMilliamps += pLen; //add standby power back to estimate
|
||||||
|
Loading…
Reference in New Issue
Block a user