Simplified configuration of fast SBus.

This commit is contained in:
mikeller 2019-08-13 22:17:33 +12:00
parent 52173c7981
commit c31c8f9fbb
6 changed files with 15 additions and 17 deletions

View File

@ -708,6 +708,9 @@ const clivalue_t valueTable[] = {
#ifdef USE_SERIALRX_SRXL2
{ "srxl2_unit_id", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 0xf }, PG_RX_CONFIG, offsetof(rxConfig_t, srxl2_unit_id) },
{ "srxl2_baud_fast", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RX_CONFIG, offsetof(rxConfig_t, srxl2_baud_fast) },
#endif
#if defined(USE_SERIALRX_SBUS)
{ "sbus_baud_fast", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_RX_CONFIG, offsetof(rxConfig_t, sbus_baud_fast) },
#endif
{ "airmode_start_throttle_percent", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, 100 }, PG_RX_CONFIG, offsetof(rxConfig_t, airModeActivateThreshold) },
{ "rx_min_usec", VAR_UINT16 | MASTER_VALUE, .config.minmaxUnsigned = { PWM_PULSE_MIN, PWM_PULSE_MAX }, PG_RX_CONFIG, offsetof(rxConfig_t, rx_min_usec) },

View File

@ -70,7 +70,8 @@ void pgResetFn_rxConfig(rxConfig_t *rxConfig)
.rc_smoothing_derivative_type = RC_SMOOTHING_DERIVATIVE_BIQUAD,
.rc_smoothing_auto_factor = 10,
.srxl2_unit_id = 1,
.srxl2_baud_fast = 1,
.srxl2_baud_fast = true,
.sbus_baud_fast = false,
);
#ifdef RX_CHANNELS_TAER

View File

@ -62,8 +62,9 @@ typedef struct rxConfig_s {
uint8_t rc_smoothing_auto_factor; // Used to adjust the "smoothness" determined by the auto cutoff calculations
uint8_t rssi_src_frame_lpf_period; // Period of the cutoff frequency for the source frame RSSI filter (in 0.1 s)
uint8_t srxl2_unit_id;
uint8_t srxl2_baud_fast;
uint8_t srxl2_unit_id; // Spektrum SRXL2 RX unit id
uint8_t srxl2_baud_fast; // Select Spektrum SRXL2 fast baud rate
uint8_t sbus_baud_fast; // Select SBus fast baud rate
} rxConfig_t;
PG_DECLARE(rxConfig_t, rxConfig);

View File

@ -198,7 +198,6 @@ bool serialRxInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig
#endif
#ifdef USE_SERIALRX_SBUS
case SERIALRX_SBUS:
case SERIALRX_DJI_HDL_7MS:
enabled = sbusInit(rxConfig, rxRuntimeConfig);
break;
#endif

View File

@ -66,8 +66,7 @@ typedef enum {
SERIALRX_SRXL = 10,
SERIALRX_TARGET_CUSTOM = 11,
SERIALRX_FPORT = 12,
SERIALRX_DJI_HDL_7MS = 13,
SERIALRX_SRXL2 = 14,
SERIALRX_SRXL2 = 13,
} SerialRXType;
#define MAX_SUPPORTED_RC_PPM_CHANNEL_COUNT 12

View File

@ -60,9 +60,8 @@
#define SBUS_RX_REFRESH_RATE 11000
#define SBUS_TIME_NEEDED_PER_FRAME 3000
#define DJI_HDL_BAUDRATE 200000
#define DJI_HDL_RX_REFRESH_RATE 6000
#define DJI_HDL_TIME_NEEDED_PER_FRAME 3000
#define SBUS_FAST_BAUDRATE 200000
#define SBUS_FAST_RX_REFRESH_RATE 6000
#define SBUS_STATE_FAILSAFE (1 << 0)
#define SBUS_STATE_SIGNALLOSS (1 << 1)
@ -84,8 +83,6 @@ enum {
DEBUG_SBUS_FRAME_TIME,
};
static uint32_t sbusTimeNeededPreFrame = SBUS_TIME_NEEDED_PER_FRAME;
struct sbusFrame_s {
uint8_t syncByte;
sbusChannels_t channels;
@ -121,7 +118,7 @@ static void sbusDataReceive(uint16_t c, void *data)
const int32_t sbusFrameTime = nowUs - sbusFrameData->startAtUs;
if (sbusFrameTime > (long)(sbusTimeNeededPreFrame + 500)) {
if (sbusFrameTime > (long)(SBUS_TIME_NEEDED_PER_FRAME + 500)) {
sbusFrameData->position = 0;
}
@ -168,14 +165,12 @@ bool sbusInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
rxRuntimeConfig->channelCount = SBUS_MAX_CHANNEL;
if (rxConfig->serialrx_provider == SERIALRX_DJI_HDL_7MS) {
rxRuntimeConfig->rxRefreshRate = DJI_HDL_RX_REFRESH_RATE;
sbusBaudRate = DJI_HDL_BAUDRATE;
sbusTimeNeededPreFrame = DJI_HDL_TIME_NEEDED_PER_FRAME;
if (rxConfig->sbus_baud_fast) {
rxRuntimeConfig->rxRefreshRate = SBUS_FAST_RX_REFRESH_RATE;
sbusBaudRate = SBUS_FAST_BAUDRATE;
} else {
rxRuntimeConfig->rxRefreshRate = SBUS_RX_REFRESH_RATE;
sbusBaudRate = SBUS_BAUDRATE;
sbusTimeNeededPreFrame = SBUS_TIME_NEEDED_PER_FRAME;
}
rxRuntimeConfig->rcFrameStatusFn = sbusFrameStatus;