1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 20:10:18 +03:00

fix compilation without ACC (#14218)

* fix compilation without ACC

- compilatiopn may fail with cryptic message when no ACC is
selected (unused variable `dev`). Mark dev as unused
- MPU6500 is handled differently than all other accs (it is only
driver that adds case labels)
- also make dev UNUSED for gyro

* Update src/main/sensors/acceleration_init.c

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
This commit is contained in:
Petr Ledvina 2025-02-01 22:45:21 +01:00 committed by GitHub
parent 79ecc1ac74
commit e7f0486ebe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -167,11 +167,11 @@ retry:
FALLTHROUGH; FALLTHROUGH;
#endif #endif
#if defined(USE_ACC_MPU6500) || defined(USE_ACC_SPI_MPU6500)
case ACC_MPU6500: case ACC_MPU6500:
case ACC_ICM20601: case ACC_ICM20601:
case ACC_ICM20602: case ACC_ICM20602:
case ACC_ICM20608G: case ACC_ICM20608G:
#if defined(USE_ACC_MPU6500) || defined(USE_ACC_SPI_MPU6500)
#ifdef USE_ACC_SPI_MPU6500 #ifdef USE_ACC_SPI_MPU6500
if (mpu6500SpiAccDetect(dev)) { if (mpu6500SpiAccDetect(dev)) {
#else #else
@ -195,8 +195,8 @@ retry:
} }
break; break;
} }
#endif
FALLTHROUGH; FALLTHROUGH;
#endif
#ifdef USE_ACC_SPI_ICM20649 #ifdef USE_ACC_SPI_ICM20649
case ACC_ICM20649: case ACC_ICM20649:
@ -287,6 +287,7 @@ retry:
default: default:
case ACC_NONE: // disable ACC case ACC_NONE: // disable ACC
UNUSED(dev);
accHardware = ACC_NONE; accHardware = ACC_NONE;
break; break;
} }

View file

@ -500,6 +500,7 @@ STATIC_UNIT_TESTED gyroHardware_e gyroDetect(gyroDev_t *dev)
#endif #endif
default: default:
UNUSED(dev);
gyroHardware = GYRO_NONE; gyroHardware = GYRO_NONE;
} }