1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Split rx processing into three states to eliminate cycle time jitter

Allow tasks with state machines to control which state determines task duration

Fix unit tests
This commit is contained in:
Steve Evans 2021-03-07 20:46:25 +00:00
parent bc4372588b
commit 25fcacf4c5
11 changed files with 89 additions and 20 deletions

View file

@ -744,11 +744,6 @@ bool isAirmodeActivated()
*/
bool processRx(timeUs_t currentTimeUs)
{
static bool armedBeeperOn = false;
#ifdef USE_TELEMETRY
static bool sharedPortTelemetryEnabled = false;
#endif
timeDelta_t frameAgeUs;
timeDelta_t frameDeltaUs = rxGetFrameDelta(&frameAgeUs);
@ -891,6 +886,17 @@ bool processRx(timeUs_t currentTimeUs)
}
#endif
return true;
}
void processRxModes(timeUs_t currentTimeUs)
{
static bool armedBeeperOn = false;
#ifdef USE_TELEMETRY
static bool sharedPortTelemetryEnabled = false;
#endif
const throttleStatus_e throttleStatus = calculateThrottleStatus();
// When armed and motors aren't spinning, do beeps and then disarm
// board after delay so users without buzzer won't lose fingers.
// mixTable constrains motor commands, so checking throttleStatus is enough
@ -1082,8 +1088,6 @@ bool processRx(timeUs_t currentTimeUs)
#endif
pidSetAntiGravityState(IS_RC_MODE_ACTIVE(BOXANTIGRAVITY) || featureIsEnabled(FEATURE_ANTI_GRAVITY));
return true;
}
static FAST_CODE void subTaskPidController(timeUs_t currentTimeUs)