]> git.mxchange.org Git - flightgear.git/commitdiff
Minor code cleanups.
authordavid <david>
Wed, 12 Feb 2003 18:35:04 +0000 (18:35 +0000)
committerdavid <david>
Wed, 12 Feb 2003 18:35:04 +0000 (18:35 +0000)
src/Instrumentation/airspeed_indicator.cxx
src/Instrumentation/altimeter.cxx
src/Instrumentation/turn_indicator.cxx

index bc83602de188f767bb8630782d6c1836285bf19f..46eb585c8aab0075e42bc38569cd18ed53c4abee 100644 (file)
@@ -1,4 +1,4 @@
-// airspeed_indicator.cxx - a regular VSI.
+// airspeed_indicator.cxx - a regular pitot-static airspeed indicator.
 // Written by David Megginson, started 2002.
 //
 // This file is in the Public Domain and comes with no warranty.
 #include <Main/util.hxx>
 
 
+// A higher number means more responsive.
+#define RESPONSIVENESS 50.0
+
+
 AirspeedIndicator::AirspeedIndicator ()
 {
 }
@@ -58,7 +62,12 @@ AirspeedIndicator::update (double dt)
                                 // Now, reverse the equation
         double v_fps = sqrt((2 * q) / SEA_LEVEL_DENSITY_SLUGFT3);
 
-        _speed_node->setDoubleValue(v_fps * FPSTOKTS);
+                                // Publish the indicated airspeed
+        double last_speed_kt = _speed_node->getDoubleValue();
+        double current_speed_kt = v_fps * FPSTOKTS;
+        _speed_node->setDoubleValue(fgGetLowPass(last_speed_kt,
+                                                 current_speed_kt,
+                                                 dt * RESPONSIVENESS));
     }
 }
 
index 993672e6fbeffe1ce101da32eea180ffb05d18cb..2a9578705ce73b54cc8a7aad7668278972e320fc 100644 (file)
 #include <Main/util.hxx>
 
 
+// A higher number means more responsive
+#define RESPONSIVENESS 10.0
+
+
 // Altitude based on pressure difference from sea level.
 // pressure difference inHG, altitude ft
 static double altitude_data[][2] = {
@@ -73,11 +77,14 @@ Altimeter::update (double dt)
     if (_serviceable_node->getBoolValue()) {
         double pressure = _pressure_node->getDoubleValue();
         double setting = _setting_node->getDoubleValue();
-        double altitude =
-            fgGetLowPass(_altitude_node->getDoubleValue(),
-                         _altitude_table->interpolate(setting - pressure),
-                         dt * 10);
-        _altitude_node->setDoubleValue(altitude);
+
+                                // Move towards the current setting
+        double last_altitude = _altitude_node->getDoubleValue();
+        double current_altitude =
+            _altitude_table->interpolate(setting - pressure);
+        _altitude_node->setDoubleValue(fgGetLowPass(last_altitude,
+                                                    current_altitude,
+                                                    dt * RESPONSIVENESS));
     }
 }
 
index 6d4faedaa8d49d568e2f674e26bf5784c5e9306b..1edb0bb4d3e09a4771c2b4788180f85b22aaf743 100644 (file)
@@ -9,8 +9,8 @@
 
 
 // Use a bigger number to be more responsive, or a smaller number
-// to be more sluggish (the base time is 1.0).
-#define RESPONSIVENESS 0.25
+// to be more sluggish.
+#define RESPONSIVENESS 0.5
 
 
 TurnIndicator::TurnIndicator () :