]> git.mxchange.org Git - flightgear.git/commitdiff
GPS: improve reliability (at the expense of some in-development features) for pending...
authorjmt <jmt>
Sun, 10 Jan 2010 23:35:53 +0000 (23:35 +0000)
committerTim Moore <timoore@redhat.com>
Sat, 16 Jan 2010 15:00:15 +0000 (16:00 +0100)
- default to an invalid altitude in routes, instead of cruise altitude (temporarily)
- only set an altitude on the autopilot, if valid
- only add departure airport/runway to the route, if not airborne

src/Autopilot/route_mgr.cxx
src/Instrumentation/gps.cxx

index 45e3c922ff36e978fc0495b5f5f69e685018d17c..c83e80ec9a5c481d00aac0138dfbe024040aca2d 100644 (file)
@@ -340,9 +340,9 @@ void FGRouteMgr::new_waypoint( const string& target, int n ) {
 SGWayPoint* FGRouteMgr::make_waypoint(const string& tgt ) {
     string target(boost::to_upper_copy(tgt));
     
-    // extract altitude
-    double alt = cruise->getDoubleValue("altitude-ft") * SG_FEET_TO_METER;
     
+    double alt = -9999.0;
+    // extract altitude
     size_t pos = target.find( '@' );
     if ( pos != string::npos ) {
         alt = atof( target.c_str() + pos + 1 );
@@ -490,7 +490,14 @@ void FGRouteMgr::InputListener::valueChanged(SGPropertyNode *prop)
 
 bool FGRouteMgr::activate()
 {
-  if (_departure) {
+  if (isRouteActive()) {
+    SG_LOG(SG_AUTOPILOT, SG_WARN, "duplicate route-activation, no-op");
+    return false;
+  }
+
+  // only add departure waypoint if we're not airborne, so that
+  // in-air route activation doesn't confuse matters.
+  if (weightOnWheels->getBoolValue() && _departure) {
     string runwayId(departure->getStringValue("runway"));
     FGRunway* runway = NULL;
     if (_departure->hasRunwayWithIdent(runwayId)) {
index bb15a34db5eb33798cf2e1d969c6c1768af4f52c..2c6f36495882344acf8d2b10ddfe32bfaec72c66 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);
   }
 }