From 5fb1de906c711e88a9a3ddd37cd0ccaea685a7b3 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 13 May 2016 11:39:40 +0200 Subject: [PATCH] commander: Better reporting and convenience for commander --- src/modules/commander/commander.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 5188f12ac4..3df0fbedeb 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -811,10 +811,6 @@ bool handle_command(struct vehicle_status_s *status_local, const struct safety_s if (arming_ret == TRANSITION_DENIED) { mavlink_log_critical(&mavlink_log_pub, "Rejecting arming cmd"); } - - if (main_ret == TRANSITION_DENIED) { - mavlink_log_critical(&mavlink_log_pub, "Rejecting mode switch cmd"); - } } } break; @@ -1959,7 +1955,7 @@ int commander_thread_main(int argc, char *argv[]) if ((updated && status_flags.condition_local_altitude_valid) || check_for_disarming) { if (was_landed != land_detector.landed) { - if (land_detector.landed) { + if (land_detector.landed && armed.armed) { mavlink_and_console_log_info(&mavlink_log_pub, "LANDING DETECTED"); } else { mavlink_and_console_log_info(&mavlink_log_pub, "TAKEOFF DETECTED"); @@ -2391,7 +2387,9 @@ int commander_thread_main(int argc, char *argv[]) if ((internal_state.main_state != commander_state_s::MAIN_STATE_MANUAL) && (internal_state.main_state != commander_state_s::MAIN_STATE_ACRO) && (internal_state.main_state != commander_state_s::MAIN_STATE_STAB) - && (internal_state.main_state != commander_state_s::MAIN_STATE_ALTCTL)) { + && (internal_state.main_state != commander_state_s::MAIN_STATE_ALTCTL) + && (internal_state.main_state != commander_state_s::MAIN_STATE_POSCTL) + ) { print_reject_arm("NOT ARMING: Switch to a manual mode first."); } else if (!status_flags.condition_home_position_valid && @@ -2413,7 +2411,7 @@ int commander_thread_main(int argc, char *argv[]) arming_state_changed = true; } else { usleep(100000); - print_reject_arm("NOT ARMING: Configuration error"); + print_reject_arm("NOT ARMING: Preflight checks failed"); } } stick_on_counter = 0;