Silver Crown Digital ADF.
hud_labl.cxx hud_ladr.cxx \
hud_lat.cxx hud_lon.cxx \
hud_scal.cxx hud_tbi.cxx \
+ kr_87.cxx kr_87.hxx \
panel.cxx panel.hxx \
panel_io.cxx panel_io.hxx \
radiostack.cxx radiostack.hxx \
--- /dev/null
+// kr-87.cxx -- class to impliment the King KR 87 Digital ADF
+//
+// Written by Curtis Olson, started April 2002.
+//
+// Copyright (C) 2002 Curtis L. Olson - curt@flightgear.org
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h> // snprintf
+
+#include <simgear/compiler.h>
+#include <simgear/math/sg_random.h>
+
+#include <Aircraft/aircraft.hxx>
+#include <Navaids/navlist.hxx>
+#include <Time/FGEventMgr.hxx>
+
+#include "kr_87.hxx"
+
+#include <string>
+SG_USING_STD(string);
+
+static int adf_play_count = 0;
+static time_t adf_last_time = 0;
+
+
+/**
+ * Boy, this is ugly! Make the VOR range vary by altitude difference.
+ */
+static double kludgeRange ( double stationElev, double aircraftElev,
+ double nominalRange)
+{
+ // Assume that the nominal range (usually
+ // 50nm) applies at a 5,000 ft difference.
+ // Just a wild guess!
+ double factor = ((aircraftElev*SG_METER_TO_FEET) - stationElev) / 5000.0;
+ double range = fabs(nominalRange * factor);
+
+ // Clamp the range to keep it sane; for
+ // now, never less than 25% or more than
+ // 500% of nominal range.
+ if (range < nominalRange/4.0) {
+ range = nominalRange/4.0;
+ } else if (range > nominalRange*5.0) {
+ range = nominalRange*5.0;
+ }
+
+ return range;
+}
+
+
+// Constructor
+FGKR_87::FGKR_87() :
+ lon_node(fgGetNode("/position/longitude-deg", true)),
+ lat_node(fgGetNode("/position/latitude-deg", true)),
+ alt_node(fgGetNode("/position/altitude-ft", true)),
+ need_update(true),
+ adf_freq(0.0),
+ adf_alt_freq(0.0),
+ adf_vol_btn(0.0)
+{
+ SGPath path( globals->get_fg_root() );
+ SGPath term = path;
+ term.append( "Navaids/range.term" );
+ SGPath low = path;
+ low.append( "Navaids/range.low" );
+ SGPath high = path;
+ high.append( "Navaids/range.high" );
+
+ term_tbl = new SGInterpTable( term.str() );
+ low_tbl = new SGInterpTable( low.str() );
+ high_tbl = new SGInterpTable( high.str() );
+}
+
+
+// Destructor
+FGKR_87::~FGKR_87()
+{
+ delete term_tbl;
+ delete low_tbl;
+ delete high_tbl;
+}
+
+
+void
+FGKR_87::init ()
+{
+ morse.init();
+
+ update(0); // FIXME: use dt
+}
+
+void
+FGKR_87::bind ()
+{
+ // User inputs
+ fgTie("/radios/adf/frequencies/selected-khz", this,
+ &FGKR_87::get_adf_freq, &FGKR_87::set_adf_freq);
+ fgSetArchivable("/radios/adf/frequencies/selected-khz");
+ fgTie("/radios/adf/frequencies/standby-khz", this,
+ &FGKR_87::get_adf_alt_freq, &FGKR_87::set_adf_alt_freq);
+ fgSetArchivable("/radios/adf/frequencies/standby-khz");
+ fgTie("/radios/adf/rotation-deg", this,
+ &FGKR_87::get_adf_rotation, &FGKR_87::set_adf_rotation);
+ fgSetArchivable("/radios/adf/rotation-deg");
+ fgTie("/radios/adf/volume", this,
+ &FGKR_87::get_adf_vol_btn,
+ &FGKR_87::set_adf_vol_btn);
+ fgSetArchivable("/radios/adf/volume");
+ fgTie("/radios/adf/ident", this,
+ &FGKR_87::get_adf_ident_btn,
+ &FGKR_87::set_adf_ident_btn);
+ fgSetArchivable("/radios/adf/ident");
+
+ // calculated values
+ fgTie("/radios/adf/inrange", this, &FGKR_87::get_adf_inrange);
+ fgTie("/radios/adf/heading", this, &FGKR_87::get_adf_heading);
+}
+
+void
+FGKR_87::unbind ()
+{
+ fgUntie("/radios/adf/frequencies/selected-khz");
+ fgUntie("/radios/adf/frequencies/standby-khz");
+ fgUntie("/radios/adf/rotation-deg");
+ fgUntie("/radios/adf/on");
+ fgUntie("/radios/adf/ident");
+ fgUntie("/radios/adf/inrange");
+ fgUntie("/radios/adf/heading");
+}
+
+
+// Update the various nav values based on position and valid tuned in navs
+void
+FGKR_87::update(double dt)
+{
+ double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+ double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+ double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
+
+ need_update = false;
+
+ Point3D aircraft = sgGeodToCart( Point3D( lon, lat, elev ) );
+ Point3D station;
+ double az1, az2, s;
+
+ ////////////////////////////////////////////////////////////////////////
+ // ADF
+ ////////////////////////////////////////////////////////////////////////
+
+ if ( adf_valid ) {
+ // staightline distance
+ station = Point3D( adf_x, adf_y, adf_z );
+ adf_dist = aircraft.distance3D( station );
+
+ // wgs84 heading
+ geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES,
+ lon * SGD_RADIANS_TO_DEGREES,
+ adf_lat, adf_lon,
+ &az1, &az2, &s );
+ adf_heading = az1;
+ // cout << " heading = " << adf_heading
+ // << " dist = " << adf_dist << endl;
+
+ adf_effective_range = kludgeRange(adf_elev, elev, adf_range);
+ if ( adf_dist < adf_effective_range * SG_NM_TO_METER ) {
+ adf_inrange = true;
+ } else if ( adf_dist < 2 * adf_effective_range * SG_NM_TO_METER ) {
+ adf_inrange = sg_random() <
+ ( 2 * adf_effective_range * SG_NM_TO_METER - adf_dist ) /
+ (adf_effective_range * SG_NM_TO_METER);
+ } else {
+ adf_inrange = false;
+ }
+ } else {
+ adf_inrange = false;
+ }
+
+#ifdef ENABLE_AUDIO_SUPPORT
+ if ( adf_valid && adf_inrange ) {
+ // play station ident via audio system if on + ident,
+ // otherwise turn it off
+ if ( adf_vol_btn > 0.1 && adf_ident_btn ) {
+ FGSimpleSound *sound;
+ sound = globals->get_soundmgr()->find( "adf-ident" );
+ if ( sound != NULL ) {
+ sound->set_volume( adf_vol_btn );
+ } else {
+ SG_LOG( SG_COCKPIT, SG_ALERT, "Can't find adf-ident sound" );
+ }
+ if ( adf_last_time <
+ globals->get_time_params()->get_cur_time() - 30 ) {
+ adf_last_time = globals->get_time_params()->get_cur_time();
+ adf_play_count = 0;
+ }
+ if ( adf_play_count < 4 ) {
+ // play ADF ident
+ if ( !globals->get_soundmgr()->is_playing("adf-ident") ) {
+ globals->get_soundmgr()->play_once( "adf-ident" );
+ ++adf_play_count;
+ }
+ }
+ } else {
+ globals->get_soundmgr()->stop( "adf-ident" );
+ }
+ }
+#endif
+}
+
+
+// Update current nav/adf radio stations based on current postition
+void FGKR_87::search()
+{
+ double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+ double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
+ double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
+
+ // FIXME: the panel should handle this
+ FGNav nav;
+
+ static string last_adf_ident = "";
+
+ ////////////////////////////////////////////////////////////////////////
+ // ADF.
+ ////////////////////////////////////////////////////////////////////////
+
+ if ( current_navlist->query( lon, lat, elev, adf_freq, &nav ) ) {
+ char freq[128];
+ snprintf( freq, 10, "%.0f", adf_freq );
+ adf_ident = freq;
+ adf_ident += nav.get_ident();
+ // cout << "adf ident = " << adf_ident << endl;
+ adf_valid = true;
+ if ( last_adf_ident != adf_ident ) {
+ last_adf_ident = adf_ident;
+
+ adf_trans_ident = nav.get_trans_ident();
+ adf_lon = nav.get_lon();
+ adf_lat = nav.get_lat();
+ adf_elev = nav.get_elev();
+ adf_range = nav.get_range();
+ adf_effective_range = kludgeRange(adf_elev, elev, adf_range);
+ adf_x = nav.get_x();
+ adf_y = nav.get_y();
+ adf_z = nav.get_z();
+
+#ifdef ENABLE_AUDIO_SUPPORT
+ if ( globals->get_soundmgr()->exists( "adf-ident" ) ) {
+ globals->get_soundmgr()->remove( "adf-ident" );
+ }
+ FGSimpleSound *sound;
+ sound = morse.make_ident( adf_trans_ident, LO_FREQUENCY );
+ sound->set_volume( 0.3 );
+ globals->get_soundmgr()->add( sound, "adf-ident" );
+
+ int offset = (int)(sg_random() * 30.0);
+ adf_play_count = offset / 4;
+ adf_last_time = globals->get_time_params()->get_cur_time() -
+ offset;
+ // cout << "offset = " << offset << " play_count = "
+ // << adf_play_count << " adf_last_time = "
+ // << adf_last_time << " current time = "
+ // << globals->get_time_params()->get_cur_time() << endl;
+#endif
+
+ // cout << "Found an adf station in range" << endl;
+ // cout << " id = " << nav.get_ident() << endl;
+ }
+ } else {
+ adf_valid = false;
+ adf_ident = "";
+ adf_trans_ident = "";
+#ifdef ENABLE_AUDIO_SUPPORT
+ globals->get_soundmgr()->remove( "adf-ident" );
+#endif
+ last_adf_ident = "";
+ // cout << "not picking up adf. :-(" << endl;
+ }
+}
--- /dev/null
+// kr-87.hxx -- class to impliment the King KR 87 Digital ADF
+//
+// Written by Curtis Olson, started June 2002.
+//
+// Copyright (C) 2002 Curtis L. Olson - curt@flightgear.org
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+
+
+#ifndef _FG_KR_87_HXX
+#define _FG_KR_87_HXX
+
+
+#include <Main/fgfs.hxx>
+#include <Main/fg_props.hxx>
+
+#include <simgear/compiler.h>
+
+#include <simgear/math/interpolater.hxx>
+#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;
+ SGInterpTable *low_tbl;
+ SGInterpTable *high_tbl;
+
+ SGPropertyNode *lon_node;
+ SGPropertyNode *lat_node;
+ SGPropertyNode *alt_node;
+
+ bool need_update;
+
+ string adf_ident;
+ string adf_trans_ident;
+ bool adf_valid;
+ bool adf_inrange;
+ double adf_freq;
+ double adf_alt_freq;
+ double adf_rotation;
+ double adf_lon;
+ double adf_lat;
+ double adf_elev;
+ double adf_range;
+ double adf_effective_range;
+ double adf_dist;
+ double adf_heading;
+ double adf_x;
+ double adf_y;
+ double adf_z;
+ double adf_vol_btn;
+ bool adf_ident_btn;
+
+public:
+
+ FGKR_87();
+ ~FGKR_87();
+
+ void init ();
+ void bind ();
+ void unbind ();
+ void update (double dt);
+
+ // Update nav/adf radios based on current postition
+ void search ();
+
+ // ADF Setters
+ inline void set_adf_freq( double freq ) {
+ adf_freq = freq; need_update = true;
+ }
+ inline void set_adf_alt_freq( double freq ) { adf_alt_freq = freq; }
+ inline void set_adf_rotation( double rot ) { adf_rotation = rot; }
+ inline void set_adf_vol_btn( double val ) {
+ if ( val < 0.0 ) val = 0.0;
+ if ( val > 1.0 ) val = 1.0;
+ adf_vol_btn = val;
+ }
+ inline void set_adf_ident_btn( bool val ) { adf_ident_btn = val; }
+
+ // ADF Accessors
+ inline double get_adf_freq () const { return adf_freq; }
+ inline double get_adf_alt_freq () const { return adf_alt_freq; }
+ inline double get_adf_rotation () const { return adf_rotation; }
+
+ // Calculated values
+ inline bool get_adf_inrange() const { return adf_inrange; }
+ inline double get_adf_lon() const { return adf_lon; }
+ inline double get_adf_lat() const { return adf_lat; }
+ inline double get_adf_heading() const { return adf_heading; }
+ inline double get_adf_vol_btn() const { return adf_vol_btn; }
+ inline bool get_adf_ident_btn() const { return adf_ident_btn; }
+};
+
+
+#endif // _FG_KR_87_HXX
static int nav1_play_count = 0;
static int nav2_play_count = 0;
-static int adf_play_count = 0;
static time_t nav1_last_time = 0;
static time_t nav2_last_time = 0;
-static time_t adf_last_time = 0;
FGRadioStack *current_radiostack;
dme_ete(0.0),
outer_blink(false),
middle_blink(false),
- inner_blink(false),
- adf_freq(0.0),
- adf_alt_freq(0.0),
- adf_vol_btn(0.0)
+ inner_blink(false)
{
SGPath path( globals->get_fg_root() );
SGPath term = path;
// Destructor
FGRadioStack::~FGRadioStack()
{
+ adf.unbind();
unbind(); // FIXME: should be called externally
delete term_tbl;
void
FGRadioStack::init ()
{
+ adf.init();
+
morse.init();
beacon.init();
blink.stamp();
search();
+ adf.search();
+
update(0); // FIXME: use dt
+ adf.update(0);
// Search radio database once per second
global_events.Register( "fgRadioSearch()",
fgTie("/radios/dme/speed-kt", this, &FGRadioStack::get_dme_spd);
fgTie("/radios/dme/ete-min", this, &FGRadioStack::get_dme_ete);
- // User inputs
- fgTie("/radios/adf/frequencies/selected-khz", this,
- &FGRadioStack::get_adf_freq, &FGRadioStack::set_adf_freq);
- fgSetArchivable("/radios/adf/frequencies/selected-khz");
- fgTie("/radios/adf/frequencies/standby-khz", this,
- &FGRadioStack::get_adf_alt_freq, &FGRadioStack::set_adf_alt_freq);
- fgSetArchivable("/radios/adf/frequencies/standby-khz");
- fgTie("/radios/adf/rotation-deg", this,
- &FGRadioStack::get_adf_rotation, &FGRadioStack::set_adf_rotation);
- fgSetArchivable("/radios/adf/rotation-deg");
- fgTie("/radios/adf/volume", this,
- &FGRadioStack::get_adf_vol_btn,
- &FGRadioStack::set_adf_vol_btn);
- fgSetArchivable("/radios/adf/volume");
- fgTie("/radios/adf/ident", this,
- &FGRadioStack::get_adf_ident_btn,
- &FGRadioStack::set_adf_ident_btn);
- fgSetArchivable("/radios/adf/ident");
-
fgTie("/radios/marker-beacon/inner", this,
&FGRadioStack::get_inner_blink);
fgTie("/radios/marker-beacon/middle", this,
&FGRadioStack::get_middle_blink);
fgTie("/radios/marker-beacon/outer", this,
&FGRadioStack::get_outer_blink);
+
+ adf.bind();
}
void
fgUntie("/radios/dme/speed-kt");
fgUntie("/radios/dme/ete-min");
- fgUntie("/radios/adf/frequencies/selected-khz");
- fgUntie("/radios/adf/frequencies/standby-khz");
- fgUntie("/radios/adf/rotation-deg");
- fgUntie("/radios/adf/on");
- fgUntie("/radios/adf/ident");
-
fgUntie("/radios/marker-beacon/inner");
fgUntie("/radios/marker-beacon/middle");
fgUntie("/radios/marker-beacon/outer");
+
+ adf.unbind();
}
dme_prev_dist = 0.0;
}
-
- ////////////////////////////////////////////////////////////////////////
- // ADF
- ////////////////////////////////////////////////////////////////////////
-
- if ( adf_valid ) {
- // staightline distance
- station = Point3D( adf_x, adf_y, adf_z );
- adf_dist = aircraft.distance3D( station );
-
- // wgs84 heading
- geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES,
- adf_lat, adf_lon,
- &az1, &az2, &s );
- adf_heading = az1;
- // cout << " heading = " << nav2_heading
- // << " dist = " << nav2_dist << endl;
-
- adf_effective_range = kludgeRange(adf_elev, elev, adf_range);
- if ( adf_dist < adf_effective_range * SG_NM_TO_METER ) {
- adf_inrange = true;
- } else if ( adf_dist < 2 * adf_effective_range * SG_NM_TO_METER ) {
- adf_inrange = sg_random() <
- ( 2 * adf_effective_range * SG_NM_TO_METER - adf_dist ) /
- (adf_effective_range * SG_NM_TO_METER);
- } else {
- adf_inrange = false;
- }
- } else {
- adf_inrange = false;
- }
-
-#ifdef ENABLE_AUDIO_SUPPORT
- if ( adf_valid && adf_inrange ) {
- // play station ident via audio system if on + ident,
- // otherwise turn it off
- if ( adf_vol_btn > 0.1 && adf_ident_btn ) {
- FGSimpleSound *sound;
- sound = globals->get_soundmgr()->find( "adf-ident" );
- if ( sound != NULL ) {
- sound->set_volume( adf_vol_btn );
- } else {
- SG_LOG( SG_COCKPIT, SG_ALERT, "Can't find adf-ident sound" );
- }
- if ( adf_last_time <
- globals->get_time_params()->get_cur_time() - 30 ) {
- adf_last_time = globals->get_time_params()->get_cur_time();
- adf_play_count = 0;
- }
- if ( adf_play_count < 4 ) {
- // play ADF ident
- if ( !globals->get_soundmgr()->is_playing("adf-ident") ) {
- globals->get_soundmgr()->play_once( "adf-ident" );
- ++adf_play_count;
- }
- }
- } else {
- globals->get_soundmgr()->stop( "adf-ident" );
- }
- }
-#endif
-
// marker beacon blinking
bool light_on = ( outer_blink || middle_blink || inner_blink );
SGTimeStamp current;
}
// cout << outer_blink << " " << middle_blink << " " << inner_blink << endl;
+
+ adf.update(0);
}
static string last_nav1_ident = "";
static string last_nav2_ident = "";
- static string last_adf_ident = "";
static bool last_nav1_vor = false;
static bool last_nav2_vor = false;
}
last_beacon = beacon_type;
-
- ////////////////////////////////////////////////////////////////////////
- // ADF.
- ////////////////////////////////////////////////////////////////////////
-
- if ( current_navlist->query( lon, lat, elev, adf_freq, &nav ) ) {
- char freq[128];
- snprintf( freq, 10, "%.0f", adf_freq );
- adf_ident = freq;
- adf_ident += nav.get_ident();
- // cout << "adf ident = " << adf_ident << endl;
- adf_valid = true;
- if ( last_adf_ident != adf_ident ) {
- last_adf_ident = adf_ident;
-
- adf_trans_ident = nav.get_trans_ident();
- adf_lon = nav.get_lon();
- adf_lat = nav.get_lat();
- adf_elev = nav.get_elev();
- adf_range = nav.get_range();
- adf_effective_range = kludgeRange(adf_elev, elev, adf_range);
- adf_x = nav.get_x();
- adf_y = nav.get_y();
- adf_z = nav.get_z();
-
-#ifdef ENABLE_AUDIO_SUPPORT
- if ( globals->get_soundmgr()->exists( "adf-ident" ) ) {
- globals->get_soundmgr()->remove( "adf-ident" );
- }
- FGSimpleSound *sound;
- sound = morse.make_ident( adf_trans_ident, LO_FREQUENCY );
- sound->set_volume( 0.3 );
- globals->get_soundmgr()->add( sound, "adf-ident" );
-
- int offset = (int)(sg_random() * 30.0);
- adf_play_count = offset / 4;
- adf_last_time = globals->get_time_params()->get_cur_time() -
- offset;
- // cout << "offset = " << offset << " play_count = "
- // << adf_play_count << " adf_last_time = "
- // << adf_last_time << " current time = "
- // << globals->get_time_params()->get_cur_time() << endl;
-#endif
-
- // cout << "Found an adf station in range" << endl;
- // cout << " id = " << nav.get_ident() << endl;
- }
- } else {
- adf_valid = false;
- adf_ident = "";
- adf_trans_ident = "";
-#ifdef ENABLE_AUDIO_SUPPORT
- globals->get_soundmgr()->remove( "adf-ident" );
-#endif
- last_adf_ident = "";
- // cout << "not picking up adf. :-(" << endl;
- }
+ adf.search();
}
#include <Sound/beacon.hxx>
#include <Sound/morse.hxx>
+#include "kr_87.hxx" // ADF
class FGRadioStack : public FGSubsystem
{
bool middle_blink;
bool inner_blink;
- string adf_ident;
- string adf_trans_ident;
- bool adf_valid;
- bool adf_inrange;
- double adf_freq;
- double adf_alt_freq;
- double adf_rotation;
- double adf_lon;
- double adf_lat;
- double adf_elev;
- double adf_range;
- double adf_effective_range;
- double adf_dist;
- double adf_heading;
- double adf_x;
- double adf_y;
- double adf_z;
- double adf_vol_btn;
- bool adf_ident_btn;
+ FGKR_87 adf; // King KR 87 Digital ADF model
// model standard VOR/DME/TACAN service volumes as per AIM 1-1-8
double adjustNavRange( double stationElev, double aircraftElev,
dme_freq = freq; need_update = true;
}
- // ADF Setters
- inline void set_adf_freq( double freq ) {
- adf_freq = freq; need_update = true;
- }
- inline void set_adf_alt_freq( double freq ) { adf_alt_freq = freq; }
- inline void set_adf_rotation( double rot ) { adf_rotation = rot; }
- inline void set_adf_vol_btn( double val ) {
- if ( val < 0.0 ) val = 0.0;
- if ( val > 1.0 ) val = 1.0;
- adf_vol_btn = val;
- }
- inline void set_adf_ident_btn( bool val ) { adf_ident_btn = val; }
-
// COMM1 Accessors
inline double get_comm1_freq () const { return comm1_freq; }
inline double get_comm1_alt_freq () const { return comm1_alt_freq; }
// DME Accessors
inline double get_dme_freq () const { return dme_freq; }
- // ADF Accessors
- inline double get_adf_freq () const { return adf_freq; }
- inline double get_adf_alt_freq () const { return adf_alt_freq; }
- inline double get_adf_rotation () const { return adf_rotation; }
-
// Marker Beacon Accessors
inline bool get_inner_blink () const { return inner_blink; }
inline bool get_middle_blink () const { return middle_blink; }
inline double get_dme_dist () const { return dme_dist; }
inline double get_dme_spd () const { return dme_spd; }
inline double get_dme_ete () const { return dme_ete; }
-
- inline bool get_adf_inrange() const { return adf_inrange; }
- inline double get_adf_lon() const { return adf_lon; }
- inline double get_adf_lat() const { return adf_lat; }
- inline double get_adf_heading() const { return adf_heading; }
- inline double get_adf_vol_btn() const { return adf_vol_btn; }
- inline bool get_adf_ident_btn() const { return adf_ident_btn; }
};
double FGSteam::get_HackADF_deg () {
+ static SGPropertyNode *adf_inrange = fgGetNode("/radios/adf/inrange", true);
+ static SGPropertyNode *adf_heading = fgGetNode("/radios/adf/heading", true);
static double last_r = 0;
- if ( current_radiostack->get_adf_inrange() ) {
- double r = current_radiostack->get_adf_heading()
+ if ( adf_inrange->getBoolValue() ) {
+ double r = adf_heading->getDoubleValue()
- fgGetDouble("/orientation/heading-deg");
last_r = r;
- // cout << "Radial = " << current_radiostack->get_adf_heading()
- // << " Heading = " << FGBFI::getHeading() << endl;
+ // cout << "Radial = " << adf_heading->getDoubleValue() << endl;
+ // cout << "/orientation/heading-deg = "
+ // << fgGetDouble("/orientation/heading-deg") << endl;
return r;
} else {
return last_r;