]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gyro.cxx
Fix initialization order
[flightgear.git] / src / Instrumentation / gyro.cxx
index 3cb5b315213975604ee964d87f2c9cf98a786e7d..6de938e9a63de5ff59266c3a26a57e4085cf2da9 100644 (file)
@@ -13,6 +13,12 @@ Gyro::~Gyro ()
 {
 }
 
+void Gyro::reinit(void)
+{
+    _power_norm = 0.0;
+    _spin_norm = 0.0;
+}
+
 void
 Gyro::update (double delta_time_sec)
 {
@@ -26,6 +32,8 @@ Gyro::update (double delta_time_sec)
         double step = 0.25 * _power_norm * delta_time_sec;
         if ((_spin_norm + step) <= _power_norm)
             _spin_norm += step;
+    } else {
+        _spin_norm = 0;         // stop right away if the gyro breaks
     }
 
                                 // clamp the spin to 0.0:1.0