diff --git a/src/modules/commander/Arming/PreFlightCheck/checks/airspeedCheck.cpp b/src/modules/commander/Arming/PreFlightCheck/checks/airspeedCheck.cpp index bd646a9f43..847a16b919 100644 --- a/src/modules/commander/Arming/PreFlightCheck/checks/airspeedCheck.cpp +++ b/src/modules/commander/Arming/PreFlightCheck/checks/airspeedCheck.cpp @@ -79,12 +79,12 @@ bool PreFlightCheck::airspeedCheck(orb_advert_t *mavlink_log_pub, vehicle_status goto out; } - /** + /* * Check if airspeed is higher than 4m/s (accepted max) while the vehicle is landed / not flying * Negative and positive offsets are considered. Do not check anymore while arming because pitot cover * might have been removed. */ - if (fabsf(airspeed.indicated_airspeed_m_s) > 4.0f && !prearm) { + if (fabsf(airspeed.indicated_airspeed_m_s) > 4.0f && prearm) { if (report_fail) { mavlink_log_critical(mavlink_log_pub, "Preflight Fail: check Airspeed Cal or Pitot"); } diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index 27ee54e525..9cf1cdb17d 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -286,7 +286,7 @@ extern "C" __EXPORT int commander_main(int argc, char *argv[]) } if (!strcmp(argv[1], "check")) { - bool preflight_check_res = PreFlightCheck::preflightCheck(nullptr, status, status_flags, true, true, false, 30_s); + bool preflight_check_res = PreFlightCheck::preflightCheck(nullptr, status, status_flags, true, true, true, 30_s); PX4_INFO("Preflight check: %s", preflight_check_res ? "OK" : "FAILED"); bool prearm_check_res = PreFlightCheck::preArmCheck(nullptr, status_flags, safety_s{}, @@ -1280,7 +1280,7 @@ Commander::run() arm_auth_init(&mavlink_log_pub, &status.system_id); // run preflight immediately to find all relevant parameters, but don't report - PreFlightCheck::preflightCheck(&mavlink_log_pub, status, status_flags, _arm_requirements.global_position, false, false, + PreFlightCheck::preflightCheck(&mavlink_log_pub, status, status_flags, _arm_requirements.global_position, false, true, hrt_elapsed_time(&_boot_timestamp)); while (!should_exit()) { @@ -3355,7 +3355,7 @@ void *commander_low_prio_loop(void *arg) tune_positive(true); // time since boot not relevant here - if (PreFlightCheck::preflightCheck(&mavlink_log_pub, status, status_flags, false, false, false, 30_s)) { + if (PreFlightCheck::preflightCheck(&mavlink_log_pub, status, status_flags, false, false, true, 30_s)) { status_flags.condition_system_sensors_initialized = true; } diff --git a/src/modules/commander/state_machine_helper.cpp b/src/modules/commander/state_machine_helper.cpp index 3db82124ad..126530d0c0 100644 --- a/src/modules/commander/state_machine_helper.cpp +++ b/src/modules/commander/state_machine_helper.cpp @@ -154,7 +154,8 @@ transition_result_t arming_state_transition(vehicle_status_s *status, const safe if ((last_preflight_check == 0) || (hrt_elapsed_time(&last_preflight_check) > 1000 * 1000)) { status_flags->condition_system_sensors_initialized = PreFlightCheck::preflightCheck(mavlink_log_pub, *status, - *status_flags, arm_requirements.global_position, false, false, time_since_boot); + *status_flags, arm_requirements.global_position, false, status->arming_state != vehicle_status_s::ARMING_STATE_ARMED, + time_since_boot); last_preflight_check = hrt_absolute_time(); }