From 26a8ffb44e405ecf5e410ba334a032e0f73da0e7 Mon Sep 17 00:00:00 2001
From: James Turner <zakalawe@mac.com>
Date: Sun, 16 Jun 2013 22:21:41 +0100
Subject: [PATCH] GPS: work around aircraft with missing power.

This restores compatibility with 2.10 and previous versions,
where even explicit (non default) GPS ignores power requirements.
---
 src/Instrumentation/gps.cxx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx
index e38a1d04b..700b2aab1 100644
--- a/src/Instrumentation/gps.cxx
+++ b/src/Instrumentation/gps.cxx
@@ -287,7 +287,10 @@ GPS::update (double delta_time_sec)
 {
   if (!_defaultGPSMode) {
     // If it's off, don't bother.
-    if (!_serviceable_node->getBoolValue() || !_electrical_node->getBoolValue()) {
+      // check if value is defined, since many aircraft don't define an output
+      // for the GPS, but expect the default one to work.
+      bool elecOn = !_electrical_node->hasValue() || _electrical_node->getBoolValue();
+    if (!_serviceable_node->getBoolValue() || !elecOn) {
       clearOutput();
       return;
     }