]> git.mxchange.org Git - flightgear.git/commitdiff
Changes by Roy Ovesen to begin migrating the avionics out of the Cockpit
authorcurt <curt>
Fri, 19 Nov 2004 23:01:34 +0000 (23:01 +0000)
committercurt <curt>
Fri, 19 Nov 2004 23:01:34 +0000 (23:01 +0000)
directory and over to the Instrumentation directory and make them modular
in the sense of being able to pick and choose what you include with any
particular aircraft.

src/Cockpit/Makefile.am
src/Cockpit/radiostack.cxx
src/Cockpit/radiostack.hxx
src/Instrumentation/Makefile.am
src/Instrumentation/attitude_indicator.cxx
src/Instrumentation/heading_indicator.cxx
src/Instrumentation/instrument_mgr.cxx
src/Instrumentation/turn_indicator.cxx

index 307f8f2f845d2b9eec719abd92d10fdcee60f0f0..74d3bce804ab1cd3739831babce404dcfe8e9846 100644 (file)
@@ -2,15 +2,12 @@ noinst_LIBRARIES = libCockpit.a
 
 libCockpit_a_SOURCES = \
        cockpit.cxx cockpit.hxx \
-       dme.cxx dme.hxx \
        hud.cxx hud.hxx hud_opts.hxx \
        hud_card.cxx hud_dnst.cxx hud_gaug.cxx hud_inst.cxx \
        hud_labl.cxx hud_ladr.cxx \
        hud_lat.cxx hud_lon.cxx \
        hud_rwy.cxx \
        hud_scal.cxx hud_tbi.cxx \
-       kt_70.cxx kt_70.hxx \
-       marker_beacon.cxx marker_beacon.hxx \
        navcom.cxx navcom.hxx \
        panel.cxx panel.hxx \
         panel_io.cxx panel_io.hxx \
index 4b07bfd2b4b3ca8881661cc26cabe83b69af3657..09986f09621f052ec3d6e1d44db55863031ee3f8 100644 (file)
@@ -51,10 +51,10 @@ FGRadioStack::FGRadioStack() {
 FGRadioStack::~FGRadioStack() 
 {
     //adf.unbind();
-    beacon.unbind();
+    //beacon.unbind();
     navcom1.unbind();
     navcom2.unbind();
-    xponder.unbind();
+    //xponder.unbind();
 }
 
 
@@ -68,8 +68,8 @@ FGRadioStack::init ()
     navcom2.init();
 
     //adf.init();
-    beacon.init();
-    xponder.init();
+    //beacon.init();
+    //xponder.init();
 
     search();
     update(0);                 // FIXME: use dt
@@ -84,13 +84,13 @@ void
 FGRadioStack::bind ()
 {
     //adf.bind();
-    beacon.bind();
-    dme.bind();
+    //beacon.bind();
+    //dme.bind();
     navcom1.set_bind_index( 0 );
     navcom1.bind();
     navcom2.set_bind_index( 1 );
     navcom2.bind();
-    xponder.bind();
+    //xponder.bind();
 }
 
 
@@ -98,11 +98,11 @@ void
 FGRadioStack::unbind ()
 {
     //adf.unbind();
-    beacon.unbind();
-    dme.unbind();
+    //beacon.unbind();
+    //dme.unbind();
     navcom1.unbind();
     navcom2.unbind();
-    xponder.unbind();
+    //xponder.unbind();
 }
 
 
@@ -111,11 +111,11 @@ void
 FGRadioStack::update(double dt) 
 {
     //adf.update( dt );
-    beacon.update( dt );
+    //beacon.update( dt );
     navcom1.update( dt );
     navcom2.update( dt );
-    dme.update( dt );           // dme is updated after the navcom's
-    xponder.update( dt );
+    //dme.update( dt );           // dme is updated after the navcom's
+    //xponder.update( dt );
 }
 
 
@@ -123,9 +123,9 @@ FGRadioStack::update(double dt)
 void FGRadioStack::search() 
 {
     //adf.search();
-    beacon.search();
+    //beacon.search();
     navcom1.search();
     navcom2.search();
-    dme.search();
-    xponder.search();
+    //dme.search();
+    //xponder.search();
 }
index 7da4f4447a2ecb8035485ab130c9ea422bf17837..fb6e87586d6955a3fe370da9ac169160de756fb6 100644 (file)
 #include <Sound/beacon.hxx>
 #include <Sound/morse.hxx>
 
-#include "dme.hxx"
-#include "kt_70.hxx"            // Transponder
-#include "marker_beacon.hxx"
+//#include "dme.hxx"
+//#include "kt_70.hxx"            // Transponder
+//#include "marker_beacon.hxx"
 #include "navcom.hxx"
 
 
 class FGRadioStack : public SGSubsystem
 {
-    FGDME dme;
+    //FGDME dme;
     //FGKR_87 adf;                // King KR 87 Digital ADF model
-    FGKT_70 xponder;            // Bendix/King KT 70 Panel-Mounted Transponder
-    FGMarkerBeacon beacon;
+    //FGKT_70 xponder;            // Bendix/King KT 70 Panel-Mounted Transponder
+    //FGMarkerBeacon beacon;
     FGNavCom navcom1;
     FGNavCom navcom2;
 
@@ -64,7 +64,7 @@ public:
     // Update nav/adf radios based on current postition
     void search ();
 
-    inline FGDME *get_dme() { return &dme; }
+    //inline FGDME *get_dme() { return &dme; }
     inline FGNavCom *get_navcom1() { return &navcom1; }
     inline FGNavCom *get_navcom2() { return &navcom2; }
 };
index 579e0a27fe7cdf89905b24e0d7395a7154c4c1f1..949da0e207641655c7875c302acbfb1653ce28ab 100644 (file)
@@ -14,7 +14,10 @@ libInstrumentation_a_SOURCES = \
         gyro.cxx gyro.hxx \
         heading_indicator.cxx heading_indicator.hxx \
        kr_87.hxx kr_87.cxx \
+       kt_70.cxx kt_70.hxx \
         mag_compass.cxx mag_compass.hxx \
+        marker_beacon.cxx marker_beacon.hxx \
+        navradio.cxx navradio.hxx \
         slip_skid_ball.cxx slip_skid_ball.hxx \
        transponder.cxx transponder.hxx \
         turn_indicator.cxx turn_indicator.hxx \
index d57947663a318f2e52a1e6e70a9166133c078808..1555c2c74eeddc49dda9b2656043e8c89544b711 100644 (file)
@@ -6,6 +6,12 @@
 // TODO:
 // - better spin-up
 
+#include <simgear/compiler.h>
+
+#include STL_IOSTREAM
+#include STL_STRING
+#include <sstream>
+
 #include <math.h>      // fabs()
 
 #include "attitude_indicator.hxx"
@@ -72,25 +78,27 @@ AttitudeIndicator::init ()
 void
 AttitudeIndicator::bind ()
 {
+    std::ostringstream temp;
     string branch;
-    branch = "/instrumentation/" + name + "/serviceable";
+    temp << num;
+    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
 
-    fgTie(branch.c_str(),
+    fgTie((branch + "/serviceable").c_str(),
           &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
-    branch = "/instrumentation/" + name + "/spin";
-    fgTie(branch.c_str(),
+    fgTie((branch + "/spin").c_str(),
           &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
 }
 
 void
 AttitudeIndicator::unbind ()
 {
+    std::ostringstream temp;
     string branch;
-    branch = "/instrumentation/" + name + "/serviceable";
+    temp << num;
+    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
 
-    fgUntie(branch.c_str());
-    branch = "/instrumentation/" + name + "/spin";
-    fgUntie(branch.c_str());
+    fgUntie((branch + "/serviceable").c_str());
+    fgUntie((branch + "/spin").c_str());
 }
 
 void
index 9c2877cf2d84d35bb0f4ad4a1692e1633757aabd..4ab01a60f43115ca8cc5326266d86e567d0ce1bb 100644 (file)
@@ -3,6 +3,11 @@
 //
 // This file is in the Public Domain and comes with no warranty.
 
+#include <simgear/compiler.h>
+#include STL_IOSTREAM
+#include STL_STRING
+#include <sstream>
+
 #include "heading_indicator.hxx"
 #include <Main/fg_props.hxx>
 #include <Main/util.hxx>
@@ -61,23 +66,27 @@ HeadingIndicator::init ()
 void
 HeadingIndicator::bind ()
 {
+    std::ostringstream temp;
     string branch;
-    branch = "/instrumentation/" + name + "/serviceable";
-    fgTie(branch.c_str(),
+    temp << num;
+    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+
+    fgTie((branch + "/serviceable").c_str(),
           &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
-    branch = "/instrumentation/" + name + "/spin";
-    fgTie(branch.c_str(),
+    fgTie((branch + "/spin").c_str(),
           &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
 }
 
 void
 HeadingIndicator::unbind ()
 {
+    std::ostringstream temp;
     string branch;
-    branch = "/instrumentation/" + name + "/serviceable";
-    fgUntie(branch.c_str());
-    branch = "/instrumentation/" + name + "/spin";
-    fgUntie(branch.c_str());
+    temp << num;
+    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+
+    fgUntie((branch + "/serviceable").c_str());
+    fgUntie((branch + "/spin").c_str());
 }
 
 void
index 5a47f63a33e0178826daec8da638e8a5ba58cf19..85e8b87795955eb8e8a1e856a0ce03fe14fda215 100644 (file)
 #include "gps.hxx"
 #include "heading_indicator.hxx"
 #include "kr_87.hxx"
+#include "kt_70.hxx"
 #include "mag_compass.hxx"
+#include "marker_beacon.hxx"
+#include "navradio.hxx"
 #include "slip_skid_ball.hxx"
 #include "transponder.hxx"
 #include "turn_indicator.hxx"
@@ -111,15 +114,27 @@ bool FGInstrumentMgr::build ()
         } else if ( name == "encoder" ) {
             set_subsystem( "instrument" + temp.str(), 
                            new Encoder( node ) );
+        } else if ( name == "gps" ) {
+            set_subsystem( "instrument" + temp.str(), 
+                           new GPS( node ), 0.45 );
         } else if ( name == "heading-indicator" ) {
             set_subsystem( "instrument" + temp.str(), 
                            new HeadingIndicator( node ) );
         } else if ( name == "KR-87" ) {
             set_subsystem( "instrument" + temp.str(), 
                            new FGKR_87( node ) );
+        } else if ( name == "KT-70" ) {
+            set_subsystem( "instrument" + temp.str(), 
+                           new FGKT_70( node ) );
         } else if ( name == "magnetic-compass" ) {
             set_subsystem( "instrument" + temp.str(), 
                            new MagCompass( node ) );
+        } else if ( name == "marker-beacon" ) {
+            set_subsystem( "instrument" + temp.str(), 
+                           new FGMarkerBeacon( node ) );
+        } else if ( name == "nav-radio" ) {
+            set_subsystem( "instrument" + temp.str(), 
+                           new FGNavRadio( node ) );
         } else if ( name == "slip-skid-ball" ) {
             set_subsystem( "instrument" + temp.str(), 
                            new SlipSkidBall( node ) );
@@ -132,9 +147,6 @@ bool FGInstrumentMgr::build ()
         } else if ( name == "vertical-speed-indicator" ) {
             set_subsystem( "instrument" + temp.str(), 
                            new VerticalSpeedIndicator( node ) );
-        } else if ( name == "gps" ) {
-            set_subsystem( "instrument" + temp.str(), 
-                           new GPS( node ), 0.45 );
         } else {
             SG_LOG( SG_ALL, SG_ALERT, "Unknown top level section: " 
                     << name );
index 2a45657901073f6638f05f8a4cc301e7a88ba8a5..be03a8879beadb07fe2cc294ec788c604831da82 100644 (file)
@@ -3,6 +3,11 @@
 //
 // This file is in the Public Domain and comes with no warranty.
 
+#include <simgear/compiler.h>
+#include STL_IOSTREAM
+#include STL_STRING
+#include <sstream>
+
 #include "turn_indicator.hxx"
 #include <Main/fg_props.hxx>
 #include <Main/util.hxx>
@@ -62,23 +67,27 @@ TurnIndicator::init ()
 void
 TurnIndicator::bind ()
 {
+    std::ostringstream temp;
     string branch;
-    branch = "/instrumentation/" + name + "/serviceable";
-    fgTie(branch.c_str(),
+    temp << num;
+    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+
+    fgTie((branch + "/serviceable").c_str(),
           &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
-    branch = "/instrumentation/" + name + "/spin";
-    fgTie(branch.c_str(),
+    fgTie((branch + "/spin").c_str(),
           &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
 }
 
 void
 TurnIndicator::unbind ()
 {
+    std::ostringstream temp;
     string branch;
-    branch = "/instrumentation/" + name + "/serviceable";
-    fgUntie(branch.c_str());
-    branch = "/instrumentation/" + name + "/spin";
-    fgUntie(branch.c_str());
+    temp << num;
+    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+
+    fgUntie((branch + "/serviceable").c_str());
+    fgUntie((branch + "/serviceable").c_str());
 }
 
 void