From 16e21d42ee06d7cdda262498cda33021aab8d9cc Mon Sep 17 00:00:00 2001 From: Henry Wurzburg Date: Fri, 21 Oct 2022 13:50:45 -0500 Subject: [PATCH] AP_Arming: move multiple RC input error to pre-arm failure --- libraries/AP_Arming/AP_Arming.cpp | 15 ++++++++++++++- libraries/AP_Arming/AP_Arming.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Arming/AP_Arming.cpp b/libraries/AP_Arming/AP_Arming.cpp index 4073de0fcc..f6643b1896 100644 --- a/libraries/AP_Arming/AP_Arming.cpp +++ b/libraries/AP_Arming/AP_Arming.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #if HAL_MAX_CAN_PROTOCOL_DRIVERS #include @@ -1407,6 +1408,16 @@ bool AP_Arming::opendroneid_checks(bool display_failure) return true; } +//Check for multiple RC in serial protocols +bool AP_Arming::serial_protocol_checks(bool display_failure) +{ + if (AP::serialmanager().have_serial(AP_SerialManager::SerialProtocol_RCIN, 1)) { + check_failed(display_failure, "Multiple SERIAL ports configured for RC input"); + return false; + } + return true; +} + bool AP_Arming::pre_arm_checks(bool report) { #if !APM_BUILD_COPTER_OR_HELI @@ -1445,7 +1456,8 @@ bool AP_Arming::pre_arm_checks(bool report) & aux_auth_checks(report) & disarm_switch_checks(report) & fence_checks(report) - & opendroneid_checks(report); + & opendroneid_checks(report) + & serial_protocol_checks(report); } bool AP_Arming::arm_checks(AP_Arming::Method method) @@ -1503,6 +1515,7 @@ bool AP_Arming::mandatory_checks(bool report) ret &= opendroneid_checks(report); #endif ret &= rc_in_calibration_check(report); + ret &= serial_protocol_checks(report); return ret; } diff --git a/libraries/AP_Arming/AP_Arming.h b/libraries/AP_Arming/AP_Arming.h index b32543d52b..19af52eef3 100644 --- a/libraries/AP_Arming/AP_Arming.h +++ b/libraries/AP_Arming/AP_Arming.h @@ -201,6 +201,8 @@ protected: bool generator_checks(bool report) const; bool opendroneid_checks(bool display_failure); + + bool serial_protocol_checks(bool display_failure); virtual bool system_checks(bool report);