Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
Diff: Magnetometer.cpp
- Revision:
- 34:01dec68de3ed
- Parent:
- 32:d37447aec6b4
- Child:
- 40:8e852115fe55
diff -r bd56fc8aeb0a -r 01dec68de3ed Magnetometer.cpp --- a/Magnetometer.cpp Tue May 05 09:59:11 2015 +0000 +++ b/Magnetometer.cpp Wed May 06 07:50:02 2015 +0000 @@ -10,11 +10,11 @@ readCalibrationData(); // temperature calibration // Initialise hard-iron and soft-iron correction. The minima and maxima values were measured - // on my desk and give a starting point for the background calibrator. - float minimums[] = { -1800.0f, -80.0f, -1800.0f }; - float maximums[] = { - 350, 1200, 4 }; + // smartplane2 prototype gives a starting point for the background calibrator. + float minimums[] = { -1536.0f, -2701.0f, -2112.0f }; + float maximums[] = { 187, 1665, 39 }; calibrator.setExtremes(minimums, maximums); - + INFO("Bosch Sensortec BMX055-Magneto found"); powerOff(); } else { @@ -104,6 +104,18 @@ return Vector3(-output[0], output[1], output[2]); } +void Magnetometer::getCalibration(Vector3 &mins, Vector3 &maxs) +{ + float mi[3], ma[3]; + calibrator.getExtremes(mi, ma); + mins.x = mi[0]; + mins.y = mi[1]; + mins.z = mi[2]; + maxs.x = ma[0]; + maxs.y = ma[1]; + maxs.z = ma[2]; +} + void Magnetometer::readCalibrationData() { // trying to read in serial order of address