diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-06-26 12:14:49 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-06-26 12:14:49 +0200 |
commit | 690edbd6723746699067f69fd3c76d4d3806d9c3 (patch) | |
tree | f3044da5cfcdc98566493491a66410ab227fb877 /src/modules | |
parent | a1132580c55512a56ec7646f757099409ebad781 (diff) | |
download | px4-firmware-690edbd6723746699067f69fd3c76d4d3806d9c3.tar.gz px4-firmware-690edbd6723746699067f69fd3c76d4d3806d9c3.tar.bz2 px4-firmware-690edbd6723746699067f69fd3c76d4d3806d9c3.zip |
Remove duplicate code in the arming check
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/commander/commander.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 588f48225..8e9352394 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1232,12 +1232,13 @@ int commander_thread_main(int argc, char *argv[]) if (status.arming_state == ARMING_STATE_STANDBY && sp_man.r > STICK_ON_OFF_LIMIT && sp_man.z < 0.1f) { if (stick_on_counter > STICK_ON_OFF_COUNTER_LIMIT) { - if (safety.safety_switch_available && !safety.safety_off && status.hil_state == HIL_STATE_OFF) { - print_reject_arm("#audio: NOT ARMING: Press safety switch first."); - } else if (status.main_state != MAIN_STATE_MANUAL) { + /* we check outside of the transition function here because the requirement + * for being in manual mode only applies to manual arming actions. + * the system can be armed in auto if armed via the GCS. + */ + if (status.main_state != MAIN_STATE_MANUAL) { print_reject_arm("#audio: NOT ARMING: Switch to MANUAL mode first."); - } else { arming_res = arming_state_transition(&status, &safety, ARMING_STATE_ARMED, &armed, mavlink_fd); } |