From 993da19f270fa1f6fcca42d40a11304e1ed31253 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Thu, 6 Jul 2023 13:25:30 +0100 Subject: [PATCH] AP_SerialManager: check for incorrect usage of old HAL_SERIALx_PROTOCOL --- .../AP_SerialManager/AP_SerialManager.cpp | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/libraries/AP_SerialManager/AP_SerialManager.cpp b/libraries/AP_SerialManager/AP_SerialManager.cpp index 40eccb313ea88..39e687a441248 100644 --- a/libraries/AP_SerialManager/AP_SerialManager.cpp +++ b/libraries/AP_SerialManager/AP_SerialManager.cpp @@ -35,6 +35,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL0_BAUD #define DEFAULT_SERIAL0_BAUD AP_SERIALMANAGER_CONSOLE_BAUD #endif +#ifdef HAL_SERIAL0_PROTOCOL +#error "Please use DEFAULT_SERIAL0_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL1_PROTOCOL #define DEFAULT_SERIAL1_PROTOCOL SerialProtocol_MAVLink2 @@ -45,6 +48,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL1_OPTIONS #define DEFAULT_SERIAL1_OPTIONS 0 #endif +#ifdef HAL_SERIAL1_PROTOCOL +#error "Please use DEFAULT_SERIAL1_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL2_PROTOCOL #define DEFAULT_SERIAL2_PROTOCOL SerialProtocol_MAVLink2 @@ -55,6 +61,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL2_OPTIONS #define DEFAULT_SERIAL2_OPTIONS 0 #endif +#ifdef HAL_SERIAL2_PROTOCOL +#error "Please use DEFAULT_SERIAL2_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL3_PROTOCOL #define DEFAULT_SERIAL3_PROTOCOL SerialProtocol_GPS @@ -65,6 +74,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL3_OPTIONS #define DEFAULT_SERIAL3_OPTIONS 0 #endif +#ifdef HAL_SERIAL3_PROTOCOL +#error "Please use DEFAULT_SERIAL3_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL4_PROTOCOL #define DEFAULT_SERIAL4_PROTOCOL SerialProtocol_GPS @@ -75,6 +87,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL4_OPTIONS #define DEFAULT_SERIAL4_OPTIONS 0 #endif +#ifdef HAL_SERIAL4_PROTOCOL +#error "Please use DEFAULT_SERIAL4_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL5_PROTOCOL #define DEFAULT_SERIAL5_PROTOCOL SerialProtocol_None @@ -85,6 +100,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL5_OPTIONS #define DEFAULT_SERIAL5_OPTIONS 0 #endif +#ifdef HAL_SERIAL5_PROTOCOL +#error "Please use DEFAULT_SERIAL5_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL6_PROTOCOL #define DEFAULT_SERIAL6_PROTOCOL SerialProtocol_None @@ -95,6 +113,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL6_OPTIONS #define DEFAULT_SERIAL6_OPTIONS 0 #endif +#ifdef HAL_SERIAL6_PROTOCOL +#error "Please use DEFAULT_SERIAL6_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL7_PROTOCOL #define DEFAULT_SERIAL7_PROTOCOL SerialProtocol_None @@ -105,6 +126,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL7_OPTIONS #define DEFAULT_SERIAL7_OPTIONS 0 #endif +#ifdef HAL_SERIAL7_PROTOCOL +#error "Please use DEFAULT_SERIAL7_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL8_PROTOCOL #define DEFAULT_SERIAL8_PROTOCOL SerialProtocol_None @@ -115,6 +139,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL8_OPTIONS #define DEFAULT_SERIAL8_OPTIONS 0 #endif +#ifdef HAL_SERIAL8_PROTOCOL +#error "Please use DEFAULT_SERIAL8_PROTOCOL" +#endif #ifndef DEFAULT_SERIAL9_PROTOCOL #define DEFAULT_SERIAL9_PROTOCOL SerialProtocol_None @@ -125,6 +152,9 @@ extern const AP_HAL::HAL& hal; #ifndef DEFAULT_SERIAL9_OPTIONS #define DEFAULT_SERIAL9_OPTIONS 0 #endif +#ifdef HAL_SERIAL9_PROTOCOL +#error "Please use DEFAULT_SERIAL9_PROTOCOL" +#endif const AP_Param::GroupInfo AP_SerialManager::var_info[] = { #if SERIALMANAGER_NUM_PORTS > 0