From 4f2e81816ca0e2feb416bae2bfc50b278130acf7 Mon Sep 17 00:00:00 2001 From: Lucas Geilich Date: Mon, 17 Jun 2024 13:40:45 +0200 Subject: [PATCH 1/2] removed unnessary magReading --- src/F_BMX055.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/F_BMX055.cpp b/src/F_BMX055.cpp index 8bcdd08..aad98eb 100644 --- a/src/F_BMX055.cpp +++ b/src/F_BMX055.cpp @@ -356,7 +356,6 @@ void BMX055::calibrateMag(calData* cal) { int16_t MagCount[3]; uint8_t rawDataMag[6]; - float magReading[3]; readBytes(MagAddress, BMX055_MAG_X_LSB, 6, &rawDataMag[0]); // Read the 6 raw magnetometer data registers into data array @@ -364,9 +363,6 @@ void BMX055::calibrateMag(calData* cal) MagCount[1] = ((rawDataMag[3] << 8) | (rawDataMag[2] & 0xF8)) >> 3; MagCount[2] = ((rawDataMag[5] << 8) | (rawDataMag[4] & 0xFE)) >> 1; // Turn the MSB and LSB into a signed 15-bit value - magReading[1] = (float)(MagCount[0] * mResXY); - magReading[2] = (float)(MagCount[1] * mResXY); - magReading[3] = (float)(MagCount[2] * mResZ); for (int jj = 0; jj < 3; jj++) { @@ -396,4 +392,4 @@ void BMX055::calibrateMag(calData* cal) cal->magScale[0] = avg_rad / ((float)mag_scale[0]); cal->magScale[1] = avg_rad / ((float)mag_scale[1]); cal->magScale[2] = avg_rad / ((float)mag_scale[2]); -} \ No newline at end of file +} From 5e421056e80f90b603dd21a6f3c78634f24bd48a Mon Sep 17 00:00:00 2001 From: floBik Date: Thu, 27 Jun 2024 13:07:53 +0200 Subject: [PATCH 2/2] refactored initializer for AccelData, GyroData, MagData and calData --- src/F_AK8963.cpp | 4 ++-- src/F_AK8963.hpp | 4 ++-- src/F_AK8975.cpp | 4 ++-- src/F_AK8975.hpp | 4 ++-- src/F_BMI055.cpp | 4 ++-- src/F_BMI055.hpp | 4 ++-- src/F_BMI160.cpp | 4 ++-- src/F_BMI160.hpp | 4 ++-- src/F_BMX055.cpp | 2 +- src/F_BMX055.hpp | 6 +++--- src/F_HMC5883L.cpp | 4 ++-- src/F_HMC5883L.hpp | 2 +- src/F_ICM20689.cpp | 4 ++-- src/F_ICM20689.hpp | 4 ++-- src/F_ICM20690.cpp | 4 ++-- src/F_ICM20690.hpp | 4 ++-- src/F_IMU_Generic.cpp | 4 ++-- src/F_IMU_Generic.hpp | 8 ++++---- src/F_LSM6DS3.cpp | 4 ++-- src/F_LSM6DS3.hpp | 4 ++-- src/F_LSM6DSL.cpp | 4 ++-- src/F_LSM6DSL.hpp | 4 ++-- src/F_MPU6050.cpp | 4 ++-- src/F_MPU6050.hpp | 4 ++-- src/F_MPU6500.cpp | 4 ++-- src/F_MPU6500.hpp | 4 ++-- src/F_MPU6515.cpp | 4 ++-- src/F_MPU6515.hpp | 4 ++-- src/F_MPU6886.cpp | 4 ++-- src/F_MPU6886.hpp | 4 ++-- src/F_MPU9250.cpp | 4 ++-- src/F_MPU9250.hpp | 6 +++--- src/F_MPU9255.cpp | 4 ++-- src/F_MPU9255.hpp | 6 +++--- src/F_QMC5883L.cpp | 4 ++-- src/F_QMC5883L.hpp | 6 +++--- src/F_QMI8658.cpp | 4 ++-- src/F_QMI8658.hpp | 6 +++--- src/IMUBase.hpp | 2 +- 39 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/F_AK8963.cpp b/src/F_AK8963.cpp index 335080f..887c11f 100644 --- a/src/F_AK8963.cpp +++ b/src/F_AK8963.cpp @@ -8,7 +8,7 @@ int AK8963::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; calibration.magScale[0] = 1.f; calibration.magScale[1] = 1.f; calibration.magScale[2] = 1.f; @@ -183,4 +183,4 @@ void AK8963::calibrateMag(calData* cal) cal->magScale[0] = avg_rad / ((float)mag_scale[0]); cal->magScale[1] = avg_rad / ((float)mag_scale[1]); cal->magScale[2] = avg_rad / ((float)mag_scale[2]); -} \ No newline at end of file +} diff --git a/src/F_AK8963.hpp b/src/F_AK8963.hpp index 2fa7d3f..4a87dc7 100644 --- a/src/F_AK8963.hpp +++ b/src/F_AK8963.hpp @@ -76,7 +76,7 @@ class AK8963 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - MagData mag = { 0 }; + MagData mag = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; @@ -113,7 +113,7 @@ class AK8963 : public IMUBase { } // Put read results in the Rx buffer } - float factoryMagCal[3] = { 0 }; + float factoryMagCal[3] = { 0, 0, 0 }; bool dataAvailable(){ return (readByte(AK8963_ADDRESS, AK8963_ST1) & 0x01);} }; diff --git a/src/F_AK8975.cpp b/src/F_AK8975.cpp index 30e4bc6..a66a53c 100644 --- a/src/F_AK8975.cpp +++ b/src/F_AK8975.cpp @@ -8,7 +8,7 @@ int AK8975::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; calibration.magScale[0] = 1.f; calibration.magScale[1] = 1.f; calibration.magScale[2] = 1.f; @@ -192,4 +192,4 @@ void AK8975::calibrateMag(calData* cal) cal->magScale[0] = avg_rad / ((float)mag_scale[0]); cal->magScale[1] = avg_rad / ((float)mag_scale[1]); cal->magScale[2] = avg_rad / ((float)mag_scale[2]); -} \ No newline at end of file +} diff --git a/src/F_AK8975.hpp b/src/F_AK8975.hpp index 42b9b11..33fe55c 100644 --- a/src/F_AK8975.hpp +++ b/src/F_AK8975.hpp @@ -76,7 +76,7 @@ class AK8975 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - MagData mag = { 0 }; + MagData mag = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; @@ -113,7 +113,7 @@ class AK8975 : public IMUBase { } // Put read results in the Rx buffer } - float factoryMagCal[3] = { 0 }; + float factoryMagCal[3] = { 0, 0, 0 }; bool dataAvailable() { diff --git a/src/F_BMI055.cpp b/src/F_BMI055.cpp index cfd59e4..7070df0 100644 --- a/src/F_BMI055.cpp +++ b/src/F_BMI055.cpp @@ -17,7 +17,7 @@ int BMI055::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -304,4 +304,4 @@ void BMI055::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1]; cal->gyroBias[2] = (float)gyro_bias[2]; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_BMI055.hpp b/src/F_BMI055.hpp index 1906432..952a712 100644 --- a/src/F_BMI055.hpp +++ b/src/F_BMI055.hpp @@ -86,8 +86,8 @@ class BMI055 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; diff --git a/src/F_BMI160.cpp b/src/F_BMI160.cpp index a5a82d4..736b41d 100644 --- a/src/F_BMI160.cpp +++ b/src/F_BMI160.cpp @@ -9,7 +9,7 @@ int BMI160::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -277,4 +277,4 @@ void BMI160::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1]; cal->gyroBias[2] = (float)gyro_bias[2]; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_BMI160.hpp b/src/F_BMI160.hpp index 5d58cc0..fb44c7f 100644 --- a/src/F_BMI160.hpp +++ b/src/F_BMI160.hpp @@ -148,8 +148,8 @@ class BMI160 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_BMX055.cpp b/src/F_BMX055.cpp index aad98eb..731bbb1 100644 --- a/src/F_BMX055.cpp +++ b/src/F_BMX055.cpp @@ -20,7 +20,7 @@ int BMX055::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; calibration.magScale[0] = 1.f; calibration.magScale[1] = 1.f; calibration.magScale[2] = 1.f; diff --git a/src/F_BMX055.hpp b/src/F_BMX055.hpp index cc4abb9..7805b4a 100644 --- a/src/F_BMX055.hpp +++ b/src/F_BMX055.hpp @@ -108,9 +108,9 @@ class BMX055 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; - MagData mag = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; + MagData mag = { 0, 0, 0 }; calData calibration; diff --git a/src/F_HMC5883L.cpp b/src/F_HMC5883L.cpp index 20cc86f..d37af7e 100644 --- a/src/F_HMC5883L.cpp +++ b/src/F_HMC5883L.cpp @@ -10,7 +10,7 @@ int HMC5883L::init(calData cal, uint8_t address) //load cal if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; calibration.magScale[0] = 1.f; calibration.magScale[1] = 1.f; calibration.magScale[2] = 1.f; @@ -170,4 +170,4 @@ void HMC5883L::calibrateMag(calData* cal) cal->magScale[0] = avg_rad / ((float)mag_scale[0]); cal->magScale[1] = avg_rad / ((float)mag_scale[1]); cal->magScale[2] = avg_rad / ((float)mag_scale[2]); -} \ No newline at end of file +} diff --git a/src/F_HMC5883L.hpp b/src/F_HMC5883L.hpp index 7f0b6a3..3e1b310 100644 --- a/src/F_HMC5883L.hpp +++ b/src/F_HMC5883L.hpp @@ -69,7 +69,7 @@ class HMC5883L : public IMUBase { private: float mRes = 10. * 819.2f / 2048.f; //mRes value for full range (+-819.2uT scaled * 10) readings (12 bit) int geometryIndex = 0; - MagData mag = { 0 }; + MagData mag = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_ICM20689.cpp b/src/F_ICM20689.cpp index 7331721..ee50fd5 100644 --- a/src/F_ICM20689.cpp +++ b/src/F_ICM20689.cpp @@ -9,7 +9,7 @@ int ICM20689::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -324,4 +324,4 @@ void ICM20689::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1] / (float)gyrosensitivity; cal->gyroBias[2] = (float)gyro_bias[2] / (float)gyrosensitivity; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_ICM20689.hpp b/src/F_ICM20689.hpp index 6ee2655..995b1b7 100644 --- a/src/F_ICM20689.hpp +++ b/src/F_ICM20689.hpp @@ -129,8 +129,8 @@ class ICM20689 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_ICM20690.cpp b/src/F_ICM20690.cpp index c056ba8..580e83e 100644 --- a/src/F_ICM20690.cpp +++ b/src/F_ICM20690.cpp @@ -9,7 +9,7 @@ int ICM20690::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -324,4 +324,4 @@ void ICM20690::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1] / (float)gyrosensitivity; cal->gyroBias[2] = (float)gyro_bias[2] / (float)gyrosensitivity; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_ICM20690.hpp b/src/F_ICM20690.hpp index 977f2d9..4c7dd4f 100644 --- a/src/F_ICM20690.hpp +++ b/src/F_ICM20690.hpp @@ -128,8 +128,8 @@ class ICM20690 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_IMU_Generic.cpp b/src/F_IMU_Generic.cpp index df7c821..8b465b5 100644 --- a/src/F_IMU_Generic.cpp +++ b/src/F_IMU_Generic.cpp @@ -9,7 +9,7 @@ int IMU_Generic::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; calibration.magScale[0] = 1.f; calibration.magScale[1] = 1.f; calibration.magScale[2] = 1.f; @@ -474,4 +474,4 @@ void IMU_Generic::calibrateMag(calData* cal) cal->magScale[0] = avg_rad / ((float)mag_scale[0]); cal->magScale[1] = avg_rad / ((float)mag_scale[1]); cal->magScale[2] = avg_rad / ((float)mag_scale[2]); -} \ No newline at end of file +} diff --git a/src/F_IMU_Generic.hpp b/src/F_IMU_Generic.hpp index ba5ed23..872f4f4 100644 --- a/src/F_IMU_Generic.hpp +++ b/src/F_IMU_Generic.hpp @@ -207,9 +207,9 @@ class IMU_Generic : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; - MagData mag = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; + MagData mag = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; @@ -246,7 +246,7 @@ class IMU_Generic : public IMUBase { } // Put read results in the Rx buffer } - float factoryMagCal[3] = { 0 }; + float factoryMagCal[3] = { 0, 0, 0 }; bool dataAvailable(){ return (readByte(IMUAddress, IMU_Generic_INT_STATUS) & 0x01);} }; diff --git a/src/F_LSM6DS3.cpp b/src/F_LSM6DS3.cpp index 4e16946..602ad7d 100644 --- a/src/F_LSM6DS3.cpp +++ b/src/F_LSM6DS3.cpp @@ -9,7 +9,7 @@ int LSM6DS3::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -257,4 +257,4 @@ void LSM6DS3::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1]; cal->gyroBias[2] = (float)gyro_bias[2]; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_LSM6DS3.hpp b/src/F_LSM6DS3.hpp index ae0a59d..4f164f1 100644 --- a/src/F_LSM6DS3.hpp +++ b/src/F_LSM6DS3.hpp @@ -98,8 +98,8 @@ class LSM6DS3 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_LSM6DSL.cpp b/src/F_LSM6DSL.cpp index 3caf898..e6f8a42 100644 --- a/src/F_LSM6DSL.cpp +++ b/src/F_LSM6DSL.cpp @@ -9,7 +9,7 @@ int LSM6DSL::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -258,4 +258,4 @@ void LSM6DSL::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1]; cal->gyroBias[2] = (float)gyro_bias[2]; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_LSM6DSL.hpp b/src/F_LSM6DSL.hpp index ad14fbd..1c3a7fc 100644 --- a/src/F_LSM6DSL.hpp +++ b/src/F_LSM6DSL.hpp @@ -99,8 +99,8 @@ class LSM6DSL : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_MPU6050.cpp b/src/F_MPU6050.cpp index 25b7a21..50c3d6f 100644 --- a/src/F_MPU6050.cpp +++ b/src/F_MPU6050.cpp @@ -9,7 +9,7 @@ int MPU6050::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -321,4 +321,4 @@ void MPU6050::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1] / (float)gyrosensitivity; cal->gyroBias[2] = (float)gyro_bias[2] / (float)gyrosensitivity; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_MPU6050.hpp b/src/F_MPU6050.hpp index c62266e..2dc8c22 100644 --- a/src/F_MPU6050.hpp +++ b/src/F_MPU6050.hpp @@ -114,8 +114,8 @@ class MPU6050 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_MPU6500.cpp b/src/F_MPU6500.cpp index 89aaa56..9df8fcb 100644 --- a/src/F_MPU6500.cpp +++ b/src/F_MPU6500.cpp @@ -9,7 +9,7 @@ int MPU6500::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -325,4 +325,4 @@ void MPU6500::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1] / (float)gyrosensitivity; cal->gyroBias[2] = (float)gyro_bias[2] / (float)gyrosensitivity; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_MPU6500.hpp b/src/F_MPU6500.hpp index 7756d3c..65caf5a 100644 --- a/src/F_MPU6500.hpp +++ b/src/F_MPU6500.hpp @@ -184,8 +184,8 @@ class MPU6500 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_MPU6515.cpp b/src/F_MPU6515.cpp index 8e5a720..11fb64a 100644 --- a/src/F_MPU6515.cpp +++ b/src/F_MPU6515.cpp @@ -9,7 +9,7 @@ int MPU6515::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -325,4 +325,4 @@ void MPU6515::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1] / (float)gyrosensitivity; cal->gyroBias[2] = (float)gyro_bias[2] / (float)gyrosensitivity; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_MPU6515.hpp b/src/F_MPU6515.hpp index 63e5484..31a3f57 100644 --- a/src/F_MPU6515.hpp +++ b/src/F_MPU6515.hpp @@ -184,8 +184,8 @@ class MPU6515 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_MPU6886.cpp b/src/F_MPU6886.cpp index 14691db..01c42f7 100644 --- a/src/F_MPU6886.cpp +++ b/src/F_MPU6886.cpp @@ -9,7 +9,7 @@ int MPU6886::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -325,4 +325,4 @@ void MPU6886::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1] / (float)gyrosensitivity; cal->gyroBias[2] = (float)gyro_bias[2] / (float)gyrosensitivity; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_MPU6886.hpp b/src/F_MPU6886.hpp index 05c95d7..7fc30b2 100644 --- a/src/F_MPU6886.hpp +++ b/src/F_MPU6886.hpp @@ -184,8 +184,8 @@ class MPU6886 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_MPU9250.cpp b/src/F_MPU9250.cpp index 7034d0d..c524982 100644 --- a/src/F_MPU9250.cpp +++ b/src/F_MPU9250.cpp @@ -9,7 +9,7 @@ int MPU9250::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; calibration.magScale[0] = 1.f; calibration.magScale[1] = 1.f; calibration.magScale[2] = 1.f; @@ -345,4 +345,4 @@ void MPU9250::calibrateAccelGyro(calData* cal) void MPU9250::calibrateMag(calData* cal) { mag.calibrateMag(cal); -} \ No newline at end of file +} diff --git a/src/F_MPU9250.hpp b/src/F_MPU9250.hpp index 709fa45..aab0d2a 100644 --- a/src/F_MPU9250.hpp +++ b/src/F_MPU9250.hpp @@ -191,8 +191,8 @@ class MPU9250 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; AK8963 mag; @@ -231,7 +231,7 @@ class MPU9250 : public IMUBase { } // Put read results in the Rx buffer } - float factoryMagCal[3] = { 0 }; + float factoryMagCal[3] = { 0, 0, 0 }; bool dataAvailable(){ return (readByte(IMUAddress, MPU9250_INT_STATUS) & 0x01);} }; diff --git a/src/F_MPU9255.cpp b/src/F_MPU9255.cpp index 8611ec6..30f4a46 100644 --- a/src/F_MPU9255.cpp +++ b/src/F_MPU9255.cpp @@ -9,7 +9,7 @@ int MPU9255::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; calibration.magScale[0] = 1.f; calibration.magScale[1] = 1.f; calibration.magScale[2] = 1.f; @@ -345,4 +345,4 @@ void MPU9255::calibrateAccelGyro(calData* cal) void MPU9255::calibrateMag(calData* cal) { mag.calibrateMag(cal); -} \ No newline at end of file +} diff --git a/src/F_MPU9255.hpp b/src/F_MPU9255.hpp index 9701bb9..cbef75c 100644 --- a/src/F_MPU9255.hpp +++ b/src/F_MPU9255.hpp @@ -191,8 +191,8 @@ class MPU9255 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; AK8963 mag; @@ -231,7 +231,7 @@ class MPU9255 : public IMUBase { } // Put read results in the Rx buffer } - float factoryMagCal[3] = { 0 }; + float factoryMagCal[3] = { 0, 0, 0 }; bool dataAvailable(){ return (readByte(IMUAddress, MPU9255_INT_STATUS) & 0x01);} }; diff --git a/src/F_QMC5883L.cpp b/src/F_QMC5883L.cpp index eb5b6dc..b0d6321 100644 --- a/src/F_QMC5883L.cpp +++ b/src/F_QMC5883L.cpp @@ -10,7 +10,7 @@ int QMC5883L::init(calData cal, uint8_t address) //load cal if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; calibration.magScale[0] = 1.f; calibration.magScale[1] = 1.f; calibration.magScale[2] = 1.f; @@ -150,4 +150,4 @@ void QMC5883L::calibrateMag(calData* cal) cal->magScale[0] = avg_rad / ((float)mag_scale[0]); cal->magScale[1] = avg_rad / ((float)mag_scale[1]); cal->magScale[2] = avg_rad / ((float)mag_scale[2]); -} \ No newline at end of file +} diff --git a/src/F_QMC5883L.hpp b/src/F_QMC5883L.hpp index 528d818..7364ea0 100644 --- a/src/F_QMC5883L.hpp +++ b/src/F_QMC5883L.hpp @@ -72,9 +72,9 @@ class QMC5883L : public IMUBase { float temperature = 0.f; int geometryIndex = 0; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; - MagData mag = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; + MagData mag = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; diff --git a/src/F_QMI8658.cpp b/src/F_QMI8658.cpp index dd55132..142ac77 100644 --- a/src/F_QMI8658.cpp +++ b/src/F_QMI8658.cpp @@ -9,7 +9,7 @@ int QMI8658::init(calData cal, uint8_t address) if (cal.valid == false) { - calibration = { 0 }; + calibration = {0, {0,0,0},{0,0,0},{0,0,0},{0,0,0}}; } else { @@ -279,4 +279,4 @@ void QMI8658::calibrateAccelGyro(calData* cal) cal->gyroBias[1] = (float)gyro_bias[1]; cal->gyroBias[2] = (float)gyro_bias[2]; cal->valid = true; -} \ No newline at end of file +} diff --git a/src/F_QMI8658.hpp b/src/F_QMI8658.hpp index aa1c768..782b968 100644 --- a/src/F_QMI8658.hpp +++ b/src/F_QMI8658.hpp @@ -104,8 +104,8 @@ class QMI8658 : public IMUBase { int geometryIndex = 0; float temperature = 0.f; - AccelData accel = { 0 }; - GyroData gyro = { 0 }; + AccelData accel = { 0, 0, 0 }; + GyroData gyro = { 0, 0, 0 }; calData calibration; uint8_t IMUAddress; @@ -143,4 +143,4 @@ class QMI8658 : public IMUBase { } // Put read results in the Rx buffer } }; -#endif /* _F_QMI8658_H_ */ \ No newline at end of file +#endif /* _F_QMI8658_H_ */ diff --git a/src/IMUBase.hpp b/src/IMUBase.hpp index 26089ea..8bd310d 100644 --- a/src/IMUBase.hpp +++ b/src/IMUBase.hpp @@ -78,4 +78,4 @@ class IMUBase { } }; -#endif /* _F_IMUBase_H_ */ \ No newline at end of file +#endif /* _F_IMUBase_H_ */