mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Fix for watchdog delay not being triggered
This commit is contained in:
parent
e8917b7a28
commit
a0bcb1b95f
1 changed files with 7 additions and 2 deletions
|
@ -739,12 +739,17 @@ void taskMainPidLoop(void)
|
||||||
|
|
||||||
// Function for loop trigger
|
// Function for loop trigger
|
||||||
void taskMainPidLoopCheck(void) {
|
void taskMainPidLoopCheck(void) {
|
||||||
|
// getTaskDeltaTime() returns delta time freezed at the moment of entering the scheduler. currentTime is freezed at the very same point.
|
||||||
|
// To make busy-waiting timeout work we need to account for time spent within busy-waiting loop
|
||||||
|
uint32_t currentDeltaTime = getTaskDeltaTime(TASK_SELF);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (gyroSyncCheckUpdate() || (getTaskDeltaTime(TASK_SELF) >= (targetLooptime + GYRO_WATCHDOG_DELAY))) {
|
if (gyroSyncCheckUpdate() || ((currentDeltaTime + (micros() - currentTime)) >= (targetLooptime + GYRO_WATCHDOG_DELAY))) {
|
||||||
taskMainPidLoop();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taskMainPidLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void taskUpdateAccelerometer(void)
|
void taskUpdateAccelerometer(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue