From c19e5713ae67a34d2aa4baa47ce7d83fa0934d79 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Tue, 17 Sep 2024 01:06:48 +0100 Subject: [PATCH] GCS_MAVLink: Fix Airspeed without AHRS --- libraries/GCS_MAVLink/GCS_Common.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 5388b399cb..26ad2a00ae 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -2331,7 +2331,7 @@ void GCS_MAVLINK::send_scaled_pressure3() } #if AP_AIRSPEED_ENABLED -void GCS_MAVLINK::send_airspeed() +void GCS_MAVLINK::send_airspeed() { AP_Airspeed *airspeed = AP_Airspeed::get_singleton(); if (airspeed == nullptr) { @@ -2357,11 +2357,13 @@ void GCS_MAVLINK::send_airspeed() flags |= 1U << AIRSPEED_SENSOR_FLAGS::AIRSPEED_SENSOR_UNHEALTHY; } +#if AP_AHRS_ENABLED // Set using flag if the AHRS is using this sensor const AP_AHRS &ahrs = AP::ahrs(); if (ahrs.using_airspeed_sensor() && (ahrs.get_active_airspeed_index() == index)) { flags |= 1U << AIRSPEED_SENSOR_FLAGS::AIRSPEED_SENSOR_USING; } +#endif // Assemble message and send const mavlink_airspeed_t msg { @@ -2380,7 +2382,7 @@ void GCS_MAVLINK::send_airspeed() } } -#endif +#endif // AP_AIRSPEED_ENABLED #if AP_AHRS_ENABLED void GCS_MAVLINK::send_ahrs()