last_flt_et_btn(false),
set_rst_btn(false),
last_set_rst_btn(false),
+ ident_btn(false),
freq(0.0),
stby_freq(0.0),
needle_deg(0.0),
// Destructor
-FGKR_87::~FGKR_87()
-{
+FGKR_87::~FGKR_87() {
delete term_tbl;
delete low_tbl;
delete high_tbl;
}
-void
-FGKR_87::init ()
-{
+void FGKR_87::init () {
morse.init();
update(0); // FIXME: use dt
}
-void
-FGKR_87::bind ()
-{
+
+void FGKR_87::bind () {
// internal values
- fgTie("/radios/kr-87/internal/ident", this,
- &FGKR_87::get_ident_btn,
- &FGKR_87::set_ident_btn);
- fgSetArchivable("/radios/kr-87/internal/ident");
+ fgTie("/radios/kr-87/internal/valid", this, &FGKR_87::get_valid);
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);
// modes
fgTie("/radios/kr-87/inputs/set-rst-btn", this,
&FGKR_87::get_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
fgTie("/radios/kr-87/outputs/selected-khz", this,
fgTie("/radios/kr-87/annunciators/et", this, &FGKR_87::get_et_ann );
}
-void
-FGKR_87::unbind ()
-{
+
+void FGKR_87::unbind () {
// 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/dist");
fgUntie("/radios/kr-87/internal/heading");
// modes
fgUntie("/radios/kr-87/inputs/frq-btn");
fgUntie("/radios/kr-87/inputs/flt-et-btn");
fgUntie("/radios/kr-87/inputs/set-rst-btn");
+ fgUntie("/radios/kr-87/inputs/ident-btn");
// outputs
fgUntie("/radios/kr-87/outputs/selected-khz");
// Update the various nav values based on position and valid tuned in navs
-void
-FGKR_87::update( double dt )
-{
+void FGKR_87::update( double dt ) {
double acft_lon = lon_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;
#ifdef ENABLE_AUDIO_SUPPORT
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
if ( on_off_vol_btn >= 0.01 && ident_btn ) {
FGSimpleSound *sound;
// 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_lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double acft_elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
#include <simgear/timing/timestamp.hxx>
#include <Navaids/navlist.hxx>
-#include <Sound/beacon.hxx>
#include <Sound/morse.hxx>
class FGKR_87 : public FGSubsystem
{
- FGBeacon beacon;
FGMorse morse;
SGInterpTable *term_tbl;
bool last_flt_et_btn;
bool 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
double freq;
void search ();
// internal values
+ inline string get_ident() const { return ident; }
+ inline bool get_valid() const { return valid; }
inline bool get_inrange() const { return inrange; }
inline double get_stn_lon() const { return stn_lon; }
inline double get_stn_lat() const { return stn_lat; }
+ inline double get_dist() const { return dist; }
inline double get_heading() const { return heading; }
// modes