aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-04-26 12:04:16 +0200
committerLorenz Meier <lm@inf.ethz.ch>2015-04-26 12:04:16 +0200
commit1b6742cebe649fcdf55c2fa4b85b0eb30cf4c169 (patch)
treef96e99c18a5633448913fcc3d8d05730a228d6b6
parent585c5334be924d974016074d29afe724459d285c (diff)
downloadpx4-firmware-1b6742cebe649fcdf55c2fa4b85b0eb30cf4c169.tar.gz
px4-firmware-1b6742cebe649fcdf55c2fa4b85b0eb30cf4c169.tar.bz2
px4-firmware-1b6742cebe649fcdf55c2fa4b85b0eb30cf4c169.zip
commander: Better user feedback after resolving preflight check warnings
-rw-r--r--src/modules/commander/state_machine_helper.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp
index 9aba61e14..bd31be7ac 100644
--- a/src/modules/commander/state_machine_helper.cpp
+++ b/src/modules/commander/state_machine_helper.cpp
@@ -211,7 +211,7 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s
valid_transition = true;
}
- /* Sensors need to be initialized for STANDBY state */
+ // Sensors need to be initialized for STANDBY state
if (new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY && !status->condition_system_sensors_initialized) {
mavlink_and_console_log_critical(mavlink_fd, "Not ready to fly: Sensors not operational.");
feedback_provided = true;
@@ -219,15 +219,23 @@ arming_state_transition(struct vehicle_status_s *status, ///< current vehicle s
status->arming_state = vehicle_status_s::ARMING_STATE_STANDBY_ERROR;
}
- /* Check if we are trying to arm, checks look good but we are in STANDBY_ERROR */
- if (status->arming_state == vehicle_status_s::ARMING_STATE_STANDBY_ERROR &&
- new_arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
- if (status->condition_system_sensors_initialized) {
- mavlink_and_console_log_critical(mavlink_fd, "Preflight check now OK, power cycle before arming");
- } else {
- mavlink_and_console_log_critical(mavlink_fd, "Preflight check failed, refusing to arm");
+ // Check if we are trying to arm, checks look good but we are in STANDBY_ERROR
+ if (status->arming_state == vehicle_status_s::ARMING_STATE_STANDBY_ERROR) {
+
+ if (new_arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
+
+ if (status->condition_system_sensors_initialized) {
+ mavlink_and_console_log_critical(mavlink_fd, "Preflight check now OK, power cycle before arming");
+ } else {
+ mavlink_and_console_log_critical(mavlink_fd, "Preflight check failed, refusing to arm");
+ }
+ feedback_provided = true;
+
+ } else if ((new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY) &&
+ status->condition_system_sensors_initialized) {
+ mavlink_and_console_log_critical(mavlink_fd, "Preflight check resolved, power cycle to complete");
+ feedback_provided = true;
}
- feedback_provided = true;
}
// Finish up the state transition