1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

Fixes the selection of the oversample settings from the pios_ms5611_cfg.oversapling configuration

This commit is contained in:
a*morale 2012-08-25 11:29:01 +02:00
parent c4b82fa1fd
commit 789746151a
2 changed files with 4 additions and 5 deletions

View File

@ -56,7 +56,6 @@ static uint32_t oversampling;
static const struct pios_ms5611_cfg * dev_cfg; static const struct pios_ms5611_cfg * dev_cfg;
static int32_t i2c_id; static int32_t i2c_id;
static enum pios_ms5611_osr osr = MS5611_OSR_256;
/** /**
* Initialise the MS5611 sensor * Initialise the MS5611 sensor
@ -90,10 +89,10 @@ int32_t PIOS_MS5611_StartADC(ConversionTypeTypeDef Type)
{ {
/* Start the conversion */ /* Start the conversion */
if (Type == TemperatureConv) { if (Type == TemperatureConv) {
while (PIOS_MS5611_WriteCommand(MS5611_TEMP_ADDR + osr) != 0) while (PIOS_MS5611_WriteCommand(MS5611_TEMP_ADDR + oversampling) != 0)
continue; continue;
} else if (Type == PressureConv) { } else if (Type == PressureConv) {
while (PIOS_MS5611_WriteCommand(MS5611_PRES_ADDR + osr) != 0) while (PIOS_MS5611_WriteCommand(MS5611_PRES_ADDR + oversampling) != 0)
continue; continue;
} }
@ -106,7 +105,7 @@ int32_t PIOS_MS5611_StartADC(ConversionTypeTypeDef Type)
* @brief Return the delay for the current osr * @brief Return the delay for the current osr
*/ */
int32_t PIOS_MS5611_GetDelay() { int32_t PIOS_MS5611_GetDelay() {
switch(osr) { switch(oversampling) {
case MS5611_OSR_256: case MS5611_OSR_256:
return 2; return 2;
case MS5611_OSR_512: case MS5611_OSR_512:

View File

@ -131,7 +131,7 @@ static const struct pios_hmc5883_cfg pios_hmc5883_cfg = {
#if defined(PIOS_INCLUDE_MS5611) #if defined(PIOS_INCLUDE_MS5611)
#include "pios_ms5611.h" #include "pios_ms5611.h"
static const struct pios_ms5611_cfg pios_ms5611_cfg = { static const struct pios_ms5611_cfg pios_ms5611_cfg = {
.oversampling = 1, .oversampling = MS5611_OSR_512,
}; };
#endif /* PIOS_INCLUDE_MS5611 */ #endif /* PIOS_INCLUDE_MS5611 */