]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gps.cxx
GPS: improve reliability (at the expense of some in-development features) for pending...
[flightgear.git] / src / Instrumentation / gps.cxx
index 0343a19d24f72201f23607839b1038a93db6fe2f..2c6f36495882344acf8d2b10ddfe32bfaec72c66 100644 (file)
@@ -186,12 +186,12 @@ private:
 GPS::Config::Config() :
   _enableTurnAnticipation(true),
   _turnRate(3.0), // degrees-per-second, so 180 degree turn takes 60 seconds
-  _overflightArmDistance(0.5),
+  _overflightArmDistance(1.0),
   _waypointAlertTime(30.0),
   _tuneRadio1ToRefVor(false),
   _minRunwayLengthFt(0.0),
   _requireHardSurface(true),
-  _cdiMaxDeflectionNm(-1), // default to angular mode
+  _cdiMaxDeflectionNm(3.0), // linear mode, 3nm at the peg
   _driveAutopilot(true)
 {
   _enableTurnAnticipation = false;
@@ -1003,8 +1003,12 @@ void GPS::driveAutopilot()
     return;
   }
  
-  // FIXME: we want to set desired track, not heading, here
-  _apTrueHeading->setDoubleValue(getWP1Bearing());
+  // compatability feature - allow the route-manager / GPS to drive the
+  // generic autopilot heading hold *in leg mode only* 
+  if (_mode == "leg") {
+    // FIXME: we want to set desired track, not heading, here
+    _apTrueHeading->setDoubleValue(getWP1Bearing());
+  }
 }
 
 void GPS::wp1Changed()
@@ -1017,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);
   }
 }
@@ -1381,7 +1383,7 @@ void GPS::loadRouteWaypoint()
   int index = _scratchNode->getIntValue("index", -9999);
   clearScratch();
   
-  if (index == -9999) { // no index supplied, use current wp
+  if ((index < 0) || (index >= _routeMgr->size())) { // no index supplied, use current wp
     index = _routeMgr->currentWaypoint();
   }