Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct tick overflow handling for timer reset #2149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mark9064
Copy link
Contributor

Imagine the tick count wraps around at 1000, the hold time is set to 150, and the current time is 900. With the current code the comparison becomes 900 > 900 + 150 which is 900 > 50 as (1050 % 1000 = 50) so the condition will immediately be true.

With the new code, the comparison becomes 0 > 150 so there is no problem.

Copy link

Build size and comparison to main:

Section Size Difference
text 374544B -16B
data 948B 0B
bss 63488B 0B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant