From ee8437431a60877b18746512ba33c276dc24c1d8 Mon Sep 17 00:00:00 2001 From: jmt Date: Sat, 27 Mar 2010 12:18:51 +0000 Subject: [PATCH] Expose a flag indicating if the GPS is driving the AP (to give clearer user feedback when that is the case) --- src/Instrumentation/gps.cxx | 8 +++++++- src/Instrumentation/gps.hxx | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 740c70a38..c44cd7110 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -303,6 +303,7 @@ GPS::init () fromFlag->alias(wp1_node->getChild("from-flag")); // autopilot drive properties + _apDrivingFlag = fgGetNode("/autopilot/settings/gps-driving-true-heading", true); _apTrueHeading = fgGetNode("/autopilot/settings/true-heading-deg",true); _apTargetAltitudeFt = fgGetNode("/autopilot/settings/target-altitude-ft", true); _apAltitudeLock = fgGetNode("/autopilot/locks/altitude", true); @@ -958,12 +959,17 @@ void GPS::updateRouteData() void GPS::driveAutopilot() { if (!_config.driveAutopilot() || !_realismSimpleGps->getBoolValue()) { + _apDrivingFlag->setBoolValue(false); return; } // compatability feature - allow the route-manager / GPS to drive the // generic autopilot heading hold *in leg mode only* - if (_mode == "leg") { + + bool drive = _mode == "leg"; + _apDrivingFlag->setBoolValue(drive); + + if (drive) { // FIXME: we want to set desired track, not heading, here _apTrueHeading->setDoubleValue(getWP1Bearing()); } diff --git a/src/Instrumentation/gps.hxx b/src/Instrumentation/gps.hxx index 56936974d..f1a1b4396 100644 --- a/src/Instrumentation/gps.hxx +++ b/src/Instrumentation/gps.hxx @@ -413,6 +413,7 @@ private: SGPropertyNode_ptr _realismSimpleGps; ///< should the GPS be simple or realistic? // autopilot drive properties + SGPropertyNode_ptr _apDrivingFlag; SGPropertyNode_ptr _apTrueHeading; SGPropertyNode_ptr _apTargetAltitudeFt; SGPropertyNode_ptr _apAltitudeLock; -- 2.39.5