Executing before logic nextTick because of overflow #7

Closed
opened 6 years ago by Ruakij · 2 comments
Ruakij commented 6 years ago (Migrated from gitea.railduction.eu)

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.

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.
Ruakij commented 6 years ago (Migrated from gitea.railduction.eu)

Solution:

  • Check if the difference between timer and nextTick is more than (half?) of the timer-overflow



    if(timer >= nextTick && (timer - nextTick) < (2^timerBits /2))
Solution: - Check if the difference between <code>timer</code> and <code>nextTick</code> is more than (half?) of the timer-overflow <br><br> <code>if(timer >= nextTick && (timer - nextTick) < (2^timerBits /2))</code>
Ruakij commented 6 years ago (Migrated from gitea.railduction.eu)

Implemented

Implemented
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Ruakij/Geigercounter#7
Loading…
There is no content yet.