Fix USE_ICM20948 checks in peripherals.cpp

This commit is contained in:
Niklas Jensen
2025-11-27 18:15:57 +01:00
parent 20e9c305ce
commit 12ffd0ce59
+8 -8
View File
@@ -15,10 +15,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)
@@ -79,7 +79,7 @@ void Peripherals::scanI2C(uint8_t lower, uint8_t higher) {
/* 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();
@@ -127,7 +127,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;
@@ -136,7 +136,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;
@@ -145,7 +145,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;
@@ -165,10 +165,10 @@ float Peripherals::leftDistance() { return _left_distance; }
float Peripherals::rightDistance() { return _right_distance; } float Peripherals::rightDistance() { return _right_distance; }
void Peripherals::getIMUResult(JsonVariant &root) { void Peripherals::getIMUResult(JsonVariant &root) {
#if FT_ENABLED(USE_MPU6050 || USE_BNO055) #if FT_ENABLED(USE_MPU6050 || USE_BNO055 || USE_ICM20948)
_imu.getResults(root); _imu.getResults(root);
#endif #endif
#if FT_ENABLED(USE_HMC5883) #if FT_ENABLED(USE_HMC5883 || USE_ICM20948)
_mag.getResults(root); _mag.getResults(root);
#endif #endif
#if FT_ENABLED(USE_BMP180) #if FT_ENABLED(USE_BMP180)