diff --git a/libraries/AP_AHRS/AP_AHRS.cpp b/libraries/AP_AHRS/AP_AHRS.cpp index 7e758691994..7d54340d30d 100644 --- a/libraries/AP_AHRS/AP_AHRS.cpp +++ b/libraries/AP_AHRS/AP_AHRS.cpp @@ -729,12 +729,14 @@ bool AP_AHRS::using_airspeed_sensor() const return state.airspeed_estimate_type == AirspeedEstimateType::AIRSPEED_SENSOR; } +#if AP_AIRSPEED_ENABLED /* Return true if a airspeed sensor should be used for the AHRS airspeed estimate */ bool AP_AHRS::_should_use_airspeed_sensor(uint8_t airspeed_index) const { - if (!airspeed_sensor_enabled(airspeed_index)) { + const auto *airspeed = AP::airspeed(); + if (airspeed == nullptr || !airspeed->healthy(airspeed_index) || !airspeed->use(airspeed_index)) { return false; } nav_filter_status filter_status; @@ -751,6 +753,7 @@ bool AP_AHRS::_should_use_airspeed_sensor(uint8_t airspeed_index) const } return true; } +#endif // AP_AIRSPEED_ENABLED // return an airspeed estimate if available. return true // if we have an estimate diff --git a/libraries/AP_AHRS/AP_AHRS.h b/libraries/AP_AHRS/AP_AHRS.h index 8cb72da8687..8cb38f0545a 100644 --- a/libraries/AP_AHRS/AP_AHRS.h +++ b/libraries/AP_AHRS/AP_AHRS.h @@ -196,18 +196,6 @@ public: // active backend bool airspeed_sensor_data_being_consumed(void) const; - // return true if a airspeed sensor is enabled - bool airspeed_sensor_enabled(void) const { - // FIXME: make this a method on the active backend - return AP_AHRS_Backend::airspeed_sensor_enabled(); - } - - // return true if a airspeed from a specific airspeed sensor is enabled - bool airspeed_sensor_enabled(uint8_t airspeed_index) const { - // FIXME: make this a method on the active backend - return AP_AHRS_Backend::airspeed_sensor_enabled(airspeed_index); - } - // true if compass is being used bool use_compass();