1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

Merge pull request #6250 from mikeller/fix_rc_smoothing_validation

Fixed conditions for RC smoothing validation.
This commit is contained in:
Michael Keller 2018-07-01 21:29:59 +12:00 committed by GitHub
commit 7936d2ec57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

View file

@ -245,18 +245,15 @@ static void validateAndFixConfig(void)
rxConfigMutable()->rssi_src_frame_errors = false; rxConfigMutable()->rssi_src_frame_errors = false;
} }
if (( if (!rcSmoothingIsEnabled() || rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_T) {
#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) {
for (unsigned i = 0; i < MAX_PROFILE_COUNT; i++) { for (unsigned i = 0; i < MAX_PROFILE_COUNT; i++) {
pidProfilesMutable(i)->dtermSetpointWeight = 0; pidProfilesMutable(i)->dtermSetpointWeight = 0;
} }
} }
#if defined(USE_THROTTLE_BOOST) #if defined(USE_THROTTLE_BOOST)
if (!(rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_RPYT if (!rcSmoothingIsEnabled() ||
!(rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_RPYT
|| rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_T || rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_T
|| rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_RPT)) { || rxConfig()->rcInterpolationChannels == INTERPOLATION_CHANNELS_RPT)) {
for (unsigned i = 0; i < MAX_PROFILE_COUNT; i++) { for (unsigned i = 0; i < MAX_PROFILE_COUNT; i++) {

View file

@ -732,6 +732,15 @@ void initRcProcessing(void)
} }
} }
bool rcSmoothingIsEnabled(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 #ifdef USE_RC_SMOOTHING_FILTER
int rcSmoothingGetValue(int whichValue) int rcSmoothingGetValue(int whichValue)
{ {

View file

@ -39,5 +39,6 @@ void updateRcCommands(void);
void resetYawAxis(void); void resetYawAxis(void);
void initRcProcessing(void); void initRcProcessing(void);
bool isMotorsReversed(void); bool isMotorsReversed(void);
bool rcSmoothingIsEnabled(void);
int rcSmoothingGetValue(int whichValue); int rcSmoothingGetValue(int whichValue);
bool rcSmoothingAutoCalculate(void); bool rcSmoothingAutoCalculate(void);