ArduinoTimerObject icon indicating copy to clipboard operation
ArduinoTimerObject copied to clipboard

Incorrect wraparound handling

Open chefables-mark opened this issue 7 years ago • 0 comments

https://github.com/aron-bordin/ArduinoTimerObject/blob/af372e79c3bca2899c07ca1e840a6e8836a48223/TimerObject.cpp#L68

Since you used unsigned variables, the math will work out correctly and you will get correct differences when subtracting across the wraparound.

This code should render your timers invalid when millis() is halfway to max since it will then overflow and have the wrong value.

chefables-mark avatar Nov 06 '18 00:11 chefables-mark