]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gps.cxx
Bugfix: ensure GPS WP1 Mag-bearing is normalised to [0..360]
[flightgear.git] / src / Instrumentation / gps.cxx
index bb15a34db5eb33798cf2e1d969c6c1768af4f52c..2f7455b83820b022ffbe382d2fdf0935b0df7e93 100644 (file)
@@ -1021,9 +1021,7 @@ void GPS::wp1Changed()
   }
   
   double altFt = _wp1_position.getElevationFt();
-  if (altFt < -9990.0) {
-    _apTargetAltitudeFt->setDoubleValue(0.0);
-  } else {
+  if (altFt > -9990.0) {
     _apTargetAltitudeFt->setDoubleValue(altFt);
   }
 }
@@ -1188,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