Fix USE_ICM20948 checks in peripherals.cpp

This commit is contained in:
Niklas Jensen
2025-11-27 18:15:57 +01:00
parent 42cce24c11
commit ebbe1f9ca4
+7 -7
View File
@@ -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;