Prevent mirroring of compass heading across North/South axis
The tilt compensation algorithm previously mirrored the compass heading value across a North/South axis i.e. West measured as East and vice versa. This patch corrects the calculation.
This commit is contained in:
parent
d3d64283a7
commit
50bb8d9458
1 changed files with 1 additions and 1 deletions
|
@ -471,7 +471,7 @@ int MicroBitCompass::tiltCompensatedBearing()
|
|||
float bearing = (360*atan2(x*cosTheta + y*sinTheta*sinPhi + z*sinTheta*cosPhi, z*sinPhi - y*cosPhi)) / (2*PI);
|
||||
|
||||
// Handle the 90 degree offset caused by the NORTH_EAST_DOWN based calculation.
|
||||
bearing = bearing - 90;
|
||||
bearing = 90 - bearing;
|
||||
|
||||
// Ensure the calculated bearing is in the 0..359 degree range.
|
||||
if (bearing < 0)
|
||||
|
|
Loading…
Reference in a new issue