mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Still update duration of next anticipated state even is current execution time is ignored
This commit is contained in:
parent
4e47a792d8
commit
e7b61a928f
2 changed files with 27 additions and 25 deletions
|
@ -225,23 +225,21 @@ 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
|
||||||
|
anticipatedExecutionTime = schedulerGetNextStateTime();
|
||||||
|
if (anticipatedExecutionTime != (rxStateDurationFracUs[oldRxState] >> RX_TASK_DECAY_SHIFT)) {
|
||||||
|
rxStateDurationFracUs[oldRxState] = anticipatedExecutionTime << RX_TASK_DECAY_SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
// If the scheduler has reduced the anticipatedExecutionTime due to task aging, pick that up
|
if (executeTimeUs > (rxStateDurationFracUs[oldRxState] >> RX_TASK_DECAY_SHIFT)) {
|
||||||
anticipatedExecutionTime = schedulerGetNextStateTime();
|
rxStateDurationFracUs[oldRxState] = executeTimeUs << RX_TASK_DECAY_SHIFT;
|
||||||
if (anticipatedExecutionTime != (rxStateDurationFracUs[oldRxState] >> RX_TASK_DECAY_SHIFT)) {
|
} else {
|
||||||
rxStateDurationFracUs[oldRxState] = anticipatedExecutionTime << RX_TASK_DECAY_SHIFT;
|
// Slowly decay the max time
|
||||||
}
|
rxStateDurationFracUs[oldRxState]--;
|
||||||
|
}
|
||||||
if (executeTimeUs > (rxStateDurationFracUs[oldRxState] >> RX_TASK_DECAY_SHIFT)) {
|
|
||||||
rxStateDurationFracUs[oldRxState] = executeTimeUs << RX_TASK_DECAY_SHIFT;
|
|
||||||
} else {
|
|
||||||
// Slowly decay the max time
|
|
||||||
rxStateDurationFracUs[oldRxState]--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debugMode == DEBUG_RX_STATE_TIME) {
|
if (debugMode == DEBUG_RX_STATE_TIME) {
|
||||||
|
|
|
@ -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,20 +1307,22 @@ void osdUpdate(timeUs_t currentTimeUs)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
executeTimeUs = micros() - currentTimeUs;
|
if (!schedulerGetIgnoreTaskExecTime()) {
|
||||||
|
executeTimeUs = micros() - currentTimeUs;
|
||||||
|
|
||||||
|
|
||||||
// On the first pass no element groups will have been formed, so all elements will have been
|
// On the first pass no element groups will have been formed, so all elements will have been
|
||||||
// rendered which is unrepresentative, so ignore
|
// rendered which is unrepresentative, so ignore
|
||||||
if (!firstPass) {
|
if (!firstPass) {
|
||||||
if (osdCurState == OSD_STATE_UPDATE_ELEMENTS) {
|
if (osdCurState == OSD_STATE_UPDATE_ELEMENTS) {
|
||||||
if (executeTimeUs > osdElementGroupDurationUs[osdCurElementGroup]) {
|
if (executeTimeUs > osdElementGroupDurationUs[osdCurElementGroup]) {
|
||||||
osdElementGroupDurationUs[osdCurElementGroup] = executeTimeUs;
|
osdElementGroupDurationUs[osdCurElementGroup] = executeTimeUs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (executeTimeUs > osdStateDurationUs[osdCurState]) {
|
if (executeTimeUs > osdStateDurationUs[osdCurState]) {
|
||||||
osdStateDurationUs[osdCurState] = executeTimeUs;
|
osdStateDurationUs[osdCurState] = executeTimeUs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue