Skip to content

Commit

Permalink
Fixed ABL calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
blazoncek committed Jul 17, 2023
1 parent f1e1bd4 commit 82e01f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1208,10 +1208,10 @@ uint8_t WS2812FX::estimateCurrentAndLimitBri() {

uint8_t newBri = _brightness;
if (powerSum * _brightness / 255 > powerBudget) { //scale brightness down to stay in current limit
float scale = (float)powerBudget / (float)powerSum;
float scale = (float)(powerBudget * 255) / (float)(powerSum * _brightness);
uint16_t scaleI = scale * 255;
uint8_t scaleB = (scaleI > 255) ? 255 : scaleI;
newBri = scale8(_brightness, scaleB);
newBri = scale8(_brightness, scaleB) + 1;
}
currentMilliamps = (powerSum * newBri) / 255;
currentMilliamps += MA_FOR_ESP; //add power of ESP back to estimate
Expand Down

0 comments on commit 82e01f7

Please sign in to comment.