diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index 0fe2d7f43..b95b39b8e 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -144,7 +144,7 @@ void FGRouteMgr::update( double dt ) { target_altitude_ft->setDoubleValue( target_alt * SG_METER_TO_FEET ); altitude_set = true; - if ( !on_ground() ) + if ( !near_ground() ) altitude_lock->setStringValue( "altitude-hold" ); } @@ -295,7 +295,7 @@ int FGRouteMgr::new_waypoint( const string& Tgt_Alt, int n ) { add_waypoint( *wp, n ); delete wp; - if ( !on_ground() ) + if ( !near_ground() ) fgSetString( "/autopilot/locks/heading", "true-heading-hold" ); } return type; @@ -391,11 +391,15 @@ void FGRouteMgr::update_mirror() { } -bool FGRouteMgr::on_ground() { +bool FGRouteMgr::near_ground() { SGPropertyNode *gear = fgGetNode( "/gear/gear/wow", false ); if ( !gear || gear->getType() == SGPropertyNode::NONE ) return fgGetBool( "/sim/presets/onground", true ); + if ( fgGetDouble("/position/altitude-agl-ft", 300.0) + < fgGetDouble("/autopilot/route-manager/min-lock-altitude-agl-ft") ) + return true; + return gear->getBoolValue(); } diff --git a/src/Autopilot/route_mgr.hxx b/src/Autopilot/route_mgr.hxx index 69fa508af..22d373a3d 100644 --- a/src/Autopilot/route_mgr.hxx +++ b/src/Autopilot/route_mgr.hxx @@ -95,7 +95,7 @@ private: int make_waypoint( SGWayPoint **wp, string& target ); void update_mirror(); - bool on_ground(); + bool near_ground(); public: