Make negotiated baud configurable for CRSF
[betaflight.git] / src / main / pg / rx.c
blob0cf557d13c6c24c0bdaed5d054fd7342b3135ed1
1 /*
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)
8 * any later version.
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/>.
21 #include "platform.h"
23 #if defined(USE_PWM) || defined(USE_PPM) || defined(USE_SERIAL_RX) || defined(USE_RX_MSP) || defined(USE_RX_SPI)
25 #include "pg/pg.h"
26 #include "pg/pg_ids.h"
27 #include "rx.h"
29 #include "config/config_reset.h"
31 #include "drivers/io.h"
32 #include "fc/rc.h"
33 #include "fc/rc_controls.h"
34 #include "rx/rx.h"
35 #include "rx/rx_spi.h"
37 PG_REGISTER_WITH_RESET_FN(rxConfig_t, rxConfig, PG_RX_CONFIG, 3);
38 void pgResetFn_rxConfig(rxConfig_t *rxConfig)
40 RESET_CONFIG_2(rxConfig_t, rxConfig,
41 .halfDuplex = 0,
42 .serialrx_provider = SERIALRX_PROVIDER,
43 .serialrx_inverted = 0,
44 .spektrum_bind_pin_override_ioTag = IO_TAG(SPEKTRUM_BIND_PIN),
45 .spektrum_bind_plug_ioTag = IO_TAG(BINDPLUG_PIN),
46 .spektrum_sat_bind = 0,
47 .spektrum_sat_bind_autoreset = 1,
48 .midrc = RX_MID_USEC,
49 .mincheck = 1050,
50 .maxcheck = 1900,
51 .rx_min_usec = RX_MIN_USEC, // any of first 4 channels below this value will trigger rx loss detection
52 .rx_max_usec = RX_MAX_USEC, // any of first 4 channels above this value will trigger rx loss detection
53 .rssi_src_frame_errors = false,
54 .rssi_channel = 0,
55 .rssi_scale = RSSI_SCALE_DEFAULT,
56 .rssi_offset = 0,
57 .rssi_invert = 0,
58 .rssi_src_frame_lpf_period = 30,
59 .fpvCamAngleDegrees = 0,
60 .airModeActivateThreshold = 25,
61 .max_aux_channel = DEFAULT_AUX_CHANNEL_COUNT,
62 .rc_smoothing_mode = 1,
63 .rc_smoothing_setpoint_cutoff = 0,
64 .rc_smoothing_feedforward_cutoff = 0,
65 .rc_smoothing_throttle_cutoff = 0,
66 .rc_smoothing_debug_axis = ROLL,
67 .rc_smoothing_auto_factor_rpy = 30,
68 .rc_smoothing_auto_factor_throttle = 30,
69 .srxl2_unit_id = 1,
70 .srxl2_baud_fast = true,
71 .sbus_baud_fast = false,
72 .crsf_use_rx_snr = false,
73 .msp_override_channels_mask = 0,
74 .crsf_use_negotiated_baud = false,
77 #ifdef RX_CHANNELS_TAER
78 parseRcChannels("TAER1234", rxConfig);
79 #else
80 parseRcChannels("AETR1234", rxConfig);
81 #endif
84 #endif