mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Merge pull request #1833 from martinbudden/bf_config_inputfilteringmode
Moved inputFilteringMode into pwmConfig()
This commit is contained in:
commit
013312f90f
6 changed files with 11 additions and 13 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 } },
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue