1
0
Fork 0

only activate heading & altitude lock when in air (and even then it should

probably be configurable?).
This commit is contained in:
mfranz 2006-05-11 10:01:47 +00:00
parent cbddd130ec
commit ef339945fd
2 changed files with 18 additions and 6 deletions

View file

@ -140,10 +140,12 @@ void FGRouteMgr::update( double dt ) {
true_hdg_deg->setDoubleValue( wp_course ); true_hdg_deg->setDoubleValue( wp_course );
double target_alt = wp.get_target_alt(); double target_alt = wp.get_target_alt();
if (!altitude_set && target_alt > -9990) { if ( !altitude_set && target_alt > -9990 ) {
target_altitude_ft->setDoubleValue( target_alt * SG_METER_TO_FEET ); target_altitude_ft->setDoubleValue( target_alt * SG_METER_TO_FEET );
altitude_lock->setStringValue( "altitude-hold" );
altitude_set = true; altitude_set = true;
if ( !on_ground() )
altitude_lock->setStringValue( "altitude-hold" );
} }
if ( wp_distance < 200.0 ) { if ( wp_distance < 200.0 ) {
@ -229,7 +231,7 @@ void FGRouteMgr::update( double dt ) {
void FGRouteMgr::add_waypoint( const SGWayPoint& wp, int n ) { void FGRouteMgr::add_waypoint( const SGWayPoint& wp, int n ) {
if ( n == 0 || !route->size()) if ( n == 0 || !route->size() )
altitude_set = false; altitude_set = false;
route->add_waypoint( wp, n ); route->add_waypoint( wp, n );
@ -278,7 +280,6 @@ bool FGRouteMgr::build() {
} }
int FGRouteMgr::new_waypoint( const string& Tgt_Alt, int n ) { int FGRouteMgr::new_waypoint( const string& Tgt_Alt, int n ) {
string target = Tgt_Alt; string target = Tgt_Alt;
@ -292,14 +293,15 @@ int FGRouteMgr::new_waypoint( const string& Tgt_Alt, int n ) {
if (wp) { if (wp) {
add_waypoint( *wp, n ); add_waypoint( *wp, n );
fgSetString( "/autopilot/locks/heading", "true-heading-hold" );
delete wp; delete wp;
if ( !on_ground() )
fgSetString( "/autopilot/locks/heading", "true-heading-hold" );
} }
return type; return type;
} }
int FGRouteMgr::make_waypoint(SGWayPoint **wp, string& target) { int FGRouteMgr::make_waypoint(SGWayPoint **wp, string& target) {
double alt = -9999.0; double alt = -9999.0;
@ -389,6 +391,15 @@ void FGRouteMgr::update_mirror() {
} }
bool FGRouteMgr::on_ground() {
SGPropertyNode *gear = fgGetNode( "/gear/gear/wow", false );
if ( !gear || gear->getType() == SGPropertyNode::NONE )
return fgGetBool( "/sim/presets/onground", true );
return gear->getBoolValue();
}
// command interface /autopilot/route-manager/input: // command interface /autopilot/route-manager/input:
// //
// @clear ... clear route // @clear ... clear route

View file

@ -95,6 +95,7 @@ private:
int make_waypoint( SGWayPoint **wp, string& target ); int make_waypoint( SGWayPoint **wp, string& target );
void update_mirror(); void update_mirror();
bool on_ground();
public: public: