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 = \
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 \

View 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();
}

View file

@ -36,18 +36,18 @@
#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; }
};

View 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 \

View 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

View 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

View file

@ -27,7 +27,10 @@
#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 );

View 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