1
0
Fork 0

Changes by Roy Ovesen to begin migrating the avionics out of the Cockpit

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.
This commit is contained in:
curt 2004-11-19 23:01:34 +00:00
parent d05121ef46
commit e9b70e3ab8
8 changed files with 91 additions and 53 deletions

View file

@ -2,15 +2,12 @@ noinst_LIBRARIES = libCockpit.a
libCockpit_a_SOURCES = \ libCockpit_a_SOURCES = \
cockpit.cxx cockpit.hxx \ cockpit.cxx cockpit.hxx \
dme.cxx dme.hxx \
hud.cxx hud.hxx hud_opts.hxx \ hud.cxx hud.hxx hud_opts.hxx \
hud_card.cxx hud_dnst.cxx hud_gaug.cxx hud_inst.cxx \ hud_card.cxx hud_dnst.cxx hud_gaug.cxx hud_inst.cxx \
hud_labl.cxx hud_ladr.cxx \ hud_labl.cxx hud_ladr.cxx \
hud_lat.cxx hud_lon.cxx \ hud_lat.cxx hud_lon.cxx \
hud_rwy.cxx \ hud_rwy.cxx \
hud_scal.cxx hud_tbi.cxx \ hud_scal.cxx hud_tbi.cxx \
kt_70.cxx kt_70.hxx \
marker_beacon.cxx marker_beacon.hxx \
navcom.cxx navcom.hxx \ navcom.cxx navcom.hxx \
panel.cxx panel.hxx \ panel.cxx panel.hxx \
panel_io.cxx panel_io.hxx \ panel_io.cxx panel_io.hxx \

View file

@ -51,10 +51,10 @@ FGRadioStack::FGRadioStack() {
FGRadioStack::~FGRadioStack() FGRadioStack::~FGRadioStack()
{ {
//adf.unbind(); //adf.unbind();
beacon.unbind(); //beacon.unbind();
navcom1.unbind(); navcom1.unbind();
navcom2.unbind(); navcom2.unbind();
xponder.unbind(); //xponder.unbind();
} }
@ -68,8 +68,8 @@ FGRadioStack::init ()
navcom2.init(); navcom2.init();
//adf.init(); //adf.init();
beacon.init(); //beacon.init();
xponder.init(); //xponder.init();
search(); search();
update(0); // FIXME: use dt update(0); // FIXME: use dt
@ -84,13 +84,13 @@ void
FGRadioStack::bind () FGRadioStack::bind ()
{ {
//adf.bind(); //adf.bind();
beacon.bind(); //beacon.bind();
dme.bind(); //dme.bind();
navcom1.set_bind_index( 0 ); navcom1.set_bind_index( 0 );
navcom1.bind(); navcom1.bind();
navcom2.set_bind_index( 1 ); navcom2.set_bind_index( 1 );
navcom2.bind(); navcom2.bind();
xponder.bind(); //xponder.bind();
} }
@ -98,11 +98,11 @@ void
FGRadioStack::unbind () FGRadioStack::unbind ()
{ {
//adf.unbind(); //adf.unbind();
beacon.unbind(); //beacon.unbind();
dme.unbind(); //dme.unbind();
navcom1.unbind(); navcom1.unbind();
navcom2.unbind(); navcom2.unbind();
xponder.unbind(); //xponder.unbind();
} }
@ -111,11 +111,11 @@ void
FGRadioStack::update(double dt) FGRadioStack::update(double dt)
{ {
//adf.update( dt ); //adf.update( dt );
beacon.update( dt ); //beacon.update( dt );
navcom1.update( dt ); navcom1.update( dt );
navcom2.update( dt ); navcom2.update( dt );
dme.update( dt ); // dme is updated after the navcom's //dme.update( dt ); // dme is updated after the navcom's
xponder.update( dt ); //xponder.update( dt );
} }
@ -123,9 +123,9 @@ FGRadioStack::update(double dt)
void FGRadioStack::search() void FGRadioStack::search()
{ {
//adf.search(); //adf.search();
beacon.search(); //beacon.search();
navcom1.search(); navcom1.search();
navcom2.search(); navcom2.search();
dme.search(); //dme.search();
xponder.search(); //xponder.search();
} }

View file

@ -36,18 +36,18 @@
#include <Sound/beacon.hxx> #include <Sound/beacon.hxx>
#include <Sound/morse.hxx> #include <Sound/morse.hxx>
#include "dme.hxx" //#include "dme.hxx"
#include "kt_70.hxx" // Transponder //#include "kt_70.hxx" // Transponder
#include "marker_beacon.hxx" //#include "marker_beacon.hxx"
#include "navcom.hxx" #include "navcom.hxx"
class FGRadioStack : public SGSubsystem class FGRadioStack : public SGSubsystem
{ {
FGDME dme; //FGDME dme;
//FGKR_87 adf; // King KR 87 Digital ADF model //FGKR_87 adf; // King KR 87 Digital ADF model
FGKT_70 xponder; // Bendix/King KT 70 Panel-Mounted Transponder //FGKT_70 xponder; // Bendix/King KT 70 Panel-Mounted Transponder
FGMarkerBeacon beacon; //FGMarkerBeacon beacon;
FGNavCom navcom1; FGNavCom navcom1;
FGNavCom navcom2; FGNavCom navcom2;
@ -64,7 +64,7 @@ public:
// Update nav/adf radios based on current postition // Update nav/adf radios based on current postition
void search (); void search ();
inline FGDME *get_dme() { return &dme; } //inline FGDME *get_dme() { return &dme; }
inline FGNavCom *get_navcom1() { return &navcom1; } inline FGNavCom *get_navcom1() { return &navcom1; }
inline FGNavCom *get_navcom2() { return &navcom2; } inline FGNavCom *get_navcom2() { return &navcom2; }
}; };

View file

@ -14,7 +14,10 @@ libInstrumentation_a_SOURCES = \
gyro.cxx gyro.hxx \ gyro.cxx gyro.hxx \
heading_indicator.cxx heading_indicator.hxx \ heading_indicator.cxx heading_indicator.hxx \
kr_87.hxx kr_87.cxx \ kr_87.hxx kr_87.cxx \
kt_70.cxx kt_70.hxx \
mag_compass.cxx mag_compass.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 \ slip_skid_ball.cxx slip_skid_ball.hxx \
transponder.cxx transponder.hxx \ transponder.cxx transponder.hxx \
turn_indicator.cxx turn_indicator.hxx \ turn_indicator.cxx turn_indicator.hxx \

View file

@ -6,6 +6,12 @@
// TODO: // TODO:
// - better spin-up // - better spin-up
#include <simgear/compiler.h>
#include STL_IOSTREAM
#include STL_STRING
#include <sstream>
#include <math.h> // fabs() #include <math.h> // fabs()
#include "attitude_indicator.hxx" #include "attitude_indicator.hxx"
@ -72,25 +78,27 @@ AttitudeIndicator::init ()
void void
AttitudeIndicator::bind () AttitudeIndicator::bind ()
{ {
std::ostringstream temp;
string branch; 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); &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
branch = "/instrumentation/" + name + "/spin"; fgTie((branch + "/spin").c_str(),
fgTie(branch.c_str(),
&_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm); &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
} }
void void
AttitudeIndicator::unbind () AttitudeIndicator::unbind ()
{ {
std::ostringstream temp;
string branch; string branch;
branch = "/instrumentation/" + name + "/serviceable"; temp << num;
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
fgUntie(branch.c_str()); fgUntie((branch + "/serviceable").c_str());
branch = "/instrumentation/" + name + "/spin"; fgUntie((branch + "/spin").c_str());
fgUntie(branch.c_str());
} }
void void

View file

@ -3,6 +3,11 @@
// //
// This file is in the Public Domain and comes with no warranty. // 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 "heading_indicator.hxx"
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include <Main/util.hxx> #include <Main/util.hxx>
@ -61,23 +66,27 @@ HeadingIndicator::init ()
void void
HeadingIndicator::bind () HeadingIndicator::bind ()
{ {
std::ostringstream temp;
string branch; string branch;
branch = "/instrumentation/" + name + "/serviceable"; temp << num;
fgTie(branch.c_str(), branch = "/instrumentation/" + name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable); &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
branch = "/instrumentation/" + name + "/spin"; fgTie((branch + "/spin").c_str(),
fgTie(branch.c_str(),
&_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm); &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
} }
void void
HeadingIndicator::unbind () HeadingIndicator::unbind ()
{ {
std::ostringstream temp;
string branch; string branch;
branch = "/instrumentation/" + name + "/serviceable"; temp << num;
fgUntie(branch.c_str()); branch = "/instrumentation/" + name + "[" + temp.str() + "]";
branch = "/instrumentation/" + name + "/spin";
fgUntie(branch.c_str()); fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/spin").c_str());
} }
void void

View file

@ -27,7 +27,10 @@
#include "gps.hxx" #include "gps.hxx"
#include "heading_indicator.hxx" #include "heading_indicator.hxx"
#include "kr_87.hxx" #include "kr_87.hxx"
#include "kt_70.hxx"
#include "mag_compass.hxx" #include "mag_compass.hxx"
#include "marker_beacon.hxx"
#include "navradio.hxx"
#include "slip_skid_ball.hxx" #include "slip_skid_ball.hxx"
#include "transponder.hxx" #include "transponder.hxx"
#include "turn_indicator.hxx" #include "turn_indicator.hxx"
@ -111,15 +114,27 @@ bool FGInstrumentMgr::build ()
} else if ( name == "encoder" ) { } else if ( name == "encoder" ) {
set_subsystem( "instrument" + temp.str(), set_subsystem( "instrument" + temp.str(),
new Encoder( node ) ); new Encoder( node ) );
} else if ( name == "gps" ) {
set_subsystem( "instrument" + temp.str(),
new GPS( node ), 0.45 );
} else if ( name == "heading-indicator" ) { } else if ( name == "heading-indicator" ) {
set_subsystem( "instrument" + temp.str(), set_subsystem( "instrument" + temp.str(),
new HeadingIndicator( node ) ); new HeadingIndicator( node ) );
} else if ( name == "KR-87" ) { } else if ( name == "KR-87" ) {
set_subsystem( "instrument" + temp.str(), set_subsystem( "instrument" + temp.str(),
new FGKR_87( node ) ); new FGKR_87( node ) );
} else if ( name == "KT-70" ) {
set_subsystem( "instrument" + temp.str(),
new FGKT_70( node ) );
} else if ( name == "magnetic-compass" ) { } else if ( name == "magnetic-compass" ) {
set_subsystem( "instrument" + temp.str(), set_subsystem( "instrument" + temp.str(),
new MagCompass( node ) ); 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" ) { } else if ( name == "slip-skid-ball" ) {
set_subsystem( "instrument" + temp.str(), set_subsystem( "instrument" + temp.str(),
new SlipSkidBall( node ) ); new SlipSkidBall( node ) );
@ -132,9 +147,6 @@ bool FGInstrumentMgr::build ()
} else if ( name == "vertical-speed-indicator" ) { } else if ( name == "vertical-speed-indicator" ) {
set_subsystem( "instrument" + temp.str(), set_subsystem( "instrument" + temp.str(),
new VerticalSpeedIndicator( node ) ); new VerticalSpeedIndicator( node ) );
} else if ( name == "gps" ) {
set_subsystem( "instrument" + temp.str(),
new GPS( node ), 0.45 );
} else { } else {
SG_LOG( SG_ALL, SG_ALERT, "Unknown top level section: " SG_LOG( SG_ALL, SG_ALERT, "Unknown top level section: "
<< name ); << name );

View file

@ -3,6 +3,11 @@
// //
// This file is in the Public Domain and comes with no warranty. // 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 "turn_indicator.hxx"
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include <Main/util.hxx> #include <Main/util.hxx>
@ -62,23 +67,27 @@ TurnIndicator::init ()
void void
TurnIndicator::bind () TurnIndicator::bind ()
{ {
std::ostringstream temp;
string branch; string branch;
branch = "/instrumentation/" + name + "/serviceable"; temp << num;
fgTie(branch.c_str(), branch = "/instrumentation/" + name + "[" + temp.str() + "]";
fgTie((branch + "/serviceable").c_str(),
&_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable); &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
branch = "/instrumentation/" + name + "/spin"; fgTie((branch + "/spin").c_str(),
fgTie(branch.c_str(),
&_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm); &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
} }
void void
TurnIndicator::unbind () TurnIndicator::unbind ()
{ {
std::ostringstream temp;
string branch; string branch;
branch = "/instrumentation/" + name + "/serviceable"; temp << num;
fgUntie(branch.c_str()); branch = "/instrumentation/" + name + "[" + temp.str() + "]";
branch = "/instrumentation/" + name + "/spin";
fgUntie(branch.c_str()); fgUntie((branch + "/serviceable").c_str());
fgUntie((branch + "/serviceable").c_str());
} }
void void