Executing before logic nextTick because of overflow
#7
Closed
opened 6 years ago by Ruakij
·
2 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
When the nextTick calculated will overflow the 16-bit unsigned int, it will start from 0.
If the timer has not yet overflown in the next check, then the check will return true before the logic distance in ticks was reached yet.
Solution:
timer
andnextTick
is more than (half?) of the timer-overflowif(timer >= nextTick && (timer - nextTick) < (2^timerBits /2))
Implemented