Skip to content

Commit

Permalink
AP_SerialManager: check for incorrect usage of old HAL_SERIALx_PROTOCOL
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per authored and peterbarker committed Jul 7, 2023
1 parent c73fa82 commit 993da19
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions libraries/AP_SerialManager/AP_SerialManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 993da19

Please sign in to comment.