Closed grinsted closed 2 years ago
This code may actually be fine according to: https://arduino.stackexchange.com/questions/12587/how-can-i-handle-the-millis-rollover#:~:text=Short%20answer%3A%20do%20not%20try,you%20are%20doing%20something%20wrong.
Atleast if all the types in the comparison are "unsigned longs". In the above snippet is a long instead of an unsigned long. I dont know what effect that has. -Should be tested.
Correct, unsigned longs will wrap around so the math still checks out, and the timing will work.
ArcticRover firmware version
No response
Area(s) with issue?
Other
Steps to reproduce
This is not an error we have yet experienced, so i describe the bug here.
Millis is an integer counter that wraps resets to zero after ~42 days (i believe). When it wraps around comparisons such as this wont behave as extpected.
In this particular place it could actually be critical as this will mean that the heating will "never" turn off.
✔️ Expected Behavior
n/a
❌ Actual Behavior
n/a