]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/adf.cxx
Fix my mailing address by replacing it with my web page.
[flightgear.git] / src / Instrumentation / adf.cxx
index 4cc7d269a002f75e09d01726d26431a034dc1269..e5303db019f7673c6668d67c4b757d7de834bd22 100644 (file)
@@ -6,7 +6,6 @@
 #include <simgear/compiler.h>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/math/sg_random.h>
-#include <simgear/sg_inlines.h>
 
 #include <Main/fg_props.hxx>
 #include <Main/util.hxx>
@@ -132,8 +131,6 @@ ADF::init ()
     std::ostringstream temp;
     temp << name << num;
     adf_ident = temp.str();
-
-    _serviceable_node->setBoolValue(true);
 }
 
 void
@@ -198,7 +195,8 @@ ADF::update (double delta_time_sec)
         _in_range_node->setBoolValue(true);
 
         bearing -= heading;
-        SG_NORMALIZE_RANGE(bearing, 0.0, 360.0);
+        if (bearing < 0)
+            bearing += 360;
         set_bearing(delta_time_sec, bearing);
 
         // adf ident sound
@@ -291,7 +289,10 @@ ADF::set_bearing (double dt, double bearing_deg)
 {
     double old_bearing_deg = _bearing_node->getDoubleValue();
 
-    SG_NORMALIZE_RANGE(old_bearing_deg, 0.0, 360.0);
+    while ((bearing_deg - old_bearing_deg) >= 180)
+        old_bearing_deg += 360;
+    while ((bearing_deg - old_bearing_deg) <= -180)
+        old_bearing_deg -= 360;
     bearing_deg += _error_node->getDoubleValue();
     bearing_deg =
         fgGetLowPass(old_bearing_deg, bearing_deg, dt * RESPONSIVENESS);