remove Adjustments params. Matrix can replace.

This commit is contained in:
Boronare
2022-01-30 19:56:49 +09:00
parent b545d1dd8d
commit 2963068c78
4 changed files with 3 additions and 26 deletions

View File

@@ -41,9 +41,6 @@ THE SOFTWARE.
*/
MPU9250::MPU9250() {
devAddr = MPU9250_DEFAULT_ADDRESS;
asax = 0;
asay = 0;
asaz = 0;
}
/** Power on and prepare for general usage.
@@ -70,15 +67,6 @@ void MPU9250::initialize(uint8_t address) {
I2Cdev::writeByte(MPU9250_RA_MAG_ADDRESS, MPU9250_RA_MAG_CNTL1, 0x0F);
delay(10);
// Read and store magnetometer factory sensitivity adjustments
uint8_t adjx = 0, adjy = 0, adjz = 0;
I2Cdev::readByte(MPU9250_RA_MAG_ADDRESS, MPU9250_RA_MAG_ASAX, &adjx);
I2Cdev::readByte(MPU9250_RA_MAG_ADDRESS, MPU9250_RA_MAG_ASAY, &adjy);
I2Cdev::readByte(MPU9250_RA_MAG_ADDRESS, MPU9250_RA_MAG_ASAZ, &adjz);
asax = (0.5 * (adjx - 128)) / 128 + 1;
asay = (0.5 * (adjy - 128)) / 128 + 1;
asaz = (0.5 * (adjz - 128)) / 128 + 1;
// Power down magnetometer
I2Cdev::writeByte(MPU9250_RA_MAG_ADDRESS, MPU9250_RA_MAG_CNTL1, 0x00);
delay(10);
@@ -104,12 +92,6 @@ void MPU9250::initialize(uint8_t address) {
setMasterClockSpeed(13);
}
void MPU9250::getMagnetometerAdjustments(float adjustments[3]) {
adjustments[0] = asax;
adjustments[1] = asay;
adjustments[2] = asaz;
}
uint8_t MPU9250::getAddr() {
return devAddr;
}

View File

@@ -1005,11 +1005,9 @@ class MPU9250 {
uint16_t dmpGetFIFOPacketSize();
#endif
void getMagnetometerAdjustments(float *adjustments);
private:
uint8_t devAddr;
uint8_t buffer[14];
float asax, asay, asaz;
};
#endif /* _MPU9250_H_ */

View File

@@ -66,7 +66,6 @@ void MPU9250Sensor::motionSetup() {
if(az>0 && 10.0*(ax*ax+ay*ay)<az*az)
startCalibration(0);
}
imu.getMagnetometerAdjustments(adjustments);
#ifndef _MAHONY_H_
devStatus = imu.dmpInitialize();
if(devStatus == 0){
@@ -177,10 +176,9 @@ void MPU9250Sensor::getMPUScaled()
#endif
vector_normalize(Axyz);
// Apply correction for 16-bit mode and factory sensitivity adjustments
Mxyz[0] = (float)mx * 0.15f * adjustments[0];
Mxyz[1] = (float)my * 0.15f * adjustments[1];
Mxyz[2] = (float)mz * 0.15f * adjustments[2];
Mxyz[0] = (float)mx;
Mxyz[1] = (float)my;
Mxyz[2] = (float)mz;
//apply offsets and scale factors from Magneto
#if useFullCalibrationMatrix == true
for (i = 0; i < 3; i++)

View File

@@ -38,7 +38,6 @@ public:
private:
MPU9250 imu{};
CalibrationConfig *calibration;
float adjustments[3];
bool dmpReady = false; // set true if DMP init was successful
uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU
uint8_t devStatus; // return status after each device operation (0 = success, !0 = error)