Curt,

You left a "FIXME" comment that the altitude should be for 29.92 inHg
and rounded.  The encoder reports mode-c-alt-ft, so this patch points
the altitude node to this value and removes the redundant + 50 from the
FL rounding routine.

This requires a working encoder.  Any AC using the encoder should have 

<instrumentation>
  ...
  <encoder>
    <serviceable type="bool">true</serviceable>
  </encoder>
  ...
</instrumentation>

in the "name"-set.xml file.

Index: kt_70.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Instrumentation/kt_70.cxx,v
retrieving revision 1.3
diff -p -u -r1.3 kt_70.cxx
--- kt_70.cxx   21 Feb 2006 01:19:03 -0000      1.3
+++ kt_70.cxx   5 Aug 2007 23:55:59 -0000
@@ -90,7 +90,8 @@ void FGKT_70::init ()
     // Inputs
     lon_node = fgGetNode("/position/longitude-deg", true);
     lat_node = fgGetNode("/position/latitude-deg", true);
-    alt_node = fgGetNode("/position/altitude-ft", true);
+    alt_node = fgGetNode("/instrumentation/encoder/mode-c-alt-ft",
true);
     bus_power = fgGetNode("/systems/electrical/outputs/transponder",
true);
     serviceable_node = (node->getChild("inputs", 0, true))
        ->getChild("serviceable", 0, true);
@@ -205,12 +206,9 @@ void FGKT_70::update( double dt ) {
 
         id_code = digit1 * 1000 + digit2 * 100 + digit3 * 10 + digit4;
 
-        // flight level computation
+        // flight level computation uses encoder mode-c altitude
 
-        // FIXME!!!! This needs to be computed relative to 29.92 inHg,
-        // but for the moment, until I figure out how to do that, I'll
-        // just use true altitude.
-        flight_level = (int)( (alt_node->getDoubleValue() + 50.0) /
100.0);
+        flight_level = (int)( (alt_node->getDoubleValue() ) / 100.0);
 
         // ident button
         if ( ident_btn && !last_ident_btn ) {



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to