From 12c5a631f6be4c945da88ac7ba1c3e1c6f992904 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 9 Apr 2009 15:36:42 +0000 Subject: [PATCH] Better handling of glide slope and in range flags when slaved to external GPS. --- src/Instrumentation/navradio.cxx | 14 ++++++++++++-- src/Instrumentation/navradio.hxx | 1 + src/Network/AV400Sim.cxx | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index 4553744d7..60fd44155 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -89,6 +89,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) : gps_cdi_deflection_node(NULL), gps_to_flag_node(NULL), gps_from_flag_node(NULL), + gps_has_gs_node(NULL), last_nav_id(""), last_nav_vor(false), play_count(0), @@ -201,6 +202,7 @@ FGNavRadio::init () gps_cdi_deflection_node = fgGetNode("/instrumentation/gps/cdi-deflection", true); gps_to_flag_node = fgGetNode("/instrumentation/gps/to-flag", true); gps_from_flag_node = fgGetNode("/instrumentation/gps/from-flag", true); + gps_has_gs_node = fgGetNode("/instrumentation/gps/has-gs", true); std::ostringstream temp; temp << _name << "nav-ident" << _num; @@ -314,8 +316,16 @@ FGNavRadio::update(double dt) bool nav_serviceable = nav_serviceable_node->getBoolValue(); bool cdi_serviceable = cdi_serviceable_node->getBoolValue(); bool tofrom_serviceable = tofrom_serviceable_node->getBoolValue(); - bool inrange = inrange_node->getBoolValue(); - bool has_gs = has_gs_node->getBoolValue(); + bool inrange = false; + bool has_gs = false; + if ( nav_slaved_to_gps_node->getBoolValue() ) { + has_gs = gps_has_gs_node->getBoolValue(); + inrange = gps_to_flag_node->getBoolValue() + || gps_from_flag_node->getBoolValue(); + } else { + has_gs = has_gs_node->getBoolValue(); + inrange = inrange_node->getBoolValue(); + } bool is_loc = loc_node->getBoolValue(); double loc_dist = loc_dist_node->getDoubleValue(); double effective_range_m; diff --git a/src/Instrumentation/navradio.hxx b/src/Instrumentation/navradio.hxx index a03ccb739..92f80bc37 100644 --- a/src/Instrumentation/navradio.hxx +++ b/src/Instrumentation/navradio.hxx @@ -106,6 +106,7 @@ class FGNavRadio : public SGSubsystem SGPropertyNode_ptr gps_cdi_deflection_node; SGPropertyNode_ptr gps_to_flag_node; SGPropertyNode_ptr gps_from_flag_node; + SGPropertyNode_ptr gps_has_gs_node; // internal (private) values diff --git a/src/Network/AV400Sim.cxx b/src/Network/AV400Sim.cxx index 54d3713ad..2d704a83e 100644 --- a/src/Network/AV400Sim.cxx +++ b/src/Network/AV400Sim.cxx @@ -206,7 +206,7 @@ bool FGAV400Sim::parse_message() { } fgSetDouble("/instrumentation/gps/cdi-deflection", (double)pos / 8.0); - fgSetBool("/instrumentation/nav[0]/has-gs", false); + fgSetBool("/instrumentation/gps/has-gs", false); } } else if ( ident == "k" ) { string ind = msg.substr(1,1); -- 2.39.5