Skip to content

Commit

Permalink
FPS calculation with rounding
Browse files Browse the repository at this point in the history
small bugfix from upstream
  • Loading branch information
softhack007 committed Aug 30, 2023
1 parent ed3bbc4 commit b038508
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void WS2812FX::show(void) {
unsigned long diff = now - _lastShow;
uint16_t fpsCurr = 200;
if (diff > 0) fpsCurr = 1000 / diff;
_cumulativeFps = (3 * _cumulativeFps + fpsCurr) >> 2;
_cumulativeFps = (3 * _cumulativeFps + fpsCurr +2) >> 2; // "+2" for proper rounding (2/4 = 0.5)
_lastShow = now;
}

Expand Down

0 comments on commit b038508

Please sign in to comment.