diff --git a/src/main/config/config_master.h b/src/main/config/config_master.h index cb5e742812..4a03ff0ec2 100644 --- a/src/main/config/config_master.h +++ b/src/main/config/config_master.h @@ -154,7 +154,6 @@ typedef struct master_s { #endif rxConfig_t rxConfig; - inputFilteringMode_e inputFilteringMode; // Use hardware input filtering, e.g. for OrangeRX PPM/PWM receivers. armingConfig_t armingConfig; diff --git a/src/main/drivers/pwm_rx.c b/src/main/drivers/pwm_rx.c index ed52ecaec6..a745fd0733 100644 --- a/src/main/drivers/pwm_rx.c +++ b/src/main/drivers/pwm_rx.c @@ -122,11 +122,6 @@ void resetPPMDataReceivedState(void) #define MIN_CHANNELS_BEFORE_PPM_FRAME_CONSIDERED_VALID 4 -void pwmRxSetInputFilteringMode(inputFilteringMode_e initialInputFilteringMode) -{ - inputFilteringMode = initialInputFilteringMode; -} - #ifdef DEBUG_PPM_ISR typedef enum { SOURCE_OVERFLOW = 0, @@ -366,6 +361,8 @@ void pwmICConfig(TIM_TypeDef *tim, uint8_t channel, uint16_t polarity) void pwmRxInit(const pwmConfig_t *pwmConfig) { + inputFilteringMode = pwmConfig->inputFilteringMode; + for (int channel = 0; channel < PWM_INPUT_PORT_COUNT; channel++) { pwmInputPort_t *port = &pwmInputPorts[channel]; diff --git a/src/main/drivers/pwm_rx.h b/src/main/drivers/pwm_rx.h index bcb0b60ec1..c16306a81e 100644 --- a/src/main/drivers/pwm_rx.h +++ b/src/main/drivers/pwm_rx.h @@ -33,6 +33,7 @@ typedef struct ppmConfig_s { typedef struct pwmConfig_s { ioTag_t ioTags[PWM_INPUT_PORT_COUNT]; + inputFilteringMode_e inputFilteringMode; } pwmConfig_t; void ppmRxInit(const ppmConfig_t *ppmConfig, uint8_t pwmProtocol); @@ -44,6 +45,4 @@ uint16_t ppmRead(uint8_t channel); bool isPPMDataBeingReceived(void); void resetPPMDataReceivedState(void); -void pwmRxSetInputFilteringMode(inputFilteringMode_e initialInputFilteringMode); - bool isPWMDataBeingReceived(void); diff --git a/src/main/fc/config.c b/src/main/fc/config.c index fa92b2438d..eaa40a7ed6 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -710,7 +710,9 @@ void createDefaultConfig(master_t *config) resetAllRxChannelRangeConfigurations(config->rxConfig.channelRanges); - config->inputFilteringMode = INPUT_FILTERING_DISABLED; +#ifdef USE_PWM + config->pwmConfig.inputFilteringMode = INPUT_FILTERING_DISABLED; +#endif config->armingConfig.gyro_cal_on_first_arm = 0; // TODO - Cleanup retarded arm support config->armingConfig.disarm_kill_switch = 1; diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 40132fb2d7..43c45c1864 100755 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -701,7 +701,9 @@ const clivalue_t valueTable[] = { { "rc_interpolation", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->rcInterpolation, .config.lookup = { TABLE_RC_INTERPOLATION } }, { "rc_interpolation_interval", VAR_UINT8 | MASTER_VALUE, &rxConfig()->rcInterpolationInterval, .config.minmax = { 1, 50 } }, { "rssi_ppm_invert", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &rxConfig()->rssi_ppm_invert, .config.lookup = { TABLE_OFF_ON } }, - { "input_filtering_mode", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.inputFilteringMode, .config.lookup = { TABLE_OFF_ON } }, +#if defined(USE_PWM) + { "input_filtering_mode", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &pwmConfig()->inputFilteringMode, .config.lookup = { TABLE_OFF_ON } }, +#endif { "roll_yaw_cam_mix_degrees", VAR_UINT8 | MASTER_VALUE, &rxConfig()->fpvCamAngleDegrees, .config.minmax = { 0, 50 } }, { "max_aux_channels", VAR_UINT8 | MASTER_VALUE, &rxConfig()->max_aux_channel, .config.minmax = { 0, 13 } }, { "debug_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.debug_mode, .config.lookup = { TABLE_DEBUG } }, diff --git a/src/main/main.c b/src/main/main.c index 15783fd620..90aaa03306 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -282,11 +282,10 @@ void init(void) #if defined(USE_PWM) || defined(USE_PPM) if (feature(FEATURE_RX_PPM)) { - ppmRxInit(&masterConfig.ppmConfig, motorConfig()->motorPwmProtocol); + ppmRxInit(ppmConfig(), motorConfig()->motorPwmProtocol); } else if (feature(FEATURE_RX_PARALLEL_PWM)) { - pwmRxInit(&masterConfig.pwmConfig); + pwmRxInit(pwmConfig()); } - pwmRxSetInputFilteringMode(masterConfig.inputFilteringMode); #endif systemState |= SYSTEM_STATE_MOTORS_READY;