]> git.mxchange.org Git - flightgear.git/commitdiff
Add support for a back-course mode. Nothing changes visualy, but this
authorcurt <curt>
Fri, 21 Jul 2006 19:37:04 +0000 (19:37 +0000)
committercurt <curt>
Fri, 21 Jul 2006 19:37:04 +0000 (19:37 +0000)
reverses the autopilot helpers so that the FD/AP can properly fly a BC appr.

src/Instrumentation/navradio.cxx
src/Instrumentation/navradio.hxx

index 32aeaed8c7aeea4052b56efc8d1fb88645a1738a..e8732a063320f3689fb50ef096c547730b9131e6 100644 (file)
@@ -56,6 +56,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
     vol_btn_node(NULL),
     ident_btn_node(NULL),
     audio_btn_node(NULL),
+    backcourse_node(NULL),
     nav_serviceable_node(NULL),
     cdi_serviceable_node(NULL),
     gs_serviceable_node(NULL),
@@ -167,6 +168,8 @@ FGNavRadio::init ()
     ident_btn_node->setBoolValue( true );
     audio_btn_node = node->getChild("audio-btn", 0, true);
     audio_btn_node->setBoolValue( true );
+    backcourse_node = node->getChild("back-course-btn", 0, true);
+    backcourse_node->setBoolValue( false );
     nav_serviceable_node = node->getChild("serviceable", 0, true);
     cdi_serviceable_node = (node->getChild("cdi", 0, true))
        ->getChild("serviceable", 0, true);
@@ -497,8 +500,8 @@ FGNavRadio::update(double dt)
         // of ( -10 , 10 )
         //////////////////////////////////////////////////////////
         double r = 0.0;
-        bool loc_bc = false;   // an in-code flag indicating that we are
-                               // on a localizer backcourse.
+        bool loc_backside = false; // an in-code flag indicating that we are
+                                   // on a localizer backcourse.
         if ( cdi_serviceable ) {
             if ( nav_slaved_to_gps_node->getBoolValue() ) {
                 r = gps_cdi_deflection_node->getDoubleValue();
@@ -516,7 +519,7 @@ FGNavRadio::update(double dt)
                     r = ( r<0.0 ? -r-180.0 : -r+180.0 );
                 } else {
                     if ( is_loc ) {
-                        loc_bc = true;
+                        loc_backside = true;
                     }
                 }
 
@@ -661,21 +664,18 @@ FGNavRadio::update(double dt)
         // compensation.
         double adjustment = cdi_deflection_node->getDoubleValue() * 3.0;
         SG_CLAMP_RANGE( adjustment, -30.0, 30.0 );
-        
+
         // determine the target heading to fly to intercept the
         // tgt_radial = target radial (true) + cdi offset adjustmest -
         // xtrack heading error adjustment
-        double nta_hdg = 0.0;
-        if ( is_loc && loc_bc ) {
-            // tuned to a localizer and positioned in backcourse range
-            // trtrue += 180.0;   // reverse the target localizer heading
-            // while ( trtrue > 360.0 ) { trtrue -= 360.0; }
-            nta_hdg = trtrue + adjustment - hdg_error; 
-            cout << "trtrue = " << trtrue << " adj = " << adjustment
-                 << " hdg_error = " << hdg_error << endl;
-       } else {
-            // all other situations (nav or loc front course)
-            nta_hdg = trtrue + adjustment - hdg_error; 
+        double nta_hdg;
+        if ( is_loc && backcourse_node->getBoolValue() ) {
+            // tuned to a localizer and backcourse mode activated
+            trtrue += 180.0;   // reverse the target localizer heading
+            while ( trtrue > 360.0 ) { trtrue -= 360.0; }
+            nta_hdg = trtrue - adjustment - hdg_error;
+        } else {
+            nta_hdg = trtrue + adjustment - hdg_error;
         }
 
         while ( nta_hdg <   0.0 ) { nta_hdg += 360.0; }
index c6006a58da1c3e4729e55f810f6b1cbc874a0567..4dde4ae2075ccd12826d3b586167f3b56c7e0d80 100644 (file)
@@ -50,7 +50,7 @@ class FGNavRadio : public SGSubsystem
 
     // property inputs
     SGPropertyNode_ptr is_valid_node;   // is station data valid (may be way out
-                                     // of range.)
+                                        // of range.)
     SGPropertyNode_ptr power_btn_node;
     SGPropertyNode_ptr freq_node;       // primary freq
     SGPropertyNode_ptr alt_freq_node;   // standby freq
@@ -58,6 +58,7 @@ class FGNavRadio : public SGSubsystem
     SGPropertyNode_ptr vol_btn_node;
     SGPropertyNode_ptr ident_btn_node;
     SGPropertyNode_ptr audio_btn_node;
+    SGPropertyNode_ptr backcourse_node;
     SGPropertyNode_ptr nav_serviceable_node;
     SGPropertyNode_ptr cdi_serviceable_node;
     SGPropertyNode_ptr gs_serviceable_node;