diff --git a/ArduPlane/GCS_Mavlink.cpp b/ArduPlane/GCS_Mavlink.cpp index 4ac15d383f..884b1cb0b0 100644 --- a/ArduPlane/GCS_Mavlink.cpp +++ b/ArduPlane/GCS_Mavlink.cpp @@ -247,9 +247,11 @@ float GCS_MAVLINK_Plane::vfr_hud_airspeed() const // will use an airspeed sensor, that value is constrained by the // ground speed. When reporting we should send the true airspeed // value if possible: +#if AP_AIRSPEED_ENABLED if (plane.airspeed.enabled() && plane.airspeed.healthy()) { return plane.airspeed.get_airspeed(); } +#endif // airspeed estimates are OK: float aspeed; diff --git a/ArduPlane/Parameters.cpp b/ArduPlane/Parameters.cpp index 57fd778c60..f6563e24a3 100644 --- a/ArduPlane/Parameters.cpp +++ b/ArduPlane/Parameters.cpp @@ -1492,6 +1492,7 @@ void Plane::load_parameters(void) } #endif +#if AP_AIRSPEED_ENABLED // PARAMETER_CONVERSION - Added: Jan-2022 { const uint16_t old_key = g.k_param_airspeed; @@ -1499,6 +1500,7 @@ void Plane::load_parameters(void) const uint16_t old_top_element = 0; // Old group element in the tree for the first subgroup element (see AP_PARAM_KEY_DUMP) AP_Param::convert_class(old_key, &airspeed, airspeed.var_info, old_index, old_top_element, true); } +#endif hal.console->printf("load_all took %uus\n", (unsigned)(micros() - before)); } diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index 8a74bb1e3c..bb82150de6 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -31,6 +31,7 @@ #include #include +#include #include #include #include // ArduPilot Mega Vector/Matrix math Library diff --git a/ArduPlane/is_flying.cpp b/ArduPlane/is_flying.cpp index 38fa07c6a4..81733a1587 100644 --- a/ArduPlane/is_flying.cpp +++ b/ArduPlane/is_flying.cpp @@ -291,8 +291,14 @@ void Plane::crash_detection_update(void) // if we have no GPS lock and we don't have a functional airspeed // sensor then don't do crash detection - if (gps.status() < AP_GPS::GPS_OK_FIX_3D && (!airspeed.use() || !airspeed.healthy())) { + if (gps.status() < AP_GPS::GPS_OK_FIX_3D) { +#if AP_AIRSPEED_ENABLED + if (!airspeed.use() || !airspeed.healthy()) { + crashed = false; + } +#else crashed = false; +#endif } if (!crashed) { diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index 37adb00201..078dbaa693 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -3014,11 +3014,13 @@ bool QuadPlane::verify_vtol_takeoff(const AP_Mission::Mission_Command &cmd) return false; } +#if AP_AIRSPEED_ENABLED if (is_positive(maximum_takeoff_airspeed) && (plane.airspeed.get_airspeed() > maximum_takeoff_airspeed)) { gcs().send_text(MAV_SEVERITY_CRITICAL, "Failed to complete takeoff, excessive wind"); plane.set_mode(plane.mode_qland, ModeReason::VTOL_FAILED_TAKEOFF); return false; } +#endif if (plane.current_loc.alt < plane.next_WP_loc.alt) { return false; diff --git a/ArduPlane/servos.cpp b/ArduPlane/servos.cpp index 9511c18853..7381b98083 100644 --- a/ArduPlane/servos.cpp +++ b/ArduPlane/servos.cpp @@ -133,11 +133,17 @@ bool Plane::suppress_throttle(void) // if we have an airspeed sensor, then check it too, and // require 5m/s. This prevents throttle up due to spiky GPS // groundspeed with bad GPS reception +#if AP_AIRSPEED_ENABLED if ((!ahrs.airspeed_sensor_enabled()) || airspeed.get_airspeed() >= 5) { // we're moving at more than 5 m/s throttle_suppressed = false; return false; } +#else + // no airspeed sensor, so we trust that the GPS's movement is truthful + throttle_suppressed = false; + return false; +#endif } #if HAL_QUADPLANE_ENABLED