Skip to content

Commit

Permalink
AP_Arming: correct compilation when RC_Channels library not available
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Dec 11, 2023
1 parent 75217ec commit d7c638d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion libraries/AP_Arming/AP_Arming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
{
Expand All @@ -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)
{
Expand Down

0 comments on commit d7c638d

Please sign in to comment.