From fb83ea4b521db51d86e27c39c67ec0d55e1434ed Mon Sep 17 00:00:00 2001 From: mikeller Date: Sun, 1 Jul 2018 15:12:21 +1200 Subject: [PATCH] Fixed conditions for RC smoothing validation. --- src/main/fc/config.c | 9 +++------ src/main/fc/fc_rc.c | 9 +++++++++ src/main/fc/fc_rc.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 2295e8fd6c..91f7c27e6c 100644 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -245,18 +245,15 @@ static void validateAndFixConfig(void) rxConfigMutable()->rssi_src_frame_errors = false; } - if (( -#if defined(USE_RC_SMOOTHING_FILTER) - rxConfig()->rc_smoothing_type == RC_SMOOTHING_TYPE_INTERPOLATION && -#endif - rxConfig()->rcInterpolation == RC_SMOOTHING_OFF) || rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_T) { + if (rcSmoothingIsOff() || rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_T) { for (unsigned i = 0; i < MAX_PROFILE_COUNT; i++) { pidProfilesMutable(i)->dtermSetpointWeight = 0; } } #if defined(USE_THROTTLE_BOOST) - if (!(rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_RPYT + if (rcSmoothingIsOff() || + !(rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_RPYT || rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_T || rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_RPT)) { for (unsigned i = 0; i < MAX_PROFILE_COUNT; i++) { diff --git a/src/main/fc/fc_rc.c b/src/main/fc/fc_rc.c index 4472d246b5..ab1511deb1 100644 --- a/src/main/fc/fc_rc.c +++ b/src/main/fc/fc_rc.c @@ -732,6 +732,15 @@ void initRcProcessing(void) } } +bool rcSmoothingIsOff(void) +{ + return ( +#if defined(USE_RC_SMOOTHING_FILTER) + rxConfig()->rc_smoothing_type == RC_SMOOTHING_TYPE_INTERPOLATION && +#endif + rxConfig()->rcInterpolation == RC_SMOOTHING_OFF); +} + #ifdef USE_RC_SMOOTHING_FILTER int rcSmoothingGetValue(int whichValue) { diff --git a/src/main/fc/fc_rc.h b/src/main/fc/fc_rc.h index a829ba698b..f3d19c990c 100644 --- a/src/main/fc/fc_rc.h +++ b/src/main/fc/fc_rc.h @@ -39,5 +39,6 @@ void updateRcCommands(void); void resetYawAxis(void); void initRcProcessing(void); bool isMotorsReversed(void); +bool rcSmoothingIsOff(void); int rcSmoothingGetValue(int whichValue); bool rcSmoothingAutoCalculate(void);