2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
23 #if defined(USE_RX_PWM) || defined(USE_RX_PPM) || defined(USE_SERIALRX) || defined(USE_RX_MSP) || defined(USE_RX_SPI)
26 #include "pg/pg_ids.h"
29 #include "config/config_reset.h"
31 #include "drivers/io.h"
33 #include "fc/rc_controls.h"
35 #include "rx/rx_spi.h"
37 #ifndef SERIALRX_PROVIDER
39 #if defined(USE_SERIALRX_CRSF)
40 #define SERIALRX_PROVIDER SERIALRX_CRSF
41 #elif defined(USE_SERIALRX_GHST)
42 #define SERIALRX_PROVIDER SERIALRX_GHST
43 #elif defined(USE_SERIALRX_IBUS)
44 #define SERIALRX_PROVIDER SERIALRX_IBUS
45 #elif defined(USE_SERIALRX_SBUS)
46 #define SERIALRX_PROVIDER SERIALRX_SBUS
47 #elif defined(USE_SERIALRX_SPEKTRUM)
48 #if defined(USE_TELEMETRY_SRXL)
49 #define SERIALRX_PROVIDER SERIALRX_SRXL
51 #define SERIALRX_PROVIDER SERIALRX_SPEKTRUM2048
53 #elif defined(USE_SERIALRX_FPORT)
54 #define SERIALRX_PROVIDER SERIALRX_FPORT
55 #elif defined(USE_SERIALRX_XBUS)
56 #define SERIALRX_PROVIDER SERIALRX_XBUS_MODE_B
57 #elif defined(USE_SERIALRX_SRXL2)
58 #define SERIALRX_PROVIDER SERIALRX_SRXL2
59 #elif defined(USE_SERIALRX_JETIEXBUS)
60 #define SERIALRX_PROVIDER SERIALRX_JETIEXBUS
61 #elif defined(USE_SERIALRX_SUMD)
62 #define SERIALRX_PROVIDER SERIALRX_SUMD
63 #elif defined(USE_SERIALRX_SUMH)
64 #define SERIALRX_PROVIDER SERIALRX_SUMH
66 #define SERIALRX_PROVIDER SERIALRX_NONE
71 #ifndef SERIALRX_HALFDUPLEX
72 #if (defined(USE_SERIALRX_FPORT) || defined(USE_SERIALRX_SRXL2)) && !(defined(USE_SERIALRX_CRSF) && defined(USE_SERIALRX_GHST) && defined(USE_SERIALRX_IBUS) && defined(USE_SERIALRX_SBUS) && defined(USE_SERIALRX_SPEKTRUM) && defined(USE_SERIALRX_XBUS))
73 #define SERIALRX_HALFDUPLEX 1
75 #define SERIALRX_HALFDUPLEX 0
79 PG_REGISTER_WITH_RESET_FN(rxConfig_t
, rxConfig
, PG_RX_CONFIG
, 4);
80 void pgResetFn_rxConfig(rxConfig_t
*rxConfig
)
82 RESET_CONFIG_2(rxConfig_t
, rxConfig
,
83 .halfDuplex
= SERIALRX_HALFDUPLEX
,
84 .serialrx_provider
= SERIALRX_PROVIDER
,
85 .serialrx_inverted
= 0,
86 .spektrum_bind_pin_override_ioTag
= IO_TAG(SPEKTRUM_BIND_PIN
),
87 .spektrum_bind_plug_ioTag
= IO_TAG(BINDPLUG_PIN
),
88 .spektrum_sat_bind
= 0,
89 .spektrum_sat_bind_autoreset
= 1,
93 .rx_min_usec
= RX_MIN_USEC
, // any of first 4 channels below this value will trigger rx loss detection
94 .rx_max_usec
= RX_MAX_USEC
, // any of first 4 channels above this value will trigger rx loss detection
95 .rssi_src_frame_errors
= false,
97 .rssi_scale
= RSSI_SCALE_DEFAULT
,
100 .rssi_src_frame_lpf_period
= 30,
101 .rssi_smoothing
= 125,
102 .fpvCamAngleDegrees
= 0,
103 .airModeActivateThreshold
= 25,
104 .max_aux_channel
= DEFAULT_AUX_CHANNEL_COUNT
,
105 .rc_smoothing_mode
= 1,
106 .rc_smoothing_setpoint_cutoff
= 0,
107 .rc_smoothing_feedforward_cutoff
= 0,
108 .rc_smoothing_throttle_cutoff
= 0,
109 .rc_smoothing_debug_axis
= ROLL
,
110 .rc_smoothing_auto_factor_rpy
= 30,
111 .rc_smoothing_auto_factor_throttle
= 30,
113 .srxl2_baud_fast
= true,
114 .sbus_baud_fast
= false,
115 .msp_override_channels_mask
= 0,
116 .crsf_use_negotiated_baud
= false,
119 #ifdef RX_CHANNELS_TAER
120 parseRcChannels("TAER1234", rxConfig
);
122 parseRcChannels("AETR1234", rxConfig
);