Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: MMC5883L/MMC5883L.cpp
- Revision:
- 5:778bddacaa80
- Parent:
- 4:3618abce1646
diff -r 3618abce1646 -r 778bddacaa80 MMC5883L/MMC5883L.cpp
--- a/MMC5883L/MMC5883L.cpp Thu Apr 21 13:19:41 2022 +0000
+++ b/MMC5883L/MMC5883L.cpp Thu Apr 21 19:07:15 2022 +0000
@@ -158,16 +158,15 @@
void MMC5883L::getXYZ_OffsetRemoved_RAW(int16_t output[3])
{
// TODO: offset reemove
- int16_t data_set[3];
+ double sensitivity = 0.05;
+ int16_t set_data[3];
+ int16_t reset_data[3];
flipSet();
- getXYZ_RAW(data_set);
- int16_t data_reset[3];
+ getXYZ_RAW(set_data);
flipReset();
- getXYZ_RAW(data_reset);
-
+ getXYZ_RAW(reset_data);
for(int i = 0; i < 3; i++) {
- int16_t diff = data_reset[i] - data_set[i];
- output[i] = data_reset[i] - diff/2;
+ output[i] = (reset_data[i] - set_data[i])/2*sensitivity;
}
}