From 817c0eafbc7c9153faad60945a8034fbe2eae8ef Mon Sep 17 00:00:00 2001 From: Mark Whitehorn Date: Fri, 1 Apr 2016 15:20:45 -0600 Subject: [PATCH] add low battery warning and comment out the "resolved" messages --- src/modules/commander/state_machine_helper.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index ed67b83191..eedb768752 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -95,7 +95,7 @@ static const bool arming_transitions[vehicle_status_s::ARMING_STATE_MAX][vehicle { /* vehicle_status_s::ARMING_STATE_IN_AIR_RESTORE */ false, false, false, false, false, false, false }, // NYI }; -// You can index into the array with an arming_state_t in order to get it's textual representation +// You can index into the array with an arming_state_t in order to get its textual representation static const char * const state_names[vehicle_status_s::ARMING_STATE_MAX] = { "ARMING_STATE_INIT", "ARMING_STATE_STANDBY", @@ -254,7 +254,7 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s if (new_arming_state == vehicle_status_s::ARMING_STATE_ARMED) { if (status->condition_system_sensors_initialized) { - mavlink_and_console_log_critical(mavlink_log_pub, "Preflight check resolved, reboot before arming"); +// mavlink_and_console_log_critical(mavlink_log_pub, "Preflight check resolved, reboot before arming"); } else { mavlink_and_console_log_critical(mavlink_log_pub, "Preflight check failed, refusing to arm"); } @@ -262,7 +262,7 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s } else if ((new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY) && status->condition_system_sensors_initialized) { - mavlink_and_console_log_critical(mavlink_log_pub, "Preflight check resolved, reboot to complete"); +// mavlink_and_console_log_critical(mavlink_log_pub, "Preflight check resolved, reboot to complete"); feedback_provided = true; } else { // Silent ignore @@ -885,6 +885,11 @@ int preflight_check(struct vehicle_status_s *status, orb_advert_t *mavlink_log_p } } + if (status->battery_warning == vehicle_status_s::VEHICLE_BATTERY_WARNING_CRITICAL) { + preflight_ok = false; + mavlink_and_console_log_critical(mavlink_log_pub, "LOW BATTERY, ARMING LOCKED DOWN"); + } + /* report once, then set the flag */ if (reportFailures && !preflight_ok) { status->condition_system_prearm_error_reported = true;