From 4ef362aaab15d26e024bb417dded6bbbdc9a6d6d Mon Sep 17 00:00:00 2001 From: Michael du Breuil Date: Thu, 11 Apr 2024 18:15:43 -0700 Subject: [PATCH] AP_Baro: Do not cache EAS2TAS conversions Caching this introduces discontinuities in TECS, as the step change modifies the target speed demand. --- libraries/AP_Baro/AP_Baro.cpp | 10 +--------- libraries/AP_Baro/AP_Baro.h | 2 -- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/libraries/AP_Baro/AP_Baro.cpp b/libraries/AP_Baro/AP_Baro.cpp index 84bfbadc9fd989..5f3aefe012dff2 100644 --- a/libraries/AP_Baro/AP_Baro.cpp +++ b/libraries/AP_Baro/AP_Baro.cpp @@ -395,9 +395,6 @@ void AP_Baro::update_calibration() // always update the guessed ground temp _guessed_ground_temperature = get_external_temperature(); - - // force EAS2TAS to recalculate - _EAS2TAS = 0; } // return altitude difference in meters between current pressure and a @@ -433,10 +430,6 @@ float AP_Baro::get_sealevel_pressure(float pressure) const float AP_Baro::get_EAS2TAS(void) { float altitude = get_altitude(); - if ((fabsf(altitude - _last_altitude_EAS2TAS) < 25.0f) && !is_zero(_EAS2TAS)) { - // not enough change to require re-calculating - return _EAS2TAS; - } float pressure = get_pressure(); if (is_zero(pressure)) { @@ -451,8 +444,7 @@ float AP_Baro::get_EAS2TAS(void) if (!is_positive(eas2tas_squared)) { return 1.0f; } - _EAS2TAS = sqrtf(eas2tas_squared); - _last_altitude_EAS2TAS = altitude; + const float _EAS2TAS = sqrtf(eas2tas_squared); return _EAS2TAS; } diff --git a/libraries/AP_Baro/AP_Baro.h b/libraries/AP_Baro/AP_Baro.h index 4b1055fff92213..c7225bd6b2fb36 100644 --- a/libraries/AP_Baro/AP_Baro.h +++ b/libraries/AP_Baro/AP_Baro.h @@ -287,8 +287,6 @@ class AP_Baro uint32_t _field_elevation_last_ms; AP_Int8 _primary_baro; // primary chosen by user AP_Int8 _ext_bus; // bus number for external barometer - float _last_altitude_EAS2TAS; - float _EAS2TAS; float _external_temperature; uint32_t _last_external_temperature_ms; DerivativeFilterFloat_Size7 _climb_rate_filter;