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

Cleanup ACC hardware enum so that 'None' is always '1' and doesn't

change every time a new sensor is added.  All the sensor enum values are
now aligned.
This commit is contained in:
Dominic Clifton 2015-02-26 22:31:38 +00:00
parent 88bc3c3f5d
commit ed434dd169
5 changed files with 22 additions and 24 deletions

View file

@ -110,7 +110,7 @@ const mpu6050Config_t *selectMPU6050Config(void)
#ifdef USE_FAKE_GYRO
static void fakeGyroInit(void) {}
static void fakeGyroRead(int16_t *gyroData) {
UNUSED(gyroData);
memset(gyroData, 0, sizeof(int16_t[XYZ_AXIS_COUNT]));
}
static void fakeGyroReadTemp(int16_t *tempData) {
UNUSED(tempData);
@ -129,7 +129,7 @@ bool fakeGyroDetect(gyro_t *gyro, uint16_t lpf)
#ifdef USE_FAKE_ACC
static void fakeAccInit(void) {}
static void fakeAccRead(int16_t *accData) {
UNUSED(accData);
memset(accData, 0, sizeof(int16_t[XYZ_AXIS_COUNT]));
}
bool fakeAccDetect(acc_t *acc)
@ -267,14 +267,6 @@ retry:
switch (accHardwareToUse) {
case ACC_DEFAULT:
; // fallthrough
case ACC_FAKE:
#ifdef USE_FAKE_ACC
if (fakeAccDetect(&acc)) {
accHardware = ACC_FAKE;
break;
}
#endif
; // fallthrough
case ACC_ADXL345: // ADXL345
#ifdef USE_ACC_ADXL345
acc_params.useFifo = false;
@ -365,6 +357,14 @@ retry:
accHardware = ACC_SPI_MPU6500;
break;
}
#endif
; // fallthrough
case ACC_FAKE:
#ifdef USE_FAKE_ACC
if (fakeAccDetect(&acc)) {
accHardware = ACC_FAKE;
break;
}
#endif
; // fallthrough
case ACC_NONE: // disable ACC