diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-02-17 22:51:13 +0400 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-02-17 22:51:13 +0400 |
commit | 2a49175b1fdc9a70a1c1828905416688332384b7 (patch) | |
tree | 24a8dd2c39052063334fc2fd44b70961aca87890 /src | |
parent | 3b270fbdab60c0fac1c76dff170b0a9b6f494e8d (diff) | |
parent | 8bc0287eccc7871db17c199a3b330e74c92c068a (diff) | |
download | px4-firmware-2a49175b1fdc9a70a1c1828905416688332384b7.tar.gz px4-firmware-2a49175b1fdc9a70a1c1828905416688332384b7.tar.bz2 px4-firmware-2a49175b1fdc9a70a1c1828905416688332384b7.zip |
Merge branch 'safety_disarm' into offboard2
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/commander/commander.cpp | 12 | ||||
-rw-r--r-- | src/modules/mc_att_control/mc_att_control_main.cpp | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 4a69318c9..f0debef1c 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -908,11 +908,13 @@ int commander_thread_main(int argc, char *argv[]) if (updated) { orb_copy(ORB_ID(safety), safety_sub, &safety); - // XXX this would be the right approach to do it, but do we *WANT* this? - // /* disarm if safety is now on and still armed */ - // if (safety.safety_switch_available && !safety.safety_off) { - // (void)arming_state_transition(&status, &safety, ARMING_STATE_STANDBY, &armed); - // } + /* disarm if safety is now on and still armed */ + if (safety.safety_switch_available && !safety.safety_off && armed.armed) { + arming_state_t new_arming_state = (status.arming_state == ARMING_STATE_ARMED ? ARMING_STATE_STANDBY : ARMING_STATE_STANDBY_ERROR); + if (TRANSITION_CHANGED == arming_state_transition(&status, &safety, new_arming_state, &armed)) { + mavlink_log_info(mavlink_fd, "[cmd] DISARMED by safety switch"); + } + } } /* update global position estimate */ diff --git a/src/modules/mc_att_control/mc_att_control_main.cpp b/src/modules/mc_att_control/mc_att_control_main.cpp index 8de0f0b39..38fde0cac 100644 --- a/src/modules/mc_att_control/mc_att_control_main.cpp +++ b/src/modules/mc_att_control/mc_att_control_main.cpp @@ -262,7 +262,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() : _actuators_0_pub(-1), /* performance counters */ - _loop_perf(perf_alloc(PC_ELAPSED, "fw att control")) + _loop_perf(perf_alloc(PC_ELAPSED, "mc att control")) { memset(&_v_att, 0, sizeof(_v_att)); |