mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-19 04:19:07 +08:00
commander arm_auth check last
This commit is contained in:
parent
a2bc0bd947
commit
f2104217d4
@ -970,7 +970,7 @@ bool prearm_check(orb_advert_t *mavlink_log_pub, const vehicle_status_flags_s &s
|
||||
}
|
||||
|
||||
// Arm Requirements: mission
|
||||
if (prearm_ok && (arm_requirements & ARM_REQ_MISSION_BIT)) {
|
||||
if (arm_requirements & ARM_REQ_MISSION_BIT) {
|
||||
|
||||
if (!status_flags.condition_auto_mission_available) {
|
||||
if (prearm_ok && reportFailures) {
|
||||
@ -990,24 +990,21 @@ bool prearm_check(orb_advert_t *mavlink_log_pub, const vehicle_status_flags_s &s
|
||||
}
|
||||
|
||||
// Arm Requirements: global position
|
||||
if ((arm_requirements & ARM_REQ_GPS_BIT) && (!status_flags.condition_global_position_valid)) {
|
||||
if (prearm_ok && reportFailures) {
|
||||
mavlink_log_critical(mavlink_log_pub, "ARMING DENIED: global position required");
|
||||
}
|
||||
if (arm_requirements & ARM_REQ_GPS_BIT) {
|
||||
|
||||
prearm_ok = false;
|
||||
}
|
||||
if (!status_flags.condition_global_position_valid) {
|
||||
if (prearm_ok && reportFailures) {
|
||||
mavlink_log_critical(mavlink_log_pub, "ARMING DENIED: global position required");
|
||||
}
|
||||
|
||||
// Arm Requirements: authorization
|
||||
if (arm_requirements & ARM_REQ_ARM_AUTH_BIT) {
|
||||
if (arm_auth_check() != vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED) {
|
||||
// feedback provided in arm_auth_check
|
||||
prearm_ok = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// safety button (check last)
|
||||
if (prearm_ok && safety.safety_switch_available && !safety.safety_off) {
|
||||
// safety button
|
||||
if (safety.safety_switch_available && !safety.safety_off) {
|
||||
// Fail transition if we need safety switch press
|
||||
if (prearm_ok && reportFailures) {
|
||||
mavlink_log_critical(mavlink_log_pub, "ARMING DENIED: Press safety switch first");
|
||||
@ -1016,5 +1013,14 @@ bool prearm_check(orb_advert_t *mavlink_log_pub, const vehicle_status_flags_s &s
|
||||
prearm_ok = false;
|
||||
}
|
||||
|
||||
// Arm Requirements: authorization
|
||||
// check last, and only if everything else has passed
|
||||
if ((arm_requirements & ARM_REQ_ARM_AUTH_BIT) && prearm_ok) {
|
||||
if (arm_auth_check() != vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED) {
|
||||
// feedback provided in arm_auth_check
|
||||
prearm_ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
return prearm_ok;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user