Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
Diff: Magnetometer.cpp
- Revision:
- 15:4488660e1a3b
- Parent:
- 14:d9fbb3ccd482
- Child:
- 32:d37447aec6b4
--- a/Magnetometer.cpp Tue Mar 17 15:50:41 2015 +0000 +++ b/Magnetometer.cpp Wed Mar 18 15:34:51 2015 +0000 @@ -77,7 +77,7 @@ //read_reg(0x40, buffer, 4); // Datasheet is wrong, BMX055 magneto x and y axis are interchanged and y axis is inverted !!! - const int16_t mdata_y = *(reinterpret_cast<const int16_t*>(buffer + 0)) / -8; + const int16_t mdata_y = *(reinterpret_cast<const int16_t*>(buffer + 0)) / 8; const int16_t mdata_x = *(reinterpret_cast<const int16_t*>(buffer + 2)) / 8; const int16_t mdata_z = *(reinterpret_cast<const int16_t*>(buffer + 4)) / 2; const uint16_t data_r = *(reinterpret_cast<const uint16_t*>(buffer + 6)) / 4; @@ -101,7 +101,7 @@ float output[3]; calibrator.run(input, output); - return Vector3(output[0], output[1], output[2]); + return Vector3(-output[0], output[1], output[2]); } void Magnetometer::readCalibrationData()