From 5ed73d063c83ad0a8f4ec81435bcfd03c212e940 Mon Sep 17 00:00:00 2001 From: jmt Date: Sat, 13 Feb 2010 19:33:54 +0000 Subject: [PATCH] Bugfix: ensure GPS WP1 Mag-bearing is normalised to [0..360] --- src/Instrumentation/gps.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 2c6f36495..2f7455b83 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -1186,7 +1186,9 @@ double GPS::getWP1MagBearing() const return -9999.0; } - return _wp1TrueBearing - _magvar_node->getDoubleValue(); + double magBearing = _wp1TrueBearing - _magvar_node->getDoubleValue(); + SG_NORMALIZE_RANGE(magBearing, 0.0, 360.0); + return magBearing; } double GPS::getWP1CourseDeviation() const -- 2.39.5