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

Merge remote-tracking branch 'revo/amorale/revolution_baro_fixes' into revo-mini

This commit is contained in:
James Cotton 2012-08-25 14:55:10 -05:00
commit 5c34412200
4 changed files with 22 additions and 7 deletions

View File

@ -100,6 +100,13 @@ static void altitudeTask(void *parameters)
// 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
while (1)
{
@ -128,11 +135,20 @@ static void altitudeTask(void *parameters)
}
#endif
float temp, press;
#ifdef PIOS_MS5611_SLOW_TEMP_RATE
temp_press_interleave_count --;
if(temp_press_interleave_count == 0)
{
#endif
// Update the temperature data
PIOS_MS5611_StartADC(TemperatureConv);
vTaskDelay(PIOS_MS5611_GetDelay());
PIOS_MS5611_ReadADC();
#ifdef PIOS_MS5611_SLOW_TEMP_RATE
temp_press_interleave_count=PIOS_MS5611_SLOW_TEMP_RATE;
}
#endif
// Update the pressure data
PIOS_MS5611_StartADC(PressureConv);

View File

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

View File

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

View File

@ -1224,7 +1224,7 @@ static const struct pios_i2c_adapter_cfg pios_i2c_pressure_adapter_cfg = {
.I2C_Ack = I2C_Ack_Enable,
.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
.I2C_DutyCycle = I2C_DutyCycle_2,
.I2C_ClockSpeed = 40000, /* bits/s */
.I2C_ClockSpeed = 400000, /* bits/s */
},
.transfer_timeout_ms = 50,
.scl = {