mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Added an option to be able to change the interleave between Pressure and Temperature conversion for the MS5611
To enable this option define the PIOS_MS5611_SLOW_TEMP_RATE with the number of Pressure conversion for each Temperature conversion.
This commit is contained in:
parent
257b00a400
commit
c696cccff8
@ -100,6 +100,13 @@ static void altitudeTask(void *parameters)
|
|||||||
|
|
||||||
// TODO: Check the pressure sensor and set a warning if it fails test
|
// TODO: Check the pressure sensor and set a warning if it fails test
|
||||||
|
|
||||||
|
// Option to change the interleave between Temp and Pressure conversions
|
||||||
|
// Undef for normal operation
|
||||||
|
//#define PIOS_MS5611_SLOW_TEMP_RATE 20
|
||||||
|
|
||||||
|
#ifdef PIOS_MS5611_SLOW_TEMP_RATE
|
||||||
|
uint8_t temp_press_interleave_count = 1;
|
||||||
|
#endif
|
||||||
// Main task loop
|
// Main task loop
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -128,11 +135,20 @@ static void altitudeTask(void *parameters)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
float temp, press;
|
float temp, press;
|
||||||
|
#ifdef PIOS_MS5611_SLOW_TEMP_RATE
|
||||||
|
temp_press_interleave_count --;
|
||||||
|
if(temp_press_interleave_count == 0)
|
||||||
|
{
|
||||||
|
#endif
|
||||||
// Update the temperature data
|
// Update the temperature data
|
||||||
PIOS_MS5611_StartADC(TemperatureConv);
|
PIOS_MS5611_StartADC(TemperatureConv);
|
||||||
vTaskDelay(PIOS_MS5611_GetDelay());
|
vTaskDelay(PIOS_MS5611_GetDelay());
|
||||||
PIOS_MS5611_ReadADC();
|
PIOS_MS5611_ReadADC();
|
||||||
|
|
||||||
|
#ifdef PIOS_MS5611_SLOW_TEMP_RATE
|
||||||
|
temp_press_interleave_count=PIOS_MS5611_SLOW_TEMP_RATE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Update the pressure data
|
// Update the pressure data
|
||||||
PIOS_MS5611_StartADC(PressureConv);
|
PIOS_MS5611_StartADC(PressureConv);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user