1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Still update duration of next anticipated state even is current execution time is ignored

This commit is contained in:
Steve Evans 2022-01-14 03:22:52 +00:00
parent 4e47a792d8
commit e7b61a928f
2 changed files with 27 additions and 25 deletions

View file

@ -225,10 +225,7 @@ static void taskUpdateRxMain(timeUs_t currentTimeUs)
break; break;
} }
if (schedulerGetIgnoreTaskExecTime()) { if (!schedulerGetIgnoreTaskExecTime()) {
return;
}
executeTimeUs = micros() - currentTimeUs + RX_TASK_MARGIN; executeTimeUs = micros() - currentTimeUs + RX_TASK_MARGIN;
// If the scheduler has reduced the anticipatedExecutionTime due to task aging, pick that up // If the scheduler has reduced the anticipatedExecutionTime due to task aging, pick that up
@ -243,6 +240,7 @@ static void taskUpdateRxMain(timeUs_t currentTimeUs)
// Slowly decay the max time // Slowly decay the max time
rxStateDurationFracUs[oldRxState]--; rxStateDurationFracUs[oldRxState]--;
} }
}
if (debugMode == DEBUG_RX_STATE_TIME) { if (debugMode == DEBUG_RX_STATE_TIME) {
debug[oldRxState] = rxStateDurationFracUs[oldRxState] >> RX_TASK_DECAY_SHIFT; debug[oldRxState] = rxStateDurationFracUs[oldRxState] >> RX_TASK_DECAY_SHIFT;

View file

@ -1006,6 +1006,8 @@ void osdDrawStats2(timeUs_t currentTimeUs)
osdStatsEnabled = false; osdStatsEnabled = false;
stats.armed_time = 0; stats.armed_time = 0;
} }
schedulerIgnoreTaskExecTime();
} }
#ifdef USE_ESC_SENSOR #ifdef USE_ESC_SENSOR
if (featureIsEnabled(FEATURE_ESC_SENSOR)) { if (featureIsEnabled(FEATURE_ESC_SENSOR)) {
@ -1305,6 +1307,7 @@ void osdUpdate(timeUs_t currentTimeUs)
break; break;
} }
if (!schedulerGetIgnoreTaskExecTime()) {
executeTimeUs = micros() - currentTimeUs; executeTimeUs = micros() - currentTimeUs;
@ -1321,6 +1324,7 @@ void osdUpdate(timeUs_t currentTimeUs)
osdStateDurationUs[osdCurState] = executeTimeUs; osdStateDurationUs[osdCurState] = executeTimeUs;
} }
} }
}
if (osdState == OSD_STATE_UPDATE_ELEMENTS) { if (osdState == OSD_STATE_UPDATE_ELEMENTS) {
schedulerSetNextStateTime(osdElementGroupDurationUs[osdElementGroup] + OSD_ELEMENT_RENDER_MARGIN); schedulerSetNextStateTime(osdElementGroupDurationUs[osdElementGroup] + OSD_ELEMENT_RENDER_MARGIN);