From 1225d4c88fdd5305cd1fecae4881a789f80b8966 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 16 May 2023 11:35:46 +1000 Subject: [PATCH] AP_RCProtocol: add separate define for AP_RCPROTOCOL_ST24_ENABLED --- libraries/AP_RCProtocol/AP_RCProtocol.cpp | 4 ++++ libraries/AP_RCProtocol/AP_RCProtocol.h | 4 ++++ libraries/AP_RCProtocol/AP_RCProtocol_ST24.cpp | 4 ++-- libraries/AP_RCProtocol/AP_RCProtocol_ST24.h | 4 ++-- libraries/AP_RCProtocol/AP_RCProtocol_config.h | 4 ++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libraries/AP_RCProtocol/AP_RCProtocol.cpp b/libraries/AP_RCProtocol/AP_RCProtocol.cpp index 236a94f9d3..8b3756186a 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol.cpp +++ b/libraries/AP_RCProtocol/AP_RCProtocol.cpp @@ -66,7 +66,9 @@ void AP_RCProtocol::init() #if AP_RCPROTOCOL_FPORT2_ENABLED backend[AP_RCProtocol::FPORT2] = new AP_RCProtocol_FPort2(*this, true); #endif +#if AP_RCPROTOCOL_ST24_ENABLED backend[AP_RCProtocol::ST24] = new AP_RCProtocol_ST24(*this); +#endif #if AP_RCPROTOCOL_FPORT_ENABLED backend[AP_RCProtocol::FPORT] = new AP_RCProtocol_FPort(*this, true); #endif @@ -451,8 +453,10 @@ const char *AP_RCProtocol::protocol_name_from_protocol(rcprotocol_t protocol) case CRSF: return "CRSF"; #endif +#if AP_RCPROTOCOL_ST24_ENABLED case ST24: return "ST24"; +#endif #if AP_RCPROTOCOL_FPORT_ENABLED case FPORT: return "FPORT"; diff --git a/libraries/AP_RCProtocol/AP_RCProtocol.h b/libraries/AP_RCProtocol/AP_RCProtocol.h index 90c8667627..54fd104b9e 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol.h +++ b/libraries/AP_RCProtocol/AP_RCProtocol.h @@ -49,7 +49,9 @@ public: #if AP_RCPROTOCOL_CRSF_ENABLED CRSF = 8, #endif +#if AP_RCPROTOCOL_ST24_ENABLED ST24 = 9, +#endif #if AP_RCPROTOCOL_FPORT_ENABLED FPORT = 10, #endif @@ -126,7 +128,9 @@ public: #if AP_RCPROTOCOL_SRXL2_ENABLED case SRXL2: #endif +#if AP_RCPROTOCOL_ST24_ENABLED case ST24: +#endif case NONE: return false; } diff --git a/libraries/AP_RCProtocol/AP_RCProtocol_ST24.cpp b/libraries/AP_RCProtocol/AP_RCProtocol_ST24.cpp index 534b6ac78f..9b37ad1578 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol_ST24.cpp +++ b/libraries/AP_RCProtocol/AP_RCProtocol_ST24.cpp @@ -44,7 +44,7 @@ */ #include "AP_RCProtocol_config.h" -#if AP_RCPROTOCOL_ENABLED +#if AP_RCPROTOCOL_ST24_ENABLED #include "AP_RCProtocol_ST24.h" @@ -238,4 +238,4 @@ void AP_RCProtocol_ST24::process_byte(uint8_t byte, uint32_t baudrate) _process_byte(byte); } -#endif // AP_RCPROTOCOL_ENABLED +#endif // AP_RCPROTOCOL_ST24_ENABLED diff --git a/libraries/AP_RCProtocol/AP_RCProtocol_ST24.h b/libraries/AP_RCProtocol/AP_RCProtocol_ST24.h index 993d42dc79..45f73225bd 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol_ST24.h +++ b/libraries/AP_RCProtocol/AP_RCProtocol_ST24.h @@ -19,7 +19,7 @@ #include "AP_RCProtocol_config.h" -#if AP_RCPROTOCOL_ENABLED +#if AP_RCPROTOCOL_ST24_ENABLED #include "AP_RCProtocol_Backend.h" #include "SoftSerial.h" @@ -154,4 +154,4 @@ private: SoftSerial ss{115200, SoftSerial::SERIAL_CONFIG_8N1}; }; -#endif // AP_RCPROTOCOL_ENABLED +#endif // AP_RCPROTOCOL_ST24_ENABLED diff --git a/libraries/AP_RCProtocol/AP_RCProtocol_config.h b/libraries/AP_RCProtocol/AP_RCProtocol_config.h index ab9ba7dcda..c1e5f766bf 100644 --- a/libraries/AP_RCProtocol/AP_RCProtocol_config.h +++ b/libraries/AP_RCProtocol/AP_RCProtocol_config.h @@ -34,6 +34,10 @@ #define AP_RCPROTOCOL_SRXL2_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED #endif +#ifndef AP_RCPROTOCOL_ST24_ENABLED +#define AP_RCPROTOCOL_ST24_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED +#endif + #ifndef AP_RCPROTOCOL_SBUS_NI_ENABLED #define AP_RCPROTOCOL_SBUS_NI_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED && AP_RCPROTOCOL_SBUS_ENABLED