From 244547eb4c43325b9e3e532ad7ccf1536ce0641d Mon Sep 17 00:00:00 2001 From: mfranz Date: Fri, 12 May 2006 09:36:21 +0000 Subject: [PATCH] only lock AP automatically if above /autopilot/route-manager/min-lock-altitude-agl-ft The ufo sets this to a very low value, "serious" aircraft (which don't want this unrealistic automatism at all) set it to a very high value, and those that don't care ... don't need to care. --- src/Autopilot/route_mgr.cxx | 10 +++++++--- src/Autopilot/route_mgr.hxx | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) 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: -- 2.39.5