Skip to content

Commit

Permalink
de-optimization
Browse files Browse the repository at this point in the history
first version still cased some flickering.
This de-optimization makes LEDs more stable.
  • Loading branch information
softhack007 committed Jul 3, 2023
1 parent a84c361 commit ecf3317
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,11 +1717,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
Expand Down

0 comments on commit ecf3317

Please sign in to comment.