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: HMC5883L.cpp
- Revision:
- 7:3cf4fb613ebb
- Parent:
- 6:48004ffd01c5
--- a/HMC5883L.cpp Fri Oct 19 11:05:58 2018 +0000
+++ b/HMC5883L.cpp Fri Oct 19 12:33:08 2018 +0000
@@ -98,9 +98,9 @@
getXYZ(raw_data);
double heading = atan2(static_cast<double>(raw_data[2]), static_cast<double>(raw_data[0])); // heading = arctan(Y/X) (Y/X)の逆正接
// 角度範囲の補正
- if(heading < 0.0) // fix sign
+ if(heading < -M_PI) // fix sign
heading += PI2;
- if(heading > PI2) // fix overflow
+ if(heading > M_PI) // fix overflow
heading -= PI2;
return heading;
}
\ No newline at end of file