1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Merge branch 'amorale/OP-1139_baro_2nd_order_compensation' into amorale/OP-1149_gyro_accel_thermal_calibration

This commit is contained in:
Alessio Morale 2014-01-26 22:54:57 +01:00
commit 9c1c556c9c

View File

@ -163,8 +163,9 @@ static void altitudeTask(__attribute__((unused)) void *parameters)
temp = PIOS_MS5611_GetTemperature();
press = PIOS_MS5611_GetPressure();
float temp2 = temp * temp;
press = press - baroCorrection.a + temp * baroCorrection.b + temp2 * baroCorrection.c + temp * temp2 * baroCorrection.d;
// pressure bias = A + B*t + C*t^2 + D * t^3
press -= baroCorrection.a + ((baroCorrection.d * temp + baroCorrection.c) * temp + baroCorrection.b) * temp;
float altitude = 44330.0f * (1.0f - powf((press) / MS5611_P0, (1.0f / 5.255f)));