From 976f3115a95b681aa466ffdb6af9f1fe8b2c394c Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 14 Jan 2014 13:04:52 +0000 Subject: [PATCH] GPS bug fix: restore startup mode. - the 'default to current airport' behaviour got broken by the changes to the scratch. - expose a 'valid' flag on WP1 --- src/Instrumentation/gps.cxx | 11 ++++++++++- src/Instrumentation/gps.hxx | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index a50ee1ff7..8fd2b0432 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -164,7 +164,8 @@ GPS::init () // autopilot drive properties _apDrivingFlag = fgGetNode("/autopilot/settings/gps-driving-true-heading", true); _apTrueHeading = fgGetNode("/autopilot/settings/true-heading-deg",true); - + + clearScratch(); clearOutput(); } @@ -222,6 +223,9 @@ GPS::bind() tie(wp0_node, "ID", SGRawValueMethods (*this, &GPS::getWP0Ident, NULL)); + + tie(_currentWayptNode, "valid", SGRawValueMethods + (*this, &GPS::getWP1IValid, NULL)); tie(_currentWayptNode, "ID", SGRawValueMethods (*this, &GPS::getWP1Ident, NULL)); @@ -927,6 +931,11 @@ const char* GPS::getWP0Name() const return ""; } +bool GPS::getWP1IValid() const +{ + return _dataValid && _currentWaypt.get(); +} + const char* GPS::getWP1Ident() const { if ((!_dataValid)||(!_currentWaypt)) { diff --git a/src/Instrumentation/gps.hxx b/src/Instrumentation/gps.hxx index 444f029d2..a142330ce 100644 --- a/src/Instrumentation/gps.hxx +++ b/src/Instrumentation/gps.hxx @@ -268,6 +268,7 @@ private: const char* getWP0Ident() const; const char* getWP0Name() const; + bool getWP1IValid() const; const char* getWP1Ident() const; const char* getWP1Name() const; -- 2.39.5