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

OP-1658 - Fix ms5611 units

This commit is contained in:
Alessio Morale 2015-02-20 05:47:31 +01:00
parent 3f05aa0e11
commit 0cd545f5e4
2 changed files with 5 additions and 4 deletions

View File

@ -517,12 +517,12 @@ static void updateGyroTempBias(float temperature)
static void updateBaroTempBias(float temperature)
{
baro_temperature = temp_alpha_baro * (temperature - baro_temperature) + baro_temperature;
baro_temp_calibration_count--;
if (isnan(baro_temperature)) {
baro_temperature = temperature;
}
baro_temperature = temp_alpha_baro * (temperature - baro_temperature) + baro_temperature;
if (baro_temp_correction_enabled && !baro_temp_calibration_count) {
baro_temp_calibration_count = BARO_TEMP_CALIB_INTERVAL;
// pressure bias = A + B*t + C*t^2 + D * t^3
@ -530,6 +530,7 @@ static void updateBaroTempBias(float temperature)
float ctemp = boundf(baro_temperature, baroCorrectionExtent.max, baroCorrectionExtent.min);
baro_temp_bias = baroCorrection.a + ((baroCorrection.d * ctemp + baroCorrection.c) * ctemp + baroCorrection.b) * ctemp;
}
baro_temp_calibration_count--;
}
/**
* Locally cache some variables from the AtttitudeSettings object

View File

@ -306,11 +306,11 @@ static float PIOS_MS5611_GetTemperature(void)
}
/**
* Return the most recently computed pressure in kPa
* Return the most recently computed pressure in Pa
*/
static float PIOS_MS5611_GetPressure(void)
{
return ((float)Pressure) / 1000.0f;
return (float)Pressure;
}
/**