commander arming_state_transition: respect fRunPreArmChecks properly

if fRunPreArmChecks was set to false, there were still cases where the
preflight checks could be called. This fixes that.

arming_state_transition() with fRunPreArmChecks=false is only called
when entering & leaving preflight calibration mode.
All other places use fRunPreArmChecks=true, which means there is no change
for these.
This commit is contained in:
Beat Küng
2018-06-09 11:48:40 +02:00
parent 469b5f98e2
commit 8c3cf0167c

View File

@@ -137,8 +137,9 @@ transition_result_t arming_state_transition(vehicle_status_s *status, const batt
/* re-run the pre-flight check as long as sensors are failing */ /* re-run the pre-flight check as long as sensors are failing */
if (!status_flags->condition_system_sensors_initialized if (!status_flags->condition_system_sensors_initialized
&& ((new_arming_state == vehicle_status_s::ARMING_STATE_ARMED) || (new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY)) && fRunPreArmChecks
&& !hil_enabled) { && ((new_arming_state == vehicle_status_s::ARMING_STATE_ARMED) || (new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY))
&& !hil_enabled) {
if ((last_preflight_check == 0) || (hrt_elapsed_time(&last_preflight_check) > 1000 * 1000)) { if ((last_preflight_check == 0) || (hrt_elapsed_time(&last_preflight_check) > 1000 * 1000)) {