gfroerli / firmware

Firmware for the water temperature sensor project
GNU General Public License v3.0
6 stars 1 forks source link

Monotonic: Fix timer rollower #95

Closed dbrgn closed 3 years ago

dbrgn commented 3 years ago

We may have a bug in our timer implementation:

https://github.com/rtic-rs/rtic-examples/commit/beabbe39d5c4bb37c8c453de704aeba0b8c118b0#diff-7f6bc96b170ed4c951d3bb7b49a44d91b50558409a80158a86349b10efa3f7f7

rnestler commented 3 years ago

This should be easily reproducible, no? How often does the timer overflow?

rnestler commented 3 years ago

Reproduced it here:

panicked at 'attempt to subtract with overflow', src/monotonic_stm32l0.rs:149:20

But I'm wondering why signed integers are used for the instant type. Time shouldn't get negative. Am I missing something?

rnestler commented 3 years ago

This is fixed with #96