From 33b16be19c9ee97a55fe5485290fa38db9ca022e Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 22 Jan 2017 12:17:56 +0100 Subject: [PATCH] LP-440 Fix ReceiverActivity disabled while armed --- flight/modules/Receiver/receiver.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/flight/modules/Receiver/receiver.c b/flight/modules/Receiver/receiver.c index 5fc301eb4..5b849efc1 100644 --- a/flight/modules/Receiver/receiver.c +++ b/flight/modules/Receiver/receiver.c @@ -198,8 +198,8 @@ static void receiverTask(__attribute__((unused)) void *parameters) { ManualControlSettingsData settings; ManualControlCommandData cmd; - FlightStatusData flightStatus; + uint8_t armed; uint8_t disconnected_count = 0; uint8_t connected_count = 0; @@ -213,9 +213,7 @@ static void receiverTask(__attribute__((unused)) void *parameters) AccessoryDesiredCreateInstance(); // Whenever the configuration changes, make sure it is safe to fly - ManualControlCommandGet(&cmd); - FlightStatusGet(&flightStatus); /* Initialize the RcvrActivty FSM */ portTickType lastActivityTime = xTaskGetTickCount(); @@ -241,17 +239,20 @@ static void receiverTask(__attribute__((unused)) void *parameters) ManualControlSettingsGet(&settings); SystemSettingsThrustControlGet(&thrustType); + FlightStatusArmedGet(&armed); /* Update channel activity monitor */ - if (flightStatus.Armed == FLIGHTSTATUS_ARMED_DISARMED) { + if (armed == FLIGHTSTATUS_ARMED_DISARMED) { if (updateRcvrActivity(&activity_fsm)) { /* Reset the aging timer because activity was detected */ lastActivityTime = lastSysTime; } - /* Read signal quality from the group used for the throttle */ - (void)updateRcvrStatus(&activity_fsm, - settings.ChannelGroups.Throttle, - rssiValue); } + + /* Read signal quality from the group used for the throttle */ + (void)updateRcvrStatus(&activity_fsm, + settings.ChannelGroups.Throttle, + rssiValue); + if (timeDifferenceMs(lastActivityTime, lastSysTime) > 5000) { resetRcvrActivity(&activity_fsm); resetRcvrStatus(&activity_fsm);