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(); 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"); if (!_imu.initialize()) ESP_LOGE("IMUService", "IMU initialize failed");
#endif #endif
#if FT_ENABLED(USE_HMC5883) #if FT_ENABLED(USE_HMC5883 || USE_ICM20948)
if (!_mag.initialize()) ESP_LOGE("IMUService", "MAG initialize failed"); if (!_mag.initialize()) ESP_LOGE("IMUService", "MAG initialize failed");
#endif #endif
#if FT_ENABLED(USE_BMP180) #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) { 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.x = _imu.getAngleX();
data.y = _imu.getAngleY(); data.y = _imu.getAngleY();
data.z = _imu.getAngleZ(); data.z = _imu.getAngleZ();
@@ -101,7 +101,7 @@ void Peripherals::getSettingsProto(socket_message_PeripheralSettingsData &data)
/* IMU FUNCTIONS */ /* IMU FUNCTIONS */
bool Peripherals::readImu() { bool Peripherals::readImu() {
bool updated = false; bool updated = false;
#if FT_ENABLED(USE_MPU6050 || USE_BNO055) #if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948)
beginTransaction(); beginTransaction();
updated = _imu.update(); updated = _imu.update();
endTransaction(); endTransaction();
@@ -149,7 +149,7 @@ void Peripherals::readSonar() {
float Peripherals::angleX() { float Peripherals::angleX() {
return return
#if FT_ENABLED(USE_MPU6050 || USE_BNO055) #if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948)
_imu.getAngleX(); _imu.getAngleX();
#else #else
0; 0;
@@ -158,7 +158,7 @@ float Peripherals::angleX() {
float Peripherals::angleY() { float Peripherals::angleY() {
return return
#if FT_ENABLED(USE_MPU6050 || USE_BNO055) #if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948)
_imu.getAngleY(); _imu.getAngleY();
#else #else
0; 0;
@@ -167,7 +167,7 @@ float Peripherals::angleY() {
float Peripherals::angleZ() { float Peripherals::angleZ() {
return return
#if FT_ENABLED(USE_MPU6050 || USE_BNO055) #if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948)
_imu.getAngleZ(); _imu.getAngleZ();
#else #else
0; 0;