]> git.mxchange.org Git - flightgear.git/commitdiff
More updates to refine the output data to make it more useful for an
authorcurt <curt>
Sat, 18 Jan 2003 19:36:50 +0000 (19:36 +0000)
committercurt <curt>
Sat, 18 Jan 2003 19:36:50 +0000 (19:36 +0000)
external GUI and approach path plotter.

src/Network/native_gui.cxx
src/Network/net_gui.hxx

index a6e6f82f53a2db8c0e3759a78d2f75c672149096..46ee30bdc6b89bfbc88f4ad1b814f4978529910d 100644 (file)
@@ -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 );
index 79f9f3b5a5d892083cee58cfa2cf54af7757f616..4aa4850eaba2565f58cde0e8f6527cecae93b173 100644 (file)
@@ -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