mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Fix the MPU6000 implementation
This commit is contained in:
parent
e07fca0465
commit
13447ac907
@ -159,11 +159,16 @@ static void SensorsTask(void *parameters)
|
||||
UAVObjEvent ev;
|
||||
settingsUpdatedCb(&ev);
|
||||
|
||||
accel_test = PIOS_BMA180_Test();
|
||||
#if defined(PIOS_INCLUDE_MPU6000)
|
||||
gyro_test = PIOS_MPU6000_Test();
|
||||
#if !defined(PIOS_INCLUDE_BMA180)
|
||||
accel_test = gyro_test;
|
||||
#endif
|
||||
#elif defined(PIOS_INCLUDE_L3GD20)
|
||||
gyro_test = PIOS_L3GD20_Test();
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_BMA180)
|
||||
accel_test = PIOS_BMA180_Test();
|
||||
#endif
|
||||
mag_test = PIOS_HMC5883_Test();
|
||||
|
||||
@ -299,7 +304,12 @@ static void SensorsTask(void *parameters)
|
||||
accelsData.x = accels[0] * accel_scaling * accel_scale[0] - accel_bias[0];
|
||||
accelsData.y = accels[1] * accel_scaling * accel_scale[1] - accel_bias[1];
|
||||
accelsData.z = accels[2] * accel_scaling * accel_scale[2] - accel_bias[2];
|
||||
#if defined(BMA180)
|
||||
accelsData.temperature = 25.0f + ((float) accel.temperature - 2.0f) / 2.0f;
|
||||
#elif defined(PIOS_MPU6000_ACCEL)
|
||||
accelsData.temperature = 35.0f + ((float) gyro.temperature + 512.0f) / 340.0f;
|
||||
#endif
|
||||
accelsData.temperature =
|
||||
AccelsSet(&accelsData);
|
||||
|
||||
float gyros[3] = {(float) gyro_accum[1] / gyro_samples, (float) gyro_accum[0] / gyro_samples, -(float) gyro_accum[2] / gyro_samples};
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
#if defined(PIOS_INCLUDE_MPU6000)
|
||||
|
||||
#include "fifo_buffer.h"
|
||||
|
||||
/* Global Variables */
|
||||
uint32_t pios_spi_gyro;
|
||||
|
||||
@ -69,11 +71,7 @@ void PIOS_MPU6000_Init(const struct pios_mpu6000_cfg * new_cfg)
|
||||
PIOS_SPI_SetPrescalar(pios_spi_gyro, SPI_BaudRatePrescaler_8);
|
||||
|
||||
/* Set up EXTI line */
|
||||
PIOS_EXTI_Init(&new_cfg->cfg);
|
||||
|
||||
/* Enable and set EOC EXTI Interrupt to the lowest priority */
|
||||
NVIC_Init(&cfg->eoc_irq.init);
|
||||
|
||||
PIOS_EXTI_Init(cfg->exti_cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -428,7 +428,7 @@ void PIOS_Board_Init(void) {
|
||||
#if defined(PIOS_INCLUDE_MPU6000)
|
||||
PIOS_MPU6000_Attach(pios_spi_gyro_id);
|
||||
PIOS_MPU6000_Init(&pios_mpu6000_cfg);
|
||||
PIOS_Assert(PIOS_MPU6000_Test() == 0);
|
||||
// PIOS_Assert(PIOS_MPU6000_Test() == 0);
|
||||
#elif defined(PIOS_INCLUDE_L3GD20)
|
||||
PIOS_L3GD20_Init(pios_spi_gyro_id, 0, &pios_l3gd20_cfg);
|
||||
PIOS_Assert(PIOS_L3GD20_Test() == 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user