AP_RCProtocol: add add use AP_RCPROTOCOL_SRXL2_ENABLED

This commit is contained in:
Peter Barker 2023-04-26 17:19:07 +10:00 committed by Peter Barker
parent feaed97601
commit b3b46f7be6
5 changed files with 24 additions and 2 deletions

View File

@ -48,7 +48,9 @@ void AP_RCProtocol::init()
#endif #endif
#ifndef IOMCU_FW #ifndef IOMCU_FW
backend[AP_RCProtocol::SBUS_NI] = new AP_RCProtocol_SBUS(*this, false, 100000); backend[AP_RCProtocol::SBUS_NI] = new AP_RCProtocol_SBUS(*this, false, 100000);
#if AP_RCPROTOCOL_SRXL2_ENABLED
backend[AP_RCProtocol::SRXL2] = new AP_RCProtocol_SRXL2(*this); backend[AP_RCProtocol::SRXL2] = new AP_RCProtocol_SRXL2(*this);
#endif
backend[AP_RCProtocol::CRSF] = new AP_RCProtocol_CRSF(*this); backend[AP_RCProtocol::CRSF] = new AP_RCProtocol_CRSF(*this);
#if AP_RCPROTOCOL_FPORT2_ENABLED #if AP_RCPROTOCOL_FPORT2_ENABLED
backend[AP_RCProtocol::FPORT2] = new AP_RCProtocol_FPort2(*this, true); backend[AP_RCProtocol::FPORT2] = new AP_RCProtocol_FPort2(*this, true);
@ -424,8 +426,10 @@ const char *AP_RCProtocol::protocol_name_from_protocol(rcprotocol_t protocol)
case SRXL: case SRXL:
return "SRXL"; return "SRXL";
#endif #endif
#if AP_RCPROTOCOL_SRXL2_ENABLED
case SRXL2: case SRXL2:
return "SRXL2"; return "SRXL2";
#endif
case CRSF: case CRSF:
return "CRSF"; return "CRSF";
case ST24: case ST24:

View File

@ -42,7 +42,9 @@ public:
#if AP_RCPROTOCOL_SRXL_ENABLED #if AP_RCPROTOCOL_SRXL_ENABLED
SRXL = 6, SRXL = 6,
#endif #endif
#if AP_RCPROTOCOL_SRXL2_ENABLED
SRXL2 = 7, SRXL2 = 7,
#endif
CRSF = 8, CRSF = 8,
ST24 = 9, ST24 = 9,
#if AP_RCPROTOCOL_FPORT_ENABLED #if AP_RCPROTOCOL_FPORT_ENABLED
@ -102,7 +104,9 @@ public:
#if AP_RCPROTOCOL_SRXL_ENABLED #if AP_RCPROTOCOL_SRXL_ENABLED
case SRXL: case SRXL:
#endif #endif
#if AP_RCPROTOCOL_SRXL2_ENABLED
case SRXL2: case SRXL2:
#endif
case ST24: case ST24:
case NONE: case NONE:
return false; return false;

View File

@ -17,6 +17,10 @@
Code by Andy Piper Code by Andy Piper
*/ */
#include "AP_RCProtocol_config.h"
#if AP_RCPROTOCOL_SRXL2_ENABLED
#include "AP_RCProtocol.h" #include "AP_RCProtocol.h"
#include "AP_RCProtocol_SRXL2.h" #include "AP_RCProtocol_SRXL2.h"
#include <AP_Math/AP_Math.h> #include <AP_Math/AP_Math.h>
@ -406,3 +410,5 @@ void srxlOnVtx(SrxlVtxData* pVtxData)
AP_RCProtocol_Backend::configure_vtx(pVtxData->band, pVtxData->channel, pVtxData->power, pVtxData->pit); AP_RCProtocol_Backend::configure_vtx(pVtxData->band, pVtxData->channel, pVtxData->power, pVtxData->pit);
#endif #endif
} }
#endif // AP_RCPROTOCOL_SRXL2_ENABLED

View File

@ -15,9 +15,11 @@
#pragma once #pragma once
#include "AP_RCProtocol_config.h"
#if AP_RCPROTOCOL_SRXL2_ENABLED
#include "AP_RCProtocol.h" #include "AP_RCProtocol.h"
#include <AP_Math/AP_Math.h>
#include "AP_RCProtocol_SRXL.h"
#include "SoftSerial.h" #include "SoftSerial.h"
#define SRXL2_MAX_CHANNELS 32U /* Maximum number of channels from srxl2 datastream */ #define SRXL2_MAX_CHANNELS 32U /* Maximum number of channels from srxl2 datastream */
@ -74,3 +76,5 @@ private:
uint32_t _last_handshake_ms; uint32_t _last_handshake_ms;
uint32_t _handshake_start_ms; uint32_t _handshake_start_ms;
}; };
#endif // AP_RCPROTOCOL_SRXL2_ENABLED

View File

@ -21,3 +21,7 @@
#ifndef AP_RCPROTOCOL_SRXL_ENABLED #ifndef AP_RCPROTOCOL_SRXL_ENABLED
#define AP_RCPROTOCOL_SRXL_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED #define AP_RCPROTOCOL_SRXL_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED
#endif #endif
#ifndef AP_RCPROTOCOL_SRXL2_ENABLED
#define AP_RCPROTOCOL_SRXL2_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED
#endif