proper rounding of FPS
This commit is contained in:
parent
4766666913
commit
72a72dbc88
@ -1275,7 +1275,7 @@ void WS2812FX::show(void) {
|
|||||||
size_t diff = now - _lastShow;
|
size_t diff = now - _lastShow;
|
||||||
size_t fpsCurr = 200;
|
size_t fpsCurr = 200;
|
||||||
if (diff > 0) fpsCurr = 1000 / diff;
|
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;
|
_lastShow = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user