Hello ,
    This patch adds the option of a barber pole in the airspeed indicator,
adapted from K. Hoercher's nasal code for my b1900d...
 It is enabled like this in the instrumentation.xml file :

    <airspeed-indicator>
        <name>airspeed-indicator</name>
        <number>0</number>
        <total-pressure>/systems/pitot/total-pressure-inhg</total-pressure>
        <static-pressure>/systems/static/pressure-inhg</static-pressure>
        <has-barber-pole>1</has-barber-pole> ... defaults to 0 / off
        <ias-limit></ias-limit> airspeed limit (Vmo) defaults to 248.0
        <mach-limit></mach-limit> mach limit (Mmo) defaults to 0.48
        <alt-threshold></alt-threshold> changeover altitude / defaults to
13200 ft
    </airspeed-indicator>

These are the B1900D figures.
If the extra options are left out ... no barber pole calculation is done.

The patch also includes the dme nav2 fix that I posted previously.

Could someone take a look and commit please ?
Thanks ,
Index: airspeed_indicator.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/airspeed_indicator.cxx,v
retrieving revision 1.11
diff -U 3 -r1.11 airspeed_indicator.cxx
--- airspeed_indicator.cxx	6 Dec 2006 22:13:01 -0000	1.11
+++ airspeed_indicator.cxx	9 Mar 2010 06:48:12 -0000
@@ -20,7 +20,11 @@
     _name(node->getStringValue("name", "airspeed-indicator")),
     _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"))
+    _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg")),
+    _has_barber_pole(node->getBoolValue("has-barber-pole",false)),
+    _Vmo(node->getDoubleValue("ias-limit",248.0)),
+    _Mmo(node->getDoubleValue("mach-limit",0.48)),
+    _changeover(node->getDoubleValue("alt-threshold",13200.0))
 {
 }
 
@@ -40,6 +44,11 @@
     _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);
+    if(_has_barber_pole){
+        _airspeed_limit = node->getChild("airspeed-limit-kt", 0, true);
+        _pressure_alt = fgGetNode("/instrumentation/altimeter/pressure-alt-ft", true);
+        _mach = fgGetNode("/velocities/mach", true);
+    }
 }
 
 #ifndef FPSTOKTS
@@ -67,9 +76,18 @@
                                 // 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,
+        double filtered_speed = fgGetLowPass(last_speed_kt,
                                                  current_speed_kt,
-                                                 dt * RESPONSIVENESS));
+                                                 dt * RESPONSIVENESS);
+        _speed_node->setDoubleValue(filtered_speed);
+
+        if(_has_barber_pole){
+                double lmt = _Vmo;
+            if(_pressure_alt->getDoubleValue() > _changeover){
+                lmt = (filtered_speed/_mach->getDoubleValue())*_Mmo;
+            }
+            _airspeed_limit->setDoubleValue(lmt);
+        }
     }
 }
 
Index: airspeed_indicator.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/airspeed_indicator.hxx,v
retrieving revision 1.8
diff -U 3 -r1.8 airspeed_indicator.hxx
--- airspeed_indicator.hxx	6 Dec 2006 22:11:43 -0000	1.8
+++ airspeed_indicator.hxx	9 Mar 2010 06:48:12 -0000
@@ -46,12 +46,18 @@
     unsigned int _num;
     string _total_pressure;
     string _static_pressure;
+    bool _has_barber_pole;
+    double _Vmo;
+    double _Mmo;
+    double _changeover;
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _total_pressure_node;
     SGPropertyNode_ptr _static_pressure_node;
     SGPropertyNode_ptr _density_node;
     SGPropertyNode_ptr _speed_node;
-    
+    SGPropertyNode_ptr _airspeed_limit;
+    SGPropertyNode_ptr _pressure_alt;
+    SGPropertyNode_ptr _mach;
 };
 
 #endif // __INSTRUMENTS_AIRSPEED_INDICATOR_HXX
Index: dme.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/dme.cxx,v
retrieving revision 1.21
diff -U 3 -r1.21 dme.cxx
--- dme.cxx	4 Sep 2009 17:01:53 -0000	1.21
+++ dme.cxx	9 Mar 2010 06:48:12 -0000
@@ -96,7 +96,8 @@
     if (frequency_mhz != _last_frequency_mhz) {
         _time_before_search_sec = 0;
         _last_frequency_mhz = frequency_mhz;
-    }
+        }
+        _frequency_node->setDoubleValue(frequency_mhz);
 
                                 // Get the aircraft position
     double longitude_rad =
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to