1
0
Fork 0

Fixed up a couple loose ends.

This commit is contained in:
curt 2002-07-04 21:37:06 +00:00
parent 1669820bba
commit ac61b8323e
2 changed files with 21 additions and 25 deletions

View file

@ -92,6 +92,7 @@ FGKR_87::FGKR_87() :
last_flt_et_btn(false), last_flt_et_btn(false),
set_rst_btn(false), set_rst_btn(false),
last_set_rst_btn(false), last_set_rst_btn(false),
ident_btn(false),
freq(0.0), freq(0.0),
stby_freq(0.0), stby_freq(0.0),
needle_deg(0.0), needle_deg(0.0),
@ -114,31 +115,25 @@ FGKR_87::FGKR_87() :
// Destructor // Destructor
FGKR_87::~FGKR_87() FGKR_87::~FGKR_87() {
{
delete term_tbl; delete term_tbl;
delete low_tbl; delete low_tbl;
delete high_tbl; delete high_tbl;
} }
void void FGKR_87::init () {
FGKR_87::init ()
{
morse.init(); morse.init();
update(0); // FIXME: use dt update(0); // FIXME: use dt
} }
void
FGKR_87::bind () void FGKR_87::bind () {
{
// internal values // internal values
fgTie("/radios/kr-87/internal/ident", this, fgTie("/radios/kr-87/internal/valid", this, &FGKR_87::get_valid);
&FGKR_87::get_ident_btn,
&FGKR_87::set_ident_btn);
fgSetArchivable("/radios/kr-87/internal/ident");
fgTie("/radios/kr-87/internal/inrange", this, &FGKR_87::get_inrange); fgTie("/radios/kr-87/internal/inrange", this, &FGKR_87::get_inrange);
fgTie("/radios/kr-87/internal/dist", this, &FGKR_87::get_dist);
fgTie("/radios/kr-87/internal/heading", this, &FGKR_87::get_heading); fgTie("/radios/kr-87/internal/heading", this, &FGKR_87::get_heading);
// modes // modes
@ -174,6 +169,8 @@ FGKR_87::bind ()
fgTie("/radios/kr-87/inputs/set-rst-btn", this, fgTie("/radios/kr-87/inputs/set-rst-btn", this,
&FGKR_87::get_set_rst_btn, &FGKR_87::get_set_rst_btn,
&FGKR_87::set_set_rst_btn); &FGKR_87::set_set_rst_btn);
fgTie("/radios/kr-87/inputs/ident-btn", this,
&FGKR_87::get_ident_btn, &FGKR_87::set_ident_btn);
// outputs // outputs
fgTie("/radios/kr-87/outputs/selected-khz", this, fgTie("/radios/kr-87/outputs/selected-khz", this,
@ -198,12 +195,12 @@ FGKR_87::bind ()
fgTie("/radios/kr-87/annunciators/et", this, &FGKR_87::get_et_ann ); fgTie("/radios/kr-87/annunciators/et", this, &FGKR_87::get_et_ann );
} }
void
FGKR_87::unbind () void FGKR_87::unbind () {
{
// internal values // internal values
fgUntie("/radios/kr-87/internal/ident"); fgUntie("/radios/kr-87/internal/valid");
fgUntie("/radios/kr-87/internal/inrange"); fgUntie("/radios/kr-87/internal/inrange");
fgUntie("/radios/kr-87/internal/dist");
fgUntie("/radios/kr-87/internal/heading"); fgUntie("/radios/kr-87/internal/heading");
// modes // modes
@ -220,6 +217,7 @@ FGKR_87::unbind ()
fgUntie("/radios/kr-87/inputs/frq-btn"); fgUntie("/radios/kr-87/inputs/frq-btn");
fgUntie("/radios/kr-87/inputs/flt-et-btn"); fgUntie("/radios/kr-87/inputs/flt-et-btn");
fgUntie("/radios/kr-87/inputs/set-rst-btn"); fgUntie("/radios/kr-87/inputs/set-rst-btn");
fgUntie("/radios/kr-87/inputs/ident-btn");
// outputs // outputs
fgUntie("/radios/kr-87/outputs/selected-khz"); fgUntie("/radios/kr-87/outputs/selected-khz");
@ -239,9 +237,7 @@ FGKR_87::unbind ()
// Update the various nav values based on position and valid tuned in navs // Update the various nav values based on position and valid tuned in navs
void void FGKR_87::update( double dt ) {
FGKR_87::update( double dt )
{
double acft_lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; double acft_lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double acft_lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; double acft_lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double acft_elev = alt_node->getDoubleValue() * SG_FEET_TO_METER; double acft_elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
@ -418,7 +414,7 @@ FGKR_87::update( double dt )
#ifdef ENABLE_AUDIO_SUPPORT #ifdef ENABLE_AUDIO_SUPPORT
if ( valid && inrange ) { if ( valid && inrange ) {
// play station ident via audio system if on + ident, // play station ident via audio system if on + ident_btn,
// otherwise turn it off // otherwise turn it off
if ( on_off_vol_btn >= 0.01 && ident_btn ) { if ( on_off_vol_btn >= 0.01 && ident_btn ) {
FGSimpleSound *sound; FGSimpleSound *sound;
@ -449,8 +445,7 @@ FGKR_87::update( double dt )
// Update current nav/adf radio stations based on current postition // Update current nav/adf radio stations based on current postition
void FGKR_87::search() void FGKR_87::search() {
{
double acft_lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; double acft_lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double acft_lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; double acft_lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double acft_elev = alt_node->getDoubleValue() * SG_FEET_TO_METER; double acft_elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;

View file

@ -34,13 +34,11 @@
#include <simgear/timing/timestamp.hxx> #include <simgear/timing/timestamp.hxx>
#include <Navaids/navlist.hxx> #include <Navaids/navlist.hxx>
#include <Sound/beacon.hxx>
#include <Sound/morse.hxx> #include <Sound/morse.hxx>
class FGKR_87 : public FGSubsystem class FGKR_87 : public FGSubsystem
{ {
FGBeacon beacon;
FGMorse morse; FGMorse morse;
SGInterpTable *term_tbl; SGInterpTable *term_tbl;
@ -90,7 +88,7 @@ class FGKR_87 : public FGSubsystem
bool last_flt_et_btn; bool last_flt_et_btn;
bool set_rst_btn; // 0 = normal, 1 = depressed bool set_rst_btn; // 0 = normal, 1 = depressed
bool last_set_rst_btn; // 0 = normal, 1 = depressed bool last_set_rst_btn; // 0 = normal, 1 = depressed
bool ident_btn; // ??? bool ident_btn; // turn audio morse code on/off
// outputs // outputs
double freq; double freq;
@ -122,9 +120,12 @@ public:
void search (); void search ();
// internal values // internal values
inline string get_ident() const { return ident; }
inline bool get_valid() const { return valid; }
inline bool get_inrange() const { return inrange; } inline bool get_inrange() const { return inrange; }
inline double get_stn_lon() const { return stn_lon; } inline double get_stn_lon() const { return stn_lon; }
inline double get_stn_lat() const { return stn_lat; } inline double get_stn_lat() const { return stn_lat; }
inline double get_dist() const { return dist; }
inline double get_heading() const { return heading; } inline double get_heading() const { return heading; }
// modes // modes