1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

OP-1658 - fix temp interleaving for MS5611

This commit is contained in:
Alessio Morale 2014-12-29 16:46:50 +01:00
parent adbcdecb41
commit 4b01d0d2ea

View File

@ -34,11 +34,11 @@
#define POW2(x) (1 << x) #define POW2(x) (1 << x)
// TODO: Clean this up. Getting around old constant. // TODO: Clean this up. Getting around old constant.
#define PIOS_MS5611_OVERSAMPLING oversampling #define PIOS_MS5611_OVERSAMPLING oversampling
// Option to change the interleave between Temp and Pressure conversions // Option to change the interleave between Temp and Pressure conversions
// Undef for normal operation // Undef for normal operation
// #define PIOS_MS5611_SLOW_TEMP_RATE 20 #define PIOS_MS5611_SLOW_TEMP_RATE 20
#ifndef PIOS_MS5611_SLOW_TEMP_RATE #ifndef PIOS_MS5611_SLOW_TEMP_RATE
#define PIOS_MS5611_SLOW_TEMP_RATE 1 #define PIOS_MS5611_SLOW_TEMP_RATE 1
#endif #endif
@ -448,7 +448,8 @@ bool PIOS_MS5611_driver_poll(__attribute__((unused)) uintptr_t context)
case MS5611_FSM_CALCULATE: case MS5611_FSM_CALCULATE:
temp_press_interleave_count--; temp_press_interleave_count--;
if (temp_press_interleave_count == 0) { if (!temp_press_interleave_count) {
temp_press_interleave_count = PIOS_MS5611_SLOW_TEMP_RATE;
PIOS_MS5611_StartADC(MS5611_CONVERSION_TYPE_TemperatureConv); PIOS_MS5611_StartADC(MS5611_CONVERSION_TYPE_TemperatureConv);
next_state = MS5611_FSM_PRESSURE; next_state = MS5611_FSM_PRESSURE;
} else { } else {