I don’t know if rollover occurred yet; it seems the debug print is just thinking it’s a signed value, rather than an unsigned value. For an unsigned number, the value seems to have passed half its maximum then. But sure: at some point it will rollover.
Ah, forget the negative printed values, these are the lines that you’re referring to:
34282: engineUpdate, tx at 33716; now is: 34282
...
4294933165: engineUpdate, tx at 33981; now is: 4294933165
...
4294933470: engineUpdate, tx at 34328; now is: 4294933470
...
4294933777: engineUpdate, tx at 4294933170; now is: 4294933777
Are all times in each line divided by OSTICKS_PER_SEC
?
Something I noticed which is a bit weird, but might not affect things, os_getTime
is defined as:
ostime_t os_getTime () {
return hal_ticks();
}
…with hal_ticks
expected to return an unsigned 32 bits number:
u4_t hal_ticks () {
...
}
…but ostime_t
being a signed 32 bits number:
typedef uint32_t u4_t;
typedef int32_t s4_t;
...
// the HAL needs to give us ticks, so it ought to know the right type.
typedef s4_t ostime_t;