aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/commander.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2015-04-19 23:07:32 +0200
committerLorenz Meier <lm@inf.ethz.ch>2015-04-20 09:14:13 +0200
commit554719c78fe4e0e07e56bc7a57877340924d0d92 (patch)
tree64fc035398efbf993ead8d2499101b7285d25e68 /src/modules/commander/commander.cpp
parent4f0896b10592e235658620ef8f4e93be4e1a7582 (diff)
downloadpx4-firmware-554719c78fe4e0e07e56bc7a57877340924d0d92.tar.gz
px4-firmware-554719c78fe4e0e07e56bc7a57877340924d0d92.tar.bz2
px4-firmware-554719c78fe4e0e07e56bc7a57877340924d0d92.zip
Harmonize preflight and prearm checks, run same code except for dynamic range check only on arming
Diffstat (limited to 'src/modules/commander/commander.cpp')
-rw-r--r--src/modules/commander/commander.cpp38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index 5c512c15c..bb1ed7f5d 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -1125,8 +1125,15 @@ int commander_thread_main(int argc, char *argv[])
commander_initialized = true;
thread_running = true;
+ bool checkAirspeed = false;
+ /* Perform airspeed check only if circuit breaker is not
+ * engaged and it's not a rotary wing */
+ if (!status.circuit_breaker_engaged_airspd_check && !status.is_rotary_wing) {
+ checkAirspeed = true;
+ }
+
//Run preflight check
- status.condition_system_sensors_initialized = Commander::preflightCheck(mavlink_fd, true, true, true, true, true);
+ status.condition_system_sensors_initialized = Commander::preflightCheck(mavlink_fd, true, true, true, true, checkAirspeed, true);
if(!status.condition_system_sensors_initialized) {
set_tune_override(TONE_GPS_WARNING_TUNE); //sensor fail tune
}
@@ -1302,8 +1309,15 @@ int commander_thread_main(int argc, char *argv[])
telemetry.heartbeat_time > 0 &&
hrt_elapsed_time(&telemetry.heartbeat_time) < datalink_loss_timeout * 1e6) {
+ bool chAirspeed = false;
+ /* Perform airspeed check only if circuit breaker is not
+ * engaged and it's not a rotary wing */
+ if (!status.circuit_breaker_engaged_airspd_check && !status.is_rotary_wing) {
+ chAirspeed = true;
+ }
+
/* provide RC and sensor status feedback to the user */
- (void)Commander::preflightCheck(mavlink_fd, true, true, true, true, true);
+ (void)Commander::preflightCheck(mavlink_fd, true, true, true, true, chAirspeed, true);
}
telemetry_last_heartbeat[i] = telemetry.heartbeat_time;
@@ -2711,7 +2725,15 @@ void *commander_low_prio_loop(void *arg)
// we do not set the calibration return value based on it because the calibration
// might have worked just fine, but the preflight check fails for a different reason,
// so this would be prone to false negatives.
- status.condition_system_sensors_initialized = Commander::preflightCheck(mavlink_fd, true, true, true, true, true);
+
+ bool checkAirspeed = false;
+ /* Perform airspeed check only if circuit breaker is not
+ * engaged and it's not a rotary wing */
+ if (!status.circuit_breaker_engaged_airspd_check && !status.is_rotary_wing) {
+ checkAirspeed = true;
+ }
+
+ status.condition_system_sensors_initialized = Commander::preflightCheck(mavlink_fd, true, true, true, true, checkAirspeed, true);
arming_state_transition(&status, &safety, vehicle_status_s::ARMING_STATE_STANDBY, &armed, true /* fRunPreArmChecks */, mavlink_fd);
@@ -2719,8 +2741,16 @@ void *commander_low_prio_loop(void *arg)
}
case VEHICLE_CMD_PREFLIGHT_STORAGE: {
+
+ bool checkAirspeed = false;
+ /* Perform airspeed check only if circuit breaker is not
+ * engaged and it's not a rotary wing */
+ if (!status.circuit_breaker_engaged_airspd_check && !status.is_rotary_wing) {
+ checkAirspeed = true;
+ }
+
// Update preflight check status
- status.condition_system_sensors_initialized = Commander::preflightCheck(mavlink_fd, true, true, true, true, true);
+ status.condition_system_sensors_initialized = Commander::preflightCheck(mavlink_fd, true, true, true, true, checkAirspeed, true);
arming_state_transition(&status, &safety, vehicle_status_s::ARMING_STATE_STANDBY, &armed, true /* fRunPreArmChecks */, mavlink_fd);