Closed superdupersvard closed 8 years ago
The reason for bug was: timeSinceDrdy is calculated as HAL_GetTick() - lastDrdyTime. lastDrdyTime is updated in an ISR. So it can happen that we run GetTick to get the current SysTick. Right after this (and before we read lastDrdyTime) we get an interrupt to increase SysTick. Immediately after we get an interrupt for new sensor value and the lastDrdyTime will be updated to the new SysTick value. This will result an underflow when calculation of timeSinceDrdy is done.
Was it due to the reason we discussed yesterday?