From 8b636ff86a00bba1d7603a911592d06dc2b7b6fa Mon Sep 17 00:00:00 2001 From: mikeller Date: Thu, 25 Jan 2018 02:01:29 +1300 Subject: [PATCH] Avoid RC processing when no new RC data was received. --- src/main/fc/fc_core.c | 6 ++++-- src/main/fc/fc_core.h | 2 +- src/main/fc/fc_tasks.c | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/fc/fc_core.c b/src/main/fc/fc_core.c index 93a34403f..e3a769a83 100644 --- a/src/main/fc/fc_core.c +++ b/src/main/fc/fc_core.c @@ -392,13 +392,13 @@ static bool canUpdateVTX(void) /* * processRx called from taskUpdateRxMain */ -void processRx(timeUs_t currentTimeUs) +bool processRx(timeUs_t currentTimeUs) { static bool armedBeeperOn = false; static bool airmodeIsActivated; if (!calculateRxChannelsAndUpdateFailsafe(currentTimeUs)) { - return; + return false; } // 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(); } #endif + + return true; } static void subTaskPidController(timeUs_t currentTimeUs) diff --git a/src/main/fc/fc_core.h b/src/main/fc/fc_core.h index a136cd73a..6d215beab 100644 --- a/src/main/fc/fc_core.h +++ b/src/main/fc/fc_core.h @@ -42,7 +42,7 @@ void resetArmingDisabled(void); void disarm(void); void tryArm(void); -void processRx(timeUs_t currentTimeUs); +bool processRx(timeUs_t currentTimeUs); void updateArmingStatus(void); void updateRcCommands(void); diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 9cb0a8088..a7cfc9496 100644 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -132,7 +132,10 @@ static void taskUpdateAccelerometer(timeUs_t currentTimeUs) static void taskUpdateRxMain(timeUs_t currentTimeUs) { - processRx(currentTimeUs); + if (!processRx(currentTimeUs)) { + return; + } + isRXDataNew = true; #if !defined(USE_ALT_HOLD)