From 4226eab6bdcbf63299f81cfb0ff4346f226648be Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 18 Jan 2003 19:36:50 +0000 Subject: [PATCH] More updates to refine the output data to make it more useful for an external GUI and approach path plotter. --- src/Network/native_gui.cxx | 35 ++++++++++++++++++++++++++++++----- src/Network/net_gui.hxx | 4 +++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/Network/native_gui.cxx b/src/Network/native_gui.cxx index a6e6f82f5..46ee30bdc 100644 --- a/src/Network/native_gui.cxx +++ b/src/Network/native_gui.cxx @@ -149,8 +149,19 @@ void FGProps2NetGUI( FGNetGUI *net ) { net->warp = globals->get_warp(); // Approach - net->dist_nm = current_radiostack->get_navcom1()->get_nav_gs_dist() - * SG_METER_TO_NM; + net->tuned_freq = current_radiostack->get_navcom1()->get_nav_freq(); + net->in_range = current_radiostack->get_navcom1()->get_nav_inrange(); + + if ( current_radiostack->get_navcom1()->get_nav_loc() ) { + // is an ILS + net->dist_nm = current_radiostack->get_navcom1()->get_nav_gs_dist() + * SG_METER_TO_NM; + } else { + // is a VOR + net->dist_nm = current_radiostack->get_navcom1()->get_nav_loc_dist() + * SG_METER_TO_NM; + } + net->course_deviation_deg = current_radiostack->get_navcom1()->get_nav_heading() - current_radiostack->get_navcom1()->get_nav_radial(); @@ -165,9 +176,16 @@ void FGProps2NetGUI( FGNetGUI *net ) { = ( net->course_deviation_deg<0.0 ? -net->course_deviation_deg - 180.0 : -net->course_deviation_deg + 180.0 ); - net->gs_deviation_deg - = current_radiostack->get_navcom1()->get_nav_gs_needle_deflection() - / 5.0; + + if ( current_radiostack->get_navcom1()->get_nav_loc() ) { + // is an ILS + net->gs_deviation_deg + = current_radiostack->get_navcom1()->get_nav_gs_needle_deflection() + / 5.0; + } else { + // is an ILS + net->gs_deviation_deg = -9999.0; + } #if defined( FG_USE_NETWORK_BYTE_ORDER ) // Convert the net buffer to network format @@ -190,6 +208,8 @@ void FGProps2NetGUI( FGNetGUI *net ) { net->cur_time = htonl( net->cur_time ); net->warp = htonl( net->warp ); + htonf(net->tuned_freq); + net->in_range = htonl(net->in_range); htonf(net->dist_nm); htonf(net->course_deviation_deg); htonf(net->gs_deviation_deg); @@ -221,6 +241,8 @@ void FGNetGUI2Props( FGNetGUI *net ) { net->cur_time = ntohl(net->cur_time); net->warp = ntohl(net->warp); + htonf(net->tuned_freq); + net->in_range = htonl(net->in_range); htonf(net->dist_nm); htonf(net->course_deviation_deg); htonf(net->gs_deviation_deg); @@ -254,6 +276,9 @@ void FGNetGUI2Props( FGNetGUI *net ) { globals->set_warp( net->warp ); // Approach + fgSetDouble( "/radios/nav[0]/frequencies/selected-mhz", + net->tuned_freq ); + fgSetBool( "/radios/nav[0]/in-range", net->in_range ); fgSetDouble( "/radios/dme/distance-nm", net->dist_nm ); fgSetDouble( "/radios/nav[0]/heading-needle-deflection", net->course_deviation_deg ); diff --git a/src/Network/net_gui.hxx b/src/Network/net_gui.hxx index 79f9f3b5a..4aa4850ea 100644 --- a/src/Network/net_gui.hxx +++ b/src/Network/net_gui.hxx @@ -31,7 +31,7 @@ #endif -const int FG_NET_GUI_VERSION = 2; +const int FG_NET_GUI_VERSION = 3; // Define a structure containing the top level flight dynamics model @@ -75,6 +75,8 @@ public: long int warp; // offset in seconds to unix time // Approach + float tuned_freq; // currently tuned frequency + bool in_range; // tuned navaid is in range? float dist_nm; // distance to tuned navaid in nautical miles float course_deviation_deg; // degrees off target course float gs_deviation_deg; // degrees off target glide slope -- 2.39.5