fix: IWDG reset during gyro recal — refresh at i=0 not i=39 (P0 #42) #172
@ -68,8 +68,10 @@ void mpu6000_calibrate(void) {
|
|||||||
sum_gy += raw.gy;
|
sum_gy += raw.gy;
|
||||||
sum_gz += raw.gz;
|
sum_gz += raw.gz;
|
||||||
HAL_Delay(1);
|
HAL_Delay(1);
|
||||||
/* Refresh IWDG every 40ms — safe during re-cal with watchdog running */
|
/* Refresh IWDG every 40ms, starting immediately (i=0) — the gap between
|
||||||
if (i % 40 == 39) safety_refresh();
|
* safety_refresh() at the top of the main loop and entry here can be
|
||||||
|
* ~10ms, so we must refresh on i=0 to avoid the 50ms IWDG window. */
|
||||||
|
if (i % 40 == 0) safety_refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
s_bias_gx = (float)sum_gx / GYRO_CAL_SAMPLES;
|
s_bias_gx = (float)sum_gx / GYRO_CAL_SAMPLES;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user