Skip to content

Commit

Permalink
GCS_MAVLink: Fix Airspeed without AHRS
Browse files Browse the repository at this point in the history
  • Loading branch information
IamPete1 authored and peterbarker committed Sep 17, 2024
1 parent 8b50f3b commit c19e571
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -2380,7 +2382,7 @@ void GCS_MAVLINK::send_airspeed()
}

}
#endif
#endif // AP_AIRSPEED_ENABLED

#if AP_AHRS_ENABLED
void GCS_MAVLINK::send_ahrs()
Expand Down

0 comments on commit c19e571

Please sign in to comment.