Adding option to choose SRXL as the RX protocol (in which case telem is available).

This commit is contained in:
blckmn 2017-01-10 09:39:03 +11:00
parent 5f18cedd7a
commit 3985bda593
4 changed files with 24 additions and 17 deletions

View File

@ -271,7 +271,8 @@ static const char * const lookupTableSerialRX[] = {
"XB-B-RJ01",
"IBUS",
"JETIEXBUS",
"CRSF"
"CRSF",
"SRXL"
};
#endif

View File

@ -154,6 +154,7 @@ bool serialRxInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig
bool enabled = false;
switch (rxConfig->serialrx_provider) {
#ifdef USE_SERIALRX_SPEKTRUM
case SERIALRX_SRXL:
case SERIALRX_SPEKTRUM1024:
case SERIALRX_SPEKTRUM2048:
enabled = spektrumInit(rxConfig, rxRuntimeConfig);

View File

@ -55,7 +55,8 @@ typedef enum {
SERIALRX_XBUS_MODE_B_RJ01 = 6,
SERIALRX_IBUS = 7,
SERIALRX_JETIEXBUS = 8,
SERIALRX_CRSF = 9
SERIALRX_CRSF = 9,
SERIALRX_SRXL = 10,
} SerialRXType;
#define MAX_SUPPORTED_RC_PPM_CHANNEL_COUNT 12

View File

@ -62,6 +62,7 @@ static uint8_t spek_chan_shift;
static uint8_t spek_chan_mask;
static bool rcFrameComplete = false;
static bool spekHiRes = false;
static bool srxlEnabled = false;
// Variables used for calculating a signal strength from satellite fade.
// This is time-variant and computed every second based on the fade
@ -155,8 +156,8 @@ static uint8_t spektrumFrameStatus(void)
}
}
/* only process if 2048, some data in buffer AND servos in phase 0 */
if (spekHiRes && telemetryBufLen && (spekFrame[2] & 0x80)) {
/* only process if srxl enabled, some data in buffer AND servos in phase 0 */
if (srxlEnabled && telemetryBufLen && (spekFrame[2] & 0x80)) {
dispatchAdd(&srxlTelemetryDispatch, 100);
}
return RX_FRAME_COMPLETE;
@ -259,7 +260,23 @@ bool spektrumInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig
{
rxRuntimeConfigPtr = rxRuntimeConfig;
const serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_RX_SERIAL);
if (!portConfig) {
return false;
}
srxlEnabled = false;
#ifdef TELEMETRY
bool portShared = telemetryCheckRxPortShared(portConfig);
#else
bool portShared = false;
#endif
switch (rxConfig->serialrx_provider) {
case SERIALRX_SRXL:
#ifdef TELEMETRY
srxlEnabled = (feature(FEATURE_TELEMETRY) && !portShared && rxConfig->serialrx_provider == SERIALRX_SRXL);
#endif
case SERIALRX_SPEKTRUM2048:
// 11 bit frames
spek_chan_shift = 3;
@ -281,19 +298,6 @@ bool spektrumInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig
rxRuntimeConfig->rcReadRawFn = spektrumReadRawRC;
rxRuntimeConfig->rcFrameStatusFn = spektrumFrameStatus;
const serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_RX_SERIAL);
if (!portConfig) {
return false;
}
#ifdef TELEMETRY
bool portShared = telemetryCheckRxPortShared(portConfig);
bool srxlEnabled = (feature(FEATURE_TELEMETRY) && !portShared && rxConfig->serialrx_provider == SERIALRX_SPEKTRUM2048);
#else
bool srxlEnabled = false;
bool portShared = false;
#endif
serialPort = openSerialPort(portConfig->identifier,
FUNCTION_RX_SERIAL,
spektrumDataReceive,