Executing before logic nextTick because of overflow #7

Closed
opened 2019-03-08 09:57:24 +01:00 by Ruakij · 2 comments
Ruakij commented 2019-03-08 09:57:24 +01:00 (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 2019-03-08 09:59:39 +01:00 (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 2019-03-08 10:05:58 +01:00 (Migrated from gitea.railduction.eu)

Implemented

Implemented
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Ruakij/Geigercounter#7
No description provided.