1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Merge pull request #5023 from mikeller/avoid_process_rx_when_no_new_rc_data

Avoid RC processing when no new RC data was received.
This commit is contained in:
Michael Keller 2018-01-25 18:17:26 +13:00 committed by GitHub
commit b47cabffef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -392,13 +392,13 @@ static bool canUpdateVTX(void)
/* /*
* processRx called from taskUpdateRxMain * processRx called from taskUpdateRxMain
*/ */
void processRx(timeUs_t currentTimeUs) bool processRx(timeUs_t currentTimeUs)
{ {
static bool armedBeeperOn = false; static bool armedBeeperOn = false;
static bool airmodeIsActivated; static bool airmodeIsActivated;
if (!calculateRxChannelsAndUpdateFailsafe(currentTimeUs)) { if (!calculateRxChannelsAndUpdateFailsafe(currentTimeUs)) {
return; return false;
} }
// in 3D mode, we need to be able to disarm by switch at any time // in 3D mode, we need to be able to disarm by switch at any time
@ -600,6 +600,8 @@ void processRx(timeUs_t currentTimeUs)
handleVTXControlButton(); handleVTXControlButton();
} }
#endif #endif
return true;
} }
static void subTaskPidController(timeUs_t currentTimeUs) static void subTaskPidController(timeUs_t currentTimeUs)

View file

@ -42,7 +42,7 @@ void resetArmingDisabled(void);
void disarm(void); void disarm(void);
void tryArm(void); void tryArm(void);
void processRx(timeUs_t currentTimeUs); bool processRx(timeUs_t currentTimeUs);
void updateArmingStatus(void); void updateArmingStatus(void);
void updateRcCommands(void); void updateRcCommands(void);

View file

@ -132,7 +132,10 @@ static void taskUpdateAccelerometer(timeUs_t currentTimeUs)
static void taskUpdateRxMain(timeUs_t currentTimeUs) static void taskUpdateRxMain(timeUs_t currentTimeUs)
{ {
processRx(currentTimeUs); if (!processRx(currentTimeUs)) {
return;
}
isRXDataNew = true; isRXDataNew = true;
#if !defined(USE_ALT_HOLD) #if !defined(USE_ALT_HOLD)