From d7c638de348deffeaca8df500b1613da70d97c1e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 8 Dec 2023 13:12:45 +1100 Subject: [PATCH] AP_Arming: correct compilation when RC_Channels library not available --- libraries/AP_Arming/AP_Arming.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Arming/AP_Arming.cpp b/libraries/AP_Arming/AP_Arming.cpp index b617c6d134c49..9828e060216fb 100644 --- a/libraries/AP_Arming/AP_Arming.cpp +++ b/libraries/AP_Arming/AP_Arming.cpp @@ -714,6 +714,7 @@ bool AP_Arming::hardware_safety_check(bool report) return true; } +#if AP_RC_CHANNEL_ENABLED bool AP_Arming::rc_arm_checks(AP_Arming::Method method) { // don't check the trims if we are in a failsafe @@ -831,6 +832,7 @@ bool AP_Arming::manual_transmitter_checks(bool report) return rc_in_calibration_check(report); } +#endif // AP_RC_CHANNEL_ENABLED bool AP_Arming::mission_checks(bool report) { @@ -1519,6 +1521,7 @@ bool AP_Arming::estop_checks(bool display_failure) // not emergency-stopped, so no prearm failure: return true; } +#if AP_RC_CHANNEL_ENABLED // vehicle is emergency-stopped; if this *appears* to have been done via switch then we do not fail prearms: const RC_Channel *chan = rc().find_channel_for_option(RC_Channel::AUX_FUNC::ARM_EMERGENCY_STOP); if (chan != nullptr) { @@ -1527,7 +1530,8 @@ bool AP_Arming::estop_checks(bool display_failure) // switch is configured and is in estop position, so likely the reason we are estopped, so no prearm failure return true; // no prearm failure } - } + } +#endif // AP_RC_CHANNEL_ENABLED check_failed(display_failure,"Motors Emergency Stopped"); return false; } @@ -1554,7 +1558,9 @@ bool AP_Arming::pre_arm_checks(bool report) & gps_checks(report) & battery_checks(report) & logging_checks(report) +#if AP_RC_CHANNEL_ENABLED & manual_transmitter_checks(report) +#endif & mission_checks(report) & rangefinder_checks(report) & servo_checks(report) @@ -1572,7 +1578,9 @@ bool AP_Arming::pre_arm_checks(bool report) #if AP_ARMING_AUX_AUTH_ENABLED & aux_auth_checks(report) #endif +#if AP_RC_CHANNEL_ENABLED & disarm_switch_checks(report) +#endif & fence_checks(report) & opendroneid_checks(report) & serial_protocol_checks(report) @@ -1588,11 +1596,13 @@ bool AP_Arming::pre_arm_checks(bool report) bool AP_Arming::arm_checks(AP_Arming::Method method) { +#if AP_RC_CHANNEL_ENABLED if (check_enabled(ARMING_CHECK_RC)) { if (!rc_arm_checks(method)) { return false; } } +#endif // ensure the GPS drivers are ready on any final changes if (check_enabled(ARMING_CHECK_GPS_CONFIG)) { @@ -1768,6 +1778,7 @@ AP_Arming::Required AP_Arming::arming_required() const return require; } +#if AP_RC_CHANNEL_ENABLED // Copter and sub share the same RC input limits // Copter checks that min and max have been configured by default, Sub does not bool AP_Arming::rc_checks_copter_sub(const bool display_failure, const RC_Channel *channels[4]) const @@ -1796,6 +1807,7 @@ bool AP_Arming::rc_checks_copter_sub(const bool display_failure, const RC_Channe } return ret; } +#endif // AP_RC_CHANNEL_ENABLED // check visual odometry is working bool AP_Arming::visodom_checks(bool display_failure) const @@ -1818,6 +1830,7 @@ bool AP_Arming::visodom_checks(bool display_failure) const return true; } +#if AP_RC_CHANNEL_ENABLED // check disarm switch is asserted bool AP_Arming::disarm_switch_checks(bool display_failure) const { @@ -1830,6 +1843,7 @@ bool AP_Arming::disarm_switch_checks(bool display_failure) const return true; } +#endif // AP_RC_CHANNEL_ENABLED void AP_Arming::Log_Write_Arm(const bool forced, const AP_Arming::Method method) {