2000-04-24 23:50:59 +00:00
|
|
|
// radiostack.cxx -- class to manage an instance of the radio stack
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started April 2000.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2000 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$
|
|
|
|
|
|
|
|
|
2000-05-04 01:18:45 +00:00
|
|
|
#include <Aircraft/aircraft.hxx>
|
2000-06-15 18:36:13 +00:00
|
|
|
#include <Main/bfi.hxx>
|
2000-04-24 23:50:59 +00:00
|
|
|
#include <Navaids/ilslist.hxx>
|
|
|
|
#include <Navaids/navlist.hxx>
|
|
|
|
|
|
|
|
#include "radiostack.hxx"
|
|
|
|
|
2000-05-30 16:49:44 +00:00
|
|
|
/**
|
|
|
|
* Boy, this is ugly! Make the VOR range vary by altitude difference.
|
|
|
|
*/
|
|
|
|
static inline 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*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;
|
|
|
|
}
|
|
|
|
|
2000-04-24 23:50:59 +00:00
|
|
|
|
2000-04-25 03:09:26 +00:00
|
|
|
FGRadioStack *current_radiostack;
|
|
|
|
|
|
|
|
|
2000-04-24 23:50:59 +00:00
|
|
|
// Constructor
|
|
|
|
FGRadioStack::FGRadioStack() {
|
2000-05-12 20:07:51 +00:00
|
|
|
nav1_dme_dist = 0.0;
|
2000-04-24 23:50:59 +00:00
|
|
|
need_update = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
FGRadioStack::~FGRadioStack() {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-04 01:18:45 +00:00
|
|
|
// Search the database for the current frequencies given current location
|
2000-04-24 23:50:59 +00:00
|
|
|
void FGRadioStack::update( double lon, double lat, double elev ) {
|
|
|
|
need_update = false;
|
|
|
|
|
2000-05-04 01:18:45 +00:00
|
|
|
Point3D aircraft = fgGeodToCart( Point3D( lon, lat, elev ) );
|
|
|
|
Point3D station;
|
|
|
|
double az1, az2, s;
|
|
|
|
|
|
|
|
if ( nav1_valid ) {
|
2000-05-12 22:17:09 +00:00
|
|
|
station = Point3D( nav1_x, nav1_y, nav1_z );
|
|
|
|
nav1_loc_dist = aircraft.distance3D( station );
|
|
|
|
|
|
|
|
if ( nav1_has_dme ) {
|
|
|
|
// staightline distance
|
|
|
|
station = Point3D( nav1_dme_x, nav1_dme_y, nav1_dme_z );
|
|
|
|
nav1_dme_dist = aircraft.distance3D( station );
|
|
|
|
} else {
|
|
|
|
nav1_dme_dist = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nav1_has_gs ) {
|
2000-05-12 20:07:51 +00:00
|
|
|
station = Point3D( nav1_gs_x, nav1_gs_y, nav1_gs_z );
|
|
|
|
nav1_gs_dist = aircraft.distance3D( station );
|
2000-05-12 22:17:09 +00:00
|
|
|
} else {
|
|
|
|
nav1_gs_dist = 0.0;
|
2000-05-12 20:07:51 +00:00
|
|
|
}
|
2000-05-04 01:18:45 +00:00
|
|
|
|
2000-05-15 16:33:42 +00:00
|
|
|
if ( nav1_loc_dist < nav1_effective_range * NM_TO_METER ) {
|
2000-05-04 01:18:45 +00:00
|
|
|
nav1_inrange = true;
|
|
|
|
|
|
|
|
// wgs84 heading
|
|
|
|
geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG,
|
2000-05-12 20:07:51 +00:00
|
|
|
nav1_loclat, nav1_loclon,
|
2000-05-04 01:18:45 +00:00
|
|
|
&az1, &az2, &s );
|
|
|
|
nav1_heading = az1;
|
2000-06-15 18:36:13 +00:00
|
|
|
// Alex: nav1_heading = az1 - FGBFI::getMagVar() / RAD_TO_DEG;
|
2000-05-04 01:18:45 +00:00
|
|
|
|
|
|
|
// cout << " heading = " << nav1_heading
|
|
|
|
// << " dist = " << nav1_dist << endl;
|
|
|
|
} else {
|
|
|
|
nav1_inrange = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nav1_loc ) {
|
|
|
|
} else {
|
|
|
|
nav1_radial = nav1_sel_radial;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nav1_inrange = false;
|
|
|
|
// cout << "not picking up vor. :-(" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nav2_valid ) {
|
2000-05-12 22:17:09 +00:00
|
|
|
station = Point3D( nav2_x, nav2_y, nav2_z );
|
|
|
|
nav2_loc_dist = aircraft.distance3D( station );
|
|
|
|
|
|
|
|
if ( nav2_has_dme ) {
|
|
|
|
// staightline distance
|
|
|
|
station = Point3D( nav2_dme_x, nav2_dme_y, nav2_dme_z );
|
|
|
|
nav2_dme_dist = aircraft.distance3D( station );
|
|
|
|
} else {
|
|
|
|
nav2_dme_dist = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nav2_has_gs ) {
|
2000-05-12 20:07:51 +00:00
|
|
|
station = Point3D( nav2_gs_x, nav2_gs_y, nav2_gs_z );
|
|
|
|
nav2_gs_dist = aircraft.distance3D( station );
|
2000-05-12 22:17:09 +00:00
|
|
|
} else {
|
|
|
|
nav2_gs_dist = 0.0;
|
2000-05-12 20:07:51 +00:00
|
|
|
}
|
2000-05-04 01:18:45 +00:00
|
|
|
|
2000-05-15 16:33:42 +00:00
|
|
|
if ( nav2_loc_dist < nav2_effective_range * NM_TO_METER ) {
|
2000-05-04 01:18:45 +00:00
|
|
|
nav2_inrange = true;
|
|
|
|
|
|
|
|
// wgs84 heading
|
|
|
|
geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG,
|
2000-05-12 20:07:51 +00:00
|
|
|
nav2_loclat, nav2_loclon,
|
2000-05-04 01:18:45 +00:00
|
|
|
&az1, &az2, &s );
|
|
|
|
nav2_heading = az1;
|
2000-06-15 18:36:13 +00:00
|
|
|
// Alex: nav2_heading = az1 - FGBFI::getMagVar() / RAD_TO_DEG;
|
2000-05-04 01:18:45 +00:00
|
|
|
|
|
|
|
// cout << " heading = " << nav2_heading
|
|
|
|
// << " dist = " << nav2_dist << endl;
|
|
|
|
} else {
|
|
|
|
nav2_inrange = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !nav2_loc ) {
|
|
|
|
nav2_radial = nav2_sel_radial;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nav2_inrange = false;
|
|
|
|
// cout << "not picking up vor. :-(" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
// adf
|
|
|
|
if ( adf_valid ) {
|
|
|
|
// staightline distance
|
|
|
|
station = Point3D( adf_x, adf_y, adf_z );
|
|
|
|
adf_dist = aircraft.distance3D( station );
|
|
|
|
|
|
|
|
if ( adf_dist < adf_effective_range * NM_TO_METER ) {
|
|
|
|
adf_inrange = true;
|
|
|
|
|
|
|
|
// wgs84 heading
|
|
|
|
geo_inverse_wgs_84( elev, lat * RAD_TO_DEG, lon * RAD_TO_DEG,
|
|
|
|
adf_lat, adf_lon,
|
|
|
|
&az1, &az2, &s );
|
|
|
|
adf_heading = az1;
|
|
|
|
|
|
|
|
// cout << " heading = " << nav2_heading
|
|
|
|
// << " dist = " << nav2_dist << endl;
|
|
|
|
} else {
|
|
|
|
adf_inrange = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
adf_inrange = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update current nav/adf radio stations based on current postition
|
|
|
|
void FGRadioStack::search( double lon, double lat, double elev ) {
|
2000-04-24 23:50:59 +00:00
|
|
|
// nav1
|
2000-04-25 03:09:26 +00:00
|
|
|
FGILS ils;
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
FGNav nav;
|
|
|
|
|
2000-05-04 01:18:45 +00:00
|
|
|
if ( current_ilslist->query( lon, lat, elev, nav1_freq, &ils ) ) {
|
|
|
|
nav1_valid = true;
|
2000-04-27 03:26:36 +00:00
|
|
|
nav1_loc = true;
|
2000-05-12 22:17:09 +00:00
|
|
|
nav1_has_dme = ils.get_has_dme();
|
|
|
|
nav1_has_gs = ils.get_has_gs();
|
2000-05-04 01:18:45 +00:00
|
|
|
|
2000-05-12 20:07:51 +00:00
|
|
|
nav1_loclon = ils.get_loclon();
|
|
|
|
nav1_loclat = ils.get_loclat();
|
|
|
|
nav1_gslon = ils.get_gslon();
|
|
|
|
nav1_gslat = ils.get_gslat();
|
|
|
|
nav1_dmelon = ils.get_dmelon();
|
|
|
|
nav1_dmelat = ils.get_dmelat();
|
2000-04-25 03:09:26 +00:00
|
|
|
nav1_elev = ils.get_gselev();
|
2000-05-04 01:18:45 +00:00
|
|
|
nav1_effective_range = FG_ILS_DEFAULT_RANGE;
|
2000-04-25 04:58:25 +00:00
|
|
|
nav1_target_gs = ils.get_gsangle();
|
2000-05-04 01:18:45 +00:00
|
|
|
nav1_radial = ils.get_locheading();
|
2000-04-30 22:21:47 +00:00
|
|
|
while ( nav1_radial < 0.0 ) { nav1_radial += 360.0; }
|
|
|
|
while ( nav1_radial > 360.0 ) { nav1_radial -= 360.0; }
|
2000-05-12 22:17:09 +00:00
|
|
|
nav1_x = ils.get_x();
|
|
|
|
nav1_y = ils.get_y();
|
|
|
|
nav1_z = ils.get_z();
|
2000-05-12 20:07:51 +00:00
|
|
|
nav1_gs_x = ils.get_gs_x();
|
|
|
|
nav1_gs_y = ils.get_gs_y();
|
|
|
|
nav1_gs_z = ils.get_gs_z();
|
|
|
|
nav1_dme_x = ils.get_dme_x();
|
|
|
|
nav1_dme_y = ils.get_dme_y();
|
|
|
|
nav1_dme_z = ils.get_dme_z();
|
2000-05-04 01:18:45 +00:00
|
|
|
// cout << "Found an ils station in range" << endl;
|
2000-04-25 04:58:25 +00:00
|
|
|
// cout << " id = " << ils.get_locident() << endl;
|
2000-05-04 01:18:45 +00:00
|
|
|
} else if ( current_navlist->query( lon, lat, elev, nav1_freq, &nav ) ) {
|
|
|
|
nav1_valid = true;
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
nav1_loc = false;
|
2000-05-12 22:17:09 +00:00
|
|
|
nav1_has_dme = nav.get_has_dme();
|
|
|
|
nav1_has_gs = false;
|
2000-05-12 20:07:51 +00:00
|
|
|
nav1_loclon = nav.get_lon();
|
|
|
|
nav1_loclat = nav.get_lat();
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
nav1_elev = nav.get_elev();
|
2000-05-30 16:49:44 +00:00
|
|
|
nav1_effective_range = kludgeRange(nav1_elev, elev, nav.get_range());
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
nav1_target_gs = 0.0;
|
|
|
|
nav1_radial = nav1_sel_radial;
|
2000-05-12 22:17:09 +00:00
|
|
|
nav1_x = nav1_dme_x = nav.get_x();
|
|
|
|
nav1_y = nav1_dme_y = nav.get_y();
|
2000-05-14 01:41:11 +00:00
|
|
|
nav1_z = nav1_dme_z = nav.get_z();
|
2000-05-04 01:18:45 +00:00
|
|
|
// cout << "Found a vor station in range" << endl;
|
|
|
|
// cout << " id = " << nav.get_ident() << endl;
|
2000-04-24 23:50:59 +00:00
|
|
|
} else {
|
2000-05-04 01:18:45 +00:00
|
|
|
nav1_valid = false;
|
|
|
|
// cout << "not picking up vor1. :-(" << endl;
|
2000-04-24 23:50:59 +00:00
|
|
|
}
|
|
|
|
|
2000-05-04 01:18:45 +00:00
|
|
|
if ( current_ilslist->query( lon, lat, elev, nav2_freq, &ils ) ) {
|
|
|
|
nav2_valid = true;
|
|
|
|
nav2_loc = true;
|
2000-05-12 22:17:09 +00:00
|
|
|
nav2_has_dme = ils.get_has_dme();
|
|
|
|
nav2_has_gs = ils.get_has_gs();
|
2000-05-04 01:18:45 +00:00
|
|
|
|
2000-05-12 20:07:51 +00:00
|
|
|
nav2_loclon = ils.get_loclon();
|
|
|
|
nav2_loclat = ils.get_loclat();
|
2000-05-04 01:18:45 +00:00
|
|
|
nav2_elev = ils.get_gselev();
|
|
|
|
nav2_effective_range = FG_ILS_DEFAULT_RANGE;
|
|
|
|
nav2_target_gs = ils.get_gsangle();
|
|
|
|
nav2_radial = ils.get_locheading();
|
|
|
|
while ( nav2_radial < 0.0 ) { nav2_radial += 360.0; }
|
|
|
|
while ( nav2_radial > 360.0 ) { nav2_radial -= 360.0; }
|
2000-05-12 22:17:09 +00:00
|
|
|
nav2_x = ils.get_x();
|
|
|
|
nav2_y = ils.get_y();
|
|
|
|
nav2_z = ils.get_z();
|
2000-05-12 20:07:51 +00:00
|
|
|
nav2_gs_x = ils.get_gs_x();
|
|
|
|
nav2_gs_y = ils.get_gs_y();
|
|
|
|
nav2_gs_z = ils.get_gs_z();
|
|
|
|
nav2_dme_x = ils.get_dme_x();
|
|
|
|
nav2_dme_y = ils.get_dme_y();
|
|
|
|
nav2_dme_z = ils.get_dme_z();
|
2000-05-04 01:18:45 +00:00
|
|
|
// cout << "Found an ils station in range" << endl;
|
|
|
|
// cout << " id = " << ils.get_locident() << endl;
|
|
|
|
} else if ( current_navlist->query( lon, lat, elev, nav2_freq, &nav ) ) {
|
|
|
|
nav2_valid = true;
|
2000-04-27 03:26:36 +00:00
|
|
|
nav2_loc = false;
|
2000-05-12 22:17:09 +00:00
|
|
|
nav2_has_dme = nav.get_has_dme();
|
|
|
|
nav2_has_dme = false;
|
2000-05-12 20:07:51 +00:00
|
|
|
nav2_loclon = nav.get_lon();
|
|
|
|
nav2_loclat = nav.get_lat();
|
2000-04-25 03:09:26 +00:00
|
|
|
nav2_elev = nav.get_elev();
|
2000-05-30 16:49:44 +00:00
|
|
|
nav2_effective_range = kludgeRange(nav2_elev, elev, nav.get_range());
|
2000-05-04 01:18:45 +00:00
|
|
|
nav2_target_gs = 0.0;
|
User-visible
- knobs now continue to rotate when you hold down the mouse
- the middle mouse button makes knobs rotate much faster
- there are NAV1, NAV2, and ADF radios that can be tuned using the mouse
- there are standby frequencies for NAV1 and NAV2, and buttons to swap
- there is a crude, rather silly-looking DME, hard-wired to NAV1
- there is a crude, rather silly-looking autopilot that can lock
the heading (to the bug on the gyro), can lock to NAV1, and can lock
the current altitude
- the knobs for changing the radials on NAV1 and NAV2 look much better
and are in the right place
- tuning into an ILS frequency doesn't change the displayed radial for
NAV1
Code
- I've created a new module, sp_panel.[ch]xx, that constructs the
default single-prop panel; this works entirely outside of FGPanel,
so it is possible to construct similar modules for other sorts of
panels; all code specific to the default panel has been removed from
panel.cxx
- current_panel is now a pointer
- radiostack.[ch]xx keeps track both of the actual radial and of the
selected radial (they will differ with ILS); the NAV gauges should
not spin around automatically to show the actual radial (we need to
do something similar with the autopilot)
- the panel is initialized fairly early
- make sure that standby frequencies also get initialized
- I've started combining and clipping small textures to save texture
memory; there's a lot more to do, but at least I've made a start
2000-05-02 18:26:00 +00:00
|
|
|
nav2_radial = nav2_sel_radial;
|
2000-05-12 22:17:09 +00:00
|
|
|
nav2_x = nav2_dme_x = nav.get_x();
|
|
|
|
nav2_y = nav2_dme_y = nav.get_y();
|
|
|
|
nav2_z = nav2_dme_z = nav.get_z();
|
2000-05-04 01:18:45 +00:00
|
|
|
// cout << "Found a vor station in range" << endl;
|
|
|
|
// cout << " id = " << nav.get_ident() << endl;
|
2000-04-24 23:50:59 +00:00
|
|
|
} else {
|
2000-05-04 01:18:45 +00:00
|
|
|
nav2_valid = false;
|
|
|
|
// cout << "not picking up vor2. :-(" << endl;
|
2000-04-24 23:50:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// adf
|
2000-05-04 01:18:45 +00:00
|
|
|
if ( current_navlist->query( lon, lat, elev, adf_freq, &nav ) ) {
|
|
|
|
adf_valid = true;
|
|
|
|
|
2000-04-25 03:09:26 +00:00
|
|
|
adf_lon = nav.get_lon();
|
|
|
|
adf_lat = nav.get_lat();
|
|
|
|
adf_elev = nav.get_elev();
|
2000-05-30 16:49:44 +00:00
|
|
|
adf_effective_range = kludgeRange(adf_elev, elev, nav.get_range());
|
2000-05-04 01:18:45 +00:00
|
|
|
adf_x = nav.get_x();
|
|
|
|
adf_y = nav.get_y();
|
|
|
|
adf_z = nav.get_z();
|
2000-04-25 04:58:25 +00:00
|
|
|
// cout << "Found an adf station in range" << endl;
|
|
|
|
// cout << " id = " << nav.get_ident() << endl;
|
2000-04-24 23:50:59 +00:00
|
|
|
} else {
|
2000-05-04 01:18:45 +00:00
|
|
|
adf_valid = false;
|
2000-04-27 03:26:36 +00:00
|
|
|
// cout << "not picking up adf. :-(" << endl;
|
2000-04-24 23:50:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-04 01:18:45 +00:00
|
|
|
|
|
|
|
// periodic radio station search wrapper
|
|
|
|
void fgRadioSearch( void ) {
|
|
|
|
current_radiostack->search( cur_fdm_state->get_Longitude(),
|
|
|
|
cur_fdm_state->get_Latitude(),
|
|
|
|
cur_fdm_state->get_Altitude() * FEET_TO_METER );
|
|
|
|
}
|