diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-04-04 10:18:40 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-04-04 10:18:40 +0200 |
commit | 26ccac347d89874360e46f49b0f590bd33f63a55 (patch) | |
tree | 99b1d6fc3015ed4ee25220e7bd189be63d2cdb7e /src/modules | |
parent | 64cdcfc0cca78978499248054bde932f6ba27c47 (diff) | |
download | px4-firmware-26ccac347d89874360e46f49b0f590bd33f63a55.tar.gz px4-firmware-26ccac347d89874360e46f49b0f590bd33f63a55.tar.bz2 px4-firmware-26ccac347d89874360e46f49b0f590bd33f63a55.zip |
commander: Go only into armed error state if on low battery and disarmed
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/commander/commander.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 9330ef682..b0cd0b9e4 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -1553,17 +1553,10 @@ int commander_thread_main(int argc, char *argv[]) mavlink_log_emergency(mavlink_fd, "CRITICAL BATTERY, LAND IMMEDIATELY"); status.battery_warning = vehicle_status_s::VEHICLE_BATTERY_WARNING_CRITICAL; - if (armed.armed) { - arming_ret = arming_state_transition(&status, &safety, vehicle_status_s::ARMING_STATE_ARMED_ERROR, &armed, true /* fRunPreArmChecks */, - mavlink_fd); - - if (arming_ret == TRANSITION_CHANGED) { - arming_state_changed = true; - } - - } else { - arming_ret = arming_state_transition(&status, &safety, vehicle_status_s::ARMING_STATE_STANDBY_ERROR, &armed, true /* fRunPreArmChecks */, - mavlink_fd); + if (!armed.armed) { + arming_ret = arming_state_transition(&status, &safety, + vehicle_status_s::ARMING_STATE_STANDBY_ERROR, + &armed, true /* fRunPreArmChecks */, mavlink_fd); if (arming_ret == TRANSITION_CHANGED) { arming_state_changed = true; |