mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-1658 - Fix ms5611 units
This commit is contained in:
parent
3f05aa0e11
commit
0cd545f5e4
@ -517,12 +517,12 @@ static void updateGyroTempBias(float temperature)
|
|||||||
|
|
||||||
static void updateBaroTempBias(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)) {
|
if (isnan(baro_temperature)) {
|
||||||
baro_temperature = temperature;
|
baro_temperature = temperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
baro_temperature = temp_alpha_baro * (temperature - baro_temperature) + baro_temperature;
|
||||||
|
|
||||||
if (baro_temp_correction_enabled && !baro_temp_calibration_count) {
|
if (baro_temp_correction_enabled && !baro_temp_calibration_count) {
|
||||||
baro_temp_calibration_count = BARO_TEMP_CALIB_INTERVAL;
|
baro_temp_calibration_count = BARO_TEMP_CALIB_INTERVAL;
|
||||||
// pressure bias = A + B*t + C*t^2 + D * t^3
|
// 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);
|
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_bias = baroCorrection.a + ((baroCorrection.d * ctemp + baroCorrection.c) * ctemp + baroCorrection.b) * ctemp;
|
||||||
}
|
}
|
||||||
|
baro_temp_calibration_count--;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Locally cache some variables from the AtttitudeSettings object
|
* Locally cache some variables from the AtttitudeSettings object
|
||||||
|
@ -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)
|
static float PIOS_MS5611_GetPressure(void)
|
||||||
{
|
{
|
||||||
return ((float)Pressure) / 1000.0f;
|
return (float)Pressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user