From ebbe1f9ca4242a8f6eab4dd033ce05d2d968aa7f Mon Sep 17 00:00:00 2001 From: Niklas Jensen Date: Thu, 27 Nov 2025 18:15:57 +0100 Subject: [PATCH] Fix USE_ICM20948 checks in peripherals.cpp --- esp32/src/peripherals/peripherals.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/esp32/src/peripherals/peripherals.cpp b/esp32/src/peripherals/peripherals.cpp index 06b0d0b..2c5dcb0 100644 --- a/esp32/src/peripherals/peripherals.cpp +++ b/esp32/src/peripherals/peripherals.cpp @@ -16,10 +16,10 @@ void Peripherals::begin() { updatePins(); -#if FT_ENABLED(USE_MPU6050 || USE_BNO055) +#if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948) if (!_imu.initialize()) ESP_LOGE("IMUService", "IMU initialize failed"); #endif -#if FT_ENABLED(USE_HMC5883) +#if FT_ENABLED(USE_HMC5883 || USE_ICM20948) if (!_mag.initialize()) ESP_LOGE("IMUService", "MAG initialize failed"); #endif #if FT_ENABLED(USE_BMP180) @@ -74,7 +74,7 @@ void Peripherals::scanI2C(uint8_t lower, uint8_t higher) { } void Peripherals::getIMUProto(socket_message_IMUData &data) { -#if FT_ENABLED(USE_MPU6050 || USE_BNO055) +#if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948) data.x = _imu.getAngleX(); data.y = _imu.getAngleY(); data.z = _imu.getAngleZ(); @@ -101,7 +101,7 @@ void Peripherals::getSettingsProto(socket_message_PeripheralSettingsData &data) /* IMU FUNCTIONS */ bool Peripherals::readImu() { bool updated = false; -#if FT_ENABLED(USE_MPU6050 || USE_BNO055) +#if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948) beginTransaction(); updated = _imu.update(); endTransaction(); @@ -149,7 +149,7 @@ void Peripherals::readSonar() { float Peripherals::angleX() { return -#if FT_ENABLED(USE_MPU6050 || USE_BNO055) +#if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948) _imu.getAngleX(); #else 0; @@ -158,7 +158,7 @@ float Peripherals::angleX() { float Peripherals::angleY() { return -#if FT_ENABLED(USE_MPU6050 || USE_BNO055) +#if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948) _imu.getAngleY(); #else 0; @@ -167,7 +167,7 @@ float Peripherals::angleY() { float Peripherals::angleZ() { return -#if FT_ENABLED(USE_MPU6050 || USE_BNO055) +#if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948) _imu.getAngleZ(); #else 0;