Added option to display RX SNR dB for CRSF instead of RSSI dBm.
[betaflight.git] / src / main / pg / rx.c
blobe075b0b827d300520eb4a81fc2dd19221cabdb50
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, 2);
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 .rcInterpolation = RC_SMOOTHING_AUTO,
60 .rcInterpolationChannels = INTERPOLATION_CHANNELS_RPYT,
61 .rcInterpolationInterval = 19,
62 .fpvCamAngleDegrees = 0,
63 .airModeActivateThreshold = 25,
64 .max_aux_channel = DEFAULT_AUX_CHANNEL_COUNT,
65 .rc_smoothing_type = RC_SMOOTHING_TYPE_FILTER,
66 .rc_smoothing_input_cutoff = 0, // automatically calculate the cutoff by default
67 .rc_smoothing_derivative_cutoff = 0, // automatically calculate the cutoff by default
68 .rc_smoothing_debug_axis = ROLL, // default to debug logging for the roll axis
69 .rc_smoothing_input_type = RC_SMOOTHING_INPUT_BIQUAD,
70 .rc_smoothing_derivative_type = RC_SMOOTHING_DERIVATIVE_AUTO, // automatically choose type based on feedforward method
71 .rc_smoothing_auto_factor = 10,
72 .srxl2_unit_id = 1,
73 .srxl2_baud_fast = true,
74 .sbus_baud_fast = false,
75 .crsf_use_rx_snr = false,
78 #ifdef RX_CHANNELS_TAER
79 parseRcChannels("TAER1234", rxConfig);
80 #else
81 parseRcChannels("AETR1234", rxConfig);
82 #endif
85 #endif