mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 15:25:36 +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;
|
||||
}
|
||||
|
||||
if (schedulerGetIgnoreTaskExecTime()) {
|
||||
return;
|
||||
}
|
||||
if (!schedulerGetIgnoreTaskExecTime()) {
|
||||
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
|
||||
anticipatedExecutionTime = schedulerGetNextStateTime();
|
||||
if (anticipatedExecutionTime != (rxStateDurationFracUs[oldRxState] >> RX_TASK_DECAY_SHIFT)) {
|
||||
rxStateDurationFracUs[oldRxState] = anticipatedExecutionTime << RX_TASK_DECAY_SHIFT;
|
||||
}
|
||||
|
||||
if (executeTimeUs > (rxStateDurationFracUs[oldRxState] >> RX_TASK_DECAY_SHIFT)) {
|
||||
rxStateDurationFracUs[oldRxState] = executeTimeUs << RX_TASK_DECAY_SHIFT;
|
||||
} else {
|
||||
// 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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue