AP_Baro: Returns directly calculated values

This commit is contained in:
muramura 2023-11-11 02:06:52 +09:00 committed by Peter Barker
parent f175cb19a1
commit f28ef5e5a7
1 changed files with 1 additions and 4 deletions

View File

@ -404,15 +404,12 @@ void AP_Baro::update_calibration()
// given base_pressure in Pascal
float AP_Baro::get_altitude_difference(float base_pressure, float pressure) const
{
float ret;
float temp = C_TO_KELVIN(get_ground_temperature());
float scaling = pressure / base_pressure;
// This is an exact calculation that is within +-2.5m of the standard
// atmosphere tables in the troposphere (up to 11,000 m amsl).
ret = 153.8462f * temp * (1.0f - expf(0.190259f * logf(scaling)))-_field_elevation_active;
return ret;
return 153.8462f * temp * (1.0f - expf(0.190259f * logf(scaling)))-_field_elevation_active;
}
// return sea level pressure where in which the current measured pressure