jandelgado / jled

Non-blocking LED controlling library for Arduino and friends.
MIT License
324 stars 51 forks source link

Handle millis overflow during running state #80

Closed boraozgen closed 2 years ago

boraozgen commented 2 years ago

If millis overflowed during running state, now < time_start_ always returned true and hanged the library. This change uses the signed integer trick to handle the overflow situation.

For this to work, millis must overflow at 32-bits. I updated the Mbed OS millis implementation to use the latest version to ensure this.

jandelgado commented 2 years ago

Hi, thanks for the fix. Could you also add a unit test that checks the behaviour?

For the curious, some background: https://arduino.stackexchange.com/questions/12587/how-can-i-handle-the-millis-rollover/12588#12588

boraozgen commented 2 years ago

Done, I also found another problematic line while writing the tests (L.402) and fixed it too.

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 96.875% when pulling b448e76d44933a1a95881ab0e4e94b82b0282b01 on boraozgen:handle-millis-overflow into 6ebb7fcf352fd7b6cb35284750ea8cf85e783436 on jandelgado:master.