1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Cleanup MPU9150 support.

This commit is contained in:
Dominic Clifton 2014-12-24 21:36:47 +00:00
parent e9c07675be
commit 36c0b6f106
9 changed files with 79 additions and 432 deletions

View file

@ -33,8 +33,6 @@
#include "drivers/accgyro_mma845x.h"
#include "drivers/accgyro_mpu3050.h"
#include "drivers/accgyro_mpu6050.h"
#include "drivers/accgyro_mpu9150.h"
#include "drivers/accgyro_l3gd20.h"
#include "drivers/accgyro_lsm303dlhc.h"
@ -146,12 +144,6 @@ bool detectGyro(uint16_t gyroLpf)
}
#endif
#ifdef USE_GYRO_MPU9150
if (mpu9150GyroDetect(NULL, &gyro, gyroLpf)) {
return true;
}
#endif
#ifdef USE_GYRO_L3G4200D
if (l3g4200dDetect(&gyro, gyroLpf)) {
#ifdef NAZE
@ -258,15 +250,6 @@ retry:
}
; // fallthrough
#endif
#ifdef USE_ACC_MPU9150
case ACC_MPU9150: // MPU9150
if (mpu9150AccDetect(NULL, &acc)) {
accHardware = ACC_MPU9150;
if (accHardwareToUse == ACC_MPU9150)
break;
}
; // fallthrough
#endif
#ifdef USE_ACC_MMA8452
case ACC_MMA8452: // MMA8452
#ifdef NAZE
@ -486,9 +469,7 @@ bool sensorsAutodetect(sensorAlignmentConfig_t *sensorAlignmentConfig, uint16_t
sensorsSet(SENSOR_GYRO);
detectAcc(accHardwareToUse);
detectBaro();
detectMag(magHardwareToUse);
reconfigureAlignment(sensorAlignmentConfig);
// Now time to init things, acc first
if (sensors(SENSOR_ACC))
@ -496,6 +477,10 @@ bool sensorsAutodetect(sensorAlignmentConfig_t *sensorAlignmentConfig, uint16_t
// this is safe because either mpu6050 or mpu3050 or lg3d20 sets it, and in case of fail, we never get here.
gyro.init();
detectMag(magHardwareToUse);
reconfigureAlignment(sensorAlignmentConfig);
// FIXME extract to a method to reduce dependencies, maybe move to sensors_compass.c
if (sensors(SENSOR_MAG)) {
// calculate magnetic declination