]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/turn_indicator.cxx
Lots of changes to the ATC/AI system for initial revision of random AI GA VFR traffic
[flightgear.git] / src / Instrumentation / turn_indicator.cxx
index 5e052397452e7b59f98922f185b2f5869b01c0d6..1edb0bb4d3e09a4771c2b4788180f85b22aaf743 100644 (file)
@@ -8,7 +8,13 @@
 #include <Main/util.hxx>
 
 
-TurnIndicator::TurnIndicator ()
+// Use a bigger number to be more responsive, or a smaller number
+// to be more sluggish.
+#define RESPONSIVENESS 0.5
+
+
+TurnIndicator::TurnIndicator () :
+    _last_rate(0)
 {
 }
 
@@ -31,7 +37,7 @@ void
 TurnIndicator::bind ()
 {
     fgTie("/instrumentation/turn-indicator/serviceable",
-          &_gyro, &Gyro::is_serviceable);
+          &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
     fgTie("/instrumentation/turn-indicator/spin",
           &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
 }
@@ -62,8 +68,9 @@ TurnIndicator::update (double dt)
     else if (rate > 2.5)
         rate = 2.5;
 
-                                // Add a lag, based on gyro spin
-    rate = fgGetLowPass(_last_rate, rate, dt/(factor*3));
+                                // Lag left, based on gyro spin
+    rate = -2.5 + (factor * (rate + 2.5));
+    rate = fgGetLowPass(_last_rate, rate, dt*RESPONSIVENESS);
     _last_rate = rate;
     
                                 // Publish the indicated rate