]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/airspeed_indicator.cxx
Merge branch 'curt/replay' into next
[flightgear.git] / src / Instrumentation / airspeed_indicator.cxx
index 329d91a2e9f9384079539ea250655bd53e83d925..341c45edbea6ccbea6d59bc18eb7e92a79345991 100644 (file)
@@ -21,7 +21,11 @@ AirspeedIndicator::AirspeedIndicator ( SGPropertyNode *node )
     _num(node->getIntValue("number", 0)),
     _total_pressure(node->getStringValue("total-pressure", "/systems/pitot/total-pressure-inhg")),
     _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
-    _has_barber_pole(node->getBoolValue("has-barber-pole",false))
+    _has_overspeed(node->getBoolValue("has-overspeed-indicator",false)),
+    _pressure_alt_source(node->getStringValue("pressure-alt-source", "/instrumentation/altimeter/pressure-alt-ft")),
+    _ias_limit(node->getDoubleValue("ias-limit", 248.0)),
+    _mach_limit(node->getDoubleValue("mach-limit", 0.48)),
+    _alt_threshold(node->getDoubleValue("alt-threshold", 13200))
 {
 }
 
@@ -41,17 +45,29 @@ AirspeedIndicator::init ()
     _static_pressure_node = fgGetNode(_static_pressure.c_str(), true);
     _density_node = fgGetNode("/environment/density-slugft3", true);
     _speed_node = node->getChild("indicated-speed-kt", 0, true);
-    
-  // barber-pole properties
-    _ias_limit_node = node->getNode("ias-limit",0, true);
-    _mach_limit_node = node->getNode("mach-limit",0, true);
-    _alt_threshold_node = node->getNode("alt-threshold",0, true);
-    _airspeed_limit = node->getChild("airspeed-limit-kt", 0, true);
-    
-    string paSource = node->getStringValue("pressure-alt-source",
-      "/instrumentation/altimeter/pressure-alt-ft");
-    _pressure_alt = fgGetNode(paSource.c_str(), true);
-    _mach = fgGetNode("/velocities/mach", true);
+
+  // overspeed-indicator properties
+    if (_has_overspeed) {
+        _ias_limit_node = node->getNode("ias-limit",0, true);
+        _mach_limit_node = node->getNode("mach-limit",0, true);
+        _alt_threshold_node = node->getNode("alt-threshold",0, true);
+        
+        if (!_ias_limit_node->hasValue()) {
+          _ias_limit_node->setDoubleValue(_ias_limit);
+        }
+
+        if (!_mach_limit_node->hasValue()) {
+          _mach_limit_node->setDoubleValue(_mach_limit);
+        }
+
+        if (!_alt_threshold_node->hasValue()) {
+          _alt_threshold_node->setDoubleValue(_alt_threshold);
+        }
+
+        _airspeed_limit = node->getChild("airspeed-limit-kt", 0, true);
+        _pressure_alt = fgGetNode(_pressure_alt_source.c_str(), true);
+        _mach = fgGetNode("/velocities/mach", true);
+    }
 }
 
 #ifndef FPSTOKTS
@@ -87,7 +103,7 @@ AirspeedIndicator::update (double dt)
                                              dt * RESPONSIVENESS);
     _speed_node->setDoubleValue(filtered_speed);
 
-    if (!_has_barber_pole) {
+    if (!_has_overspeed) {
         return;
     }