Skip to content

Commit

Permalink
commander arm_auth check last
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Apr 1, 2018
1 parent 109ab8c commit b6452f6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/modules/commander/state_machine_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,15 +998,7 @@ bool prearm_check(orb_advert_t *mavlink_log_pub, const vehicle_status_flags_s &s
prearm_ok = false;
}

// 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)
// safety button
if (prearm_ok && safety.safety_switch_available && !safety.safety_off) {
// Fail transition if we need safety switch press
if (prearm_ok && reportFailures) {
Expand All @@ -1016,5 +1008,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;
}

0 comments on commit b6452f6

Please sign in to comment.