From 1c9ebf9437a7123f1a68845367a5f0d031c63ee1 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Tue, 3 Mar 2015 23:17:25 +0000 Subject: [PATCH] Use received Serial RX data even when serial rx reports failsafe. --- src/main/rx/rx.c | 6 ++---- src/main/rx/sbus.c | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/main/rx/rx.c b/src/main/rx/rx.c index 8808e97f3..4fb62bd9e 100644 --- a/src/main/rx/rx.c +++ b/src/main/rx/rx.c @@ -294,12 +294,10 @@ void processRxChannels(void) void processDataDrivenRx(void) { - if (!rcDataReceived) { - return; + if (rcDataReceived) { + failsafe->vTable->reset(); } - failsafe->vTable->reset(); - processRxChannels(); rcDataReceived = false; diff --git a/src/main/rx/sbus.c b/src/main/rx/sbus.c index 2ea8441b1..4368f2dc1 100644 --- a/src/main/rx/sbus.c +++ b/src/main/rx/sbus.c @@ -176,25 +176,10 @@ bool sbusFrameComplete(void) sbusFrameDone = false; #ifdef DEBUG_SBUS_PACKETS + sbusStateFlags = 0; debug[1] = sbusFrame.frame.flags; #endif - if (sbusFrame.frame.flags & SBUS_FLAG_SIGNAL_LOSS) { - // internal failsafe enabled and rx failsafe flag set -#ifdef DEBUG_SBUS_PACKETS - sbusStateFlags |= SBUS_STATE_SIGNALLOSS; - debug[0] |= SBUS_STATE_SIGNALLOSS; -#endif - } - if (sbusFrame.frame.flags & SBUS_FLAG_FAILSAFE_ACTIVE) { -#ifdef DEBUG_SBUS_PACKETS - sbusStateFlags |= SBUS_STATE_FAILSAFE; - debug[0] = sbusStateFlags; -#endif - // internal failsafe enabled and rx failsafe flag set - return false; - } - sbusChannelData[0] = sbusFrame.frame.chan0; sbusChannelData[1] = sbusFrame.frame.chan1; sbusChannelData[2] = sbusFrame.frame.chan2; @@ -224,8 +209,23 @@ bool sbusFrameComplete(void) sbusChannelData[17] = SBUS_DIGITAL_CHANNEL_MIN; } + if (sbusFrame.frame.flags & SBUS_FLAG_SIGNAL_LOSS) { +#ifdef DEBUG_SBUS_PACKETS + sbusStateFlags |= SBUS_STATE_SIGNALLOSS; + debug[0] = sbusStateFlags; +#endif + } + if (sbusFrame.frame.flags & SBUS_FLAG_FAILSAFE_ACTIVE) { + // internal failsafe enabled and rx failsafe flag set +#ifdef DEBUG_SBUS_PACKETS + sbusStateFlags |= SBUS_STATE_FAILSAFE; + debug[0] = sbusStateFlags; +#endif + // RX *should* still be sending valid channel data, so use it. + return false; + } + #ifdef DEBUG_SBUS_PACKETS - sbusStateFlags = 0; debug[0] = sbusStateFlags; #endif return true;