From e7f0486ebe259bfc937b4d211c302abde4df8688 Mon Sep 17 00:00:00 2001 From: Petr Ledvina Date: Sat, 1 Feb 2025 22:45:21 +0100 Subject: [PATCH] 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 --- src/main/sensors/acceleration_init.c | 5 +++-- src/main/sensors/gyro_init.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/sensors/acceleration_init.c b/src/main/sensors/acceleration_init.c index 1488b8b28a..6624253658 100644 --- a/src/main/sensors/acceleration_init.c +++ b/src/main/sensors/acceleration_init.c @@ -167,11 +167,11 @@ retry: FALLTHROUGH; #endif +#if defined(USE_ACC_MPU6500) || defined(USE_ACC_SPI_MPU6500) case ACC_MPU6500: case ACC_ICM20601: case ACC_ICM20602: case ACC_ICM20608G: -#if defined(USE_ACC_MPU6500) || defined(USE_ACC_SPI_MPU6500) #ifdef USE_ACC_SPI_MPU6500 if (mpu6500SpiAccDetect(dev)) { #else @@ -195,8 +195,8 @@ retry: } break; } -#endif FALLTHROUGH; +#endif #ifdef USE_ACC_SPI_ICM20649 case ACC_ICM20649: @@ -287,6 +287,7 @@ retry: default: case ACC_NONE: // disable ACC + UNUSED(dev); accHardware = ACC_NONE; break; } diff --git a/src/main/sensors/gyro_init.c b/src/main/sensors/gyro_init.c index 4e09d73c18..151d9f8aeb 100644 --- a/src/main/sensors/gyro_init.c +++ b/src/main/sensors/gyro_init.c @@ -500,6 +500,7 @@ STATIC_UNIT_TESTED gyroHardware_e gyroDetect(gyroDev_t *dev) #endif default: + UNUSED(dev); gyroHardware = GYRO_NONE; }