Internal interface changes by David Megginson.
This commit is contained in:
parent
cff0022a16
commit
469703dd0c
13 changed files with 376 additions and 493 deletions
|
@ -1093,6 +1093,21 @@ SOURCE=.\src\FDM\LaRCsim\ls_step.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\src\FDM\LaRCsim\ls_trim.c
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Release\Lib_LaRCsim"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Debug\Lib_LaRCsim"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\src\FDM\LaRCsim\c172_aero.c
|
SOURCE=.\src\FDM\LaRCsim\c172_aero.c
|
||||||
|
|
||||||
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
@ -2095,6 +2110,21 @@ SOURCE=.\src\FDM\MagicCarpet.cxx
|
||||||
# PROP Default_Filter ""
|
# PROP Default_Filter ""
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\src\GUI\apt_dlg.cxx
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Release\Lib_GUI"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Debug\Lib_GUI"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\src\GUI\gui.cxx
|
SOURCE=.\src\GUI\gui.cxx
|
||||||
|
|
||||||
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
@ -2107,6 +2137,66 @@ SOURCE=.\src\GUI\gui.cxx
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\src\GUI\gui_local.cxx
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Release\Lib_GUI"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Debug\Lib_GUI"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\src\GUI\mouse.cxx
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Release\Lib_GUI"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Debug\Lib_GUI"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\src\GUI\net_dlg.cxx
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Release\Lib_GUI"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Debug\Lib_GUI"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\src\GUI\trackball.c
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Release\Lib_GUI"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Debug\Lib_GUI"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "Lib_Joystick"
|
# Begin Group "Lib_Joystick"
|
||||||
|
|
|
@ -184,10 +184,10 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
|
||||||
|
|
||||||
|
|
||||||
void FGAutopilot::update_old_control_values() {
|
void FGAutopilot::update_old_control_values() {
|
||||||
old_aileron = FGBFI::getAileron();
|
old_aileron = controls.get_aileron();
|
||||||
old_elevator = FGBFI::getElevator();
|
old_elevator = controls.get_elevator();
|
||||||
old_elevator_trim = FGBFI::getElevatorTrim();
|
old_elevator_trim = controls.get_elevator_trim();
|
||||||
old_rudder = FGBFI::getRudder();
|
old_rudder = controls.get_rudder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -755,6 +755,4 @@ void fgCockpitUpdate( void ) {
|
||||||
globals->get_options()->get_xsize(),
|
globals->get_options()->get_xsize(),
|
||||||
globals->get_options()->get_ysize() );
|
globals->get_options()->get_ysize() );
|
||||||
|
|
||||||
if (current_panel != 0)
|
|
||||||
current_panel->update();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
#include <simgear/misc/fgpath.hxx>
|
#include <simgear/misc/fgpath.hxx>
|
||||||
|
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
|
#include <Main/fg_props.hxx>
|
||||||
#include <Objects/texload.h>
|
#include <Objects/texload.h>
|
||||||
#include <Time/light.hxx>
|
#include <Time/light.hxx>
|
||||||
|
|
||||||
|
@ -143,6 +145,7 @@ FGPanel::FGPanel (int window_x, int window_y, int window_w, int window_h)
|
||||||
*/
|
*/
|
||||||
FGPanel::~FGPanel ()
|
FGPanel::~FGPanel ()
|
||||||
{
|
{
|
||||||
|
unbind();
|
||||||
for (instrument_list_type::iterator it = _instruments.begin();
|
for (instrument_list_type::iterator it = _instruments.begin();
|
||||||
it != _instruments.end();
|
it != _instruments.end();
|
||||||
it++) {
|
it++) {
|
||||||
|
@ -162,11 +165,45 @@ FGPanel::addInstrument (FGPanelInstrument * instrument)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the panel.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
FGPanel::init ()
|
||||||
|
{
|
||||||
|
// NO-OP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind panel properties.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
FGPanel::bind ()
|
||||||
|
{
|
||||||
|
fgTie("/sim/panel/visibility", &_visibility);
|
||||||
|
fgTie("/sim/panel/x-offset", &_x_offset);
|
||||||
|
fgTie("/sim/panel/y-offset", &_y_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unbind panel properties.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
FGPanel::unbind ()
|
||||||
|
{
|
||||||
|
fgUntie("/sim/panel/visibility");
|
||||||
|
fgUntie("/sim/panel/x-offset");
|
||||||
|
fgUntie("/sim/panel/y-offset");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the panel.
|
* Update the panel.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
FGPanel::update () const
|
FGPanel::update ()
|
||||||
{
|
{
|
||||||
// Do nothing if the panel isn't visible.
|
// Do nothing if the panel isn't visible.
|
||||||
if (!fgPanelVisible())
|
if (!fgPanelVisible())
|
||||||
|
|
|
@ -46,6 +46,8 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <plib/fnt.h>
|
#include <plib/fnt.h>
|
||||||
|
|
||||||
|
#include <Main/fgfs.hxx>
|
||||||
|
|
||||||
|
|
||||||
FG_USING_STD(vector);
|
FG_USING_STD(vector);
|
||||||
FG_USING_STD(map);
|
FG_USING_STD(map);
|
||||||
|
@ -119,19 +121,22 @@ private:
|
||||||
// the appropriate instruments for processing.
|
// the appropriate instruments for processing.
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class FGPanel
|
class FGPanel : public FGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGPanel (int window_x, int window_y, int window_w, int window_h);
|
FGPanel (int window_x, int window_y, int window_w, int window_h);
|
||||||
virtual ~FGPanel ();
|
virtual ~FGPanel ();
|
||||||
|
|
||||||
|
// Update the panel (every frame).
|
||||||
|
virtual void init ();
|
||||||
|
virtual void bind ();
|
||||||
|
virtual void unbind ();
|
||||||
|
virtual void update ();
|
||||||
|
|
||||||
// transfer pointer ownership!!!
|
// transfer pointer ownership!!!
|
||||||
virtual void addInstrument (FGPanelInstrument * instrument);
|
virtual void addInstrument (FGPanelInstrument * instrument);
|
||||||
|
|
||||||
// Update the panel (every frame).
|
|
||||||
virtual void update () const;
|
|
||||||
|
|
||||||
// Background texture.
|
// Background texture.
|
||||||
virtual void setBackground (ssgTexture * texture);
|
virtual void setBackground (ssgTexture * texture);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <Main/bfi.hxx>
|
#include <Main/bfi.hxx>
|
||||||
#include <Navaids/ilslist.hxx>
|
#include <Navaids/ilslist.hxx>
|
||||||
#include <Navaids/navlist.hxx>
|
#include <Navaids/navlist.hxx>
|
||||||
|
#include <Time/event.hxx>
|
||||||
|
|
||||||
#include "radiostack.hxx"
|
#include "radiostack.hxx"
|
||||||
|
|
||||||
|
@ -56,6 +57,11 @@ kludgeRange (double stationElev, double aircraftElev, double nominalRange)
|
||||||
FGRadioStack *current_radiostack;
|
FGRadioStack *current_radiostack;
|
||||||
|
|
||||||
|
|
||||||
|
// periodic radio station search wrapper
|
||||||
|
static void fgRadioSearch( void ) {
|
||||||
|
current_radiostack->search();
|
||||||
|
}
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
FGRadioStack::FGRadioStack() {
|
FGRadioStack::FGRadioStack() {
|
||||||
nav1_radial = 0.0;
|
nav1_radial = 0.0;
|
||||||
|
@ -63,16 +69,114 @@ FGRadioStack::FGRadioStack() {
|
||||||
nav2_radial = 0.0;
|
nav2_radial = 0.0;
|
||||||
nav2_dme_dist = 0.0;
|
nav2_dme_dist = 0.0;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
|
longitudeVal = globals->get_props()->getValue("/position/longitude");
|
||||||
|
latitudeVal = globals->get_props()->getValue("/position/latitude");
|
||||||
|
altitudeVal = globals->get_props()->getValue("/position/altitude");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
FGRadioStack::~FGRadioStack() {
|
FGRadioStack::~FGRadioStack()
|
||||||
|
{
|
||||||
|
unbind(); // FIXME: should be called externally
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FGRadioStack::init ()
|
||||||
|
{
|
||||||
|
search();
|
||||||
|
update();
|
||||||
|
|
||||||
|
// Search radio database once per second
|
||||||
|
global_events.Register( "fgRadioSearch()", fgRadioSearch,
|
||||||
|
fgEVENT::FG_EVENT_READY, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGRadioStack::bind ()
|
||||||
|
{
|
||||||
|
// User inputs
|
||||||
|
fgTie("/radios/nav1/frequencies/selected", this,
|
||||||
|
&FGRadioStack::get_nav1_freq, &FGRadioStack::set_nav1_freq);
|
||||||
|
fgTie("/radios/nav1/frequencies/standby", this,
|
||||||
|
&FGRadioStack::get_nav1_alt_freq, &FGRadioStack::set_nav1_alt_freq);
|
||||||
|
fgTie("/radios/nav1/radials/selected", this,
|
||||||
|
&FGRadioStack::get_nav1_sel_radial,
|
||||||
|
&FGRadioStack::set_nav1_sel_radial);
|
||||||
|
|
||||||
|
// Radio outputs
|
||||||
|
fgTie("/radios/nav1/radials/actual", this, &FGRadioStack::get_nav1_radial);
|
||||||
|
fgTie("/radios/nav1/to-flag", this, &FGRadioStack::get_nav1_to_flag);
|
||||||
|
fgTie("/radios/nav1/from-flag", this, &FGRadioStack::get_nav1_from_flag);
|
||||||
|
fgTie("/radios/nav1/in-range", this, &FGRadioStack::get_nav1_inrange);
|
||||||
|
fgTie("/radios/nav1/dme/distance", this, &FGRadioStack::get_nav1_dme_dist);
|
||||||
|
fgTie("/radios/nav1/dme/in-range", this,
|
||||||
|
&FGRadioStack::get_nav1_dme_inrange);
|
||||||
|
|
||||||
|
// User inputs
|
||||||
|
fgTie("/radios/nav2/frequencies/selected", this,
|
||||||
|
&FGRadioStack::get_nav2_freq, &FGRadioStack::set_nav2_freq);
|
||||||
|
fgTie("/radios/nav2/frequencies/standby", this,
|
||||||
|
&FGRadioStack::get_nav2_alt_freq, &FGRadioStack::set_nav2_alt_freq);
|
||||||
|
fgTie("/radios/nav2/radials/selected", this,
|
||||||
|
&FGRadioStack::get_nav2_sel_radial,
|
||||||
|
&FGRadioStack::set_nav2_sel_radial);
|
||||||
|
|
||||||
|
// Radio outputs
|
||||||
|
fgTie("/radios/nav2/radials/actual", this, &FGRadioStack::get_nav2_radial);
|
||||||
|
fgTie("/radios/nav2/to-flag", this, &FGRadioStack::get_nav2_to_flag);
|
||||||
|
fgTie("/radios/nav2/from-flag", this, &FGRadioStack::get_nav2_from_flag);
|
||||||
|
fgTie("/radios/nav2/in-range", this, &FGRadioStack::get_nav2_inrange);
|
||||||
|
fgTie("/radios/nav2/dme/distance", this, &FGRadioStack::get_nav2_dme_dist);
|
||||||
|
fgTie("/radios/nav2/dme/in-range", this,
|
||||||
|
&FGRadioStack::get_nav2_dme_inrange);
|
||||||
|
|
||||||
|
// User inputs
|
||||||
|
fgTie("/radios/adf/frequencies/selected", this,
|
||||||
|
&FGRadioStack::get_adf_freq, &FGRadioStack::set_adf_freq);
|
||||||
|
fgTie("/radios/adf/frequencies/standby", this,
|
||||||
|
&FGRadioStack::get_adf_alt_freq, &FGRadioStack::set_adf_alt_freq);
|
||||||
|
fgTie("/radios/adf/rotation", this,
|
||||||
|
&FGRadioStack::get_adf_rotation, &FGRadioStack::set_adf_rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FGRadioStack::unbind ()
|
||||||
|
{
|
||||||
|
fgUntie("/radios/nav1/frequencies/selected");
|
||||||
|
fgUntie("/radios/nav1/frequencies/standby");
|
||||||
|
fgUntie("/radios/nav1/radials/actual");
|
||||||
|
fgUntie("/radios/nav1/radials/selected");
|
||||||
|
fgUntie("/radios/nav1/to-flag");
|
||||||
|
fgUntie("/radios/nav1/from-flag");
|
||||||
|
fgUntie("/radios/nav1/in-range");
|
||||||
|
fgUntie("/radios/nav1/dme/distance");
|
||||||
|
fgUntie("/radios/nav1/dme/in-range");
|
||||||
|
|
||||||
|
fgUntie("/radios/nav2/frequencies/selected");
|
||||||
|
fgUntie("/radios/nav2/frequencies/standby");
|
||||||
|
fgUntie("/radios/nav2/radials/actual");
|
||||||
|
fgUntie("/radios/nav2/radials/selected");
|
||||||
|
fgUntie("/radios/nav2/to-flag");
|
||||||
|
fgUntie("/radios/nav2/from-flag");
|
||||||
|
fgUntie("/radios/nav2/in-range");
|
||||||
|
fgUntie("/radios/nav2/dme/distance");
|
||||||
|
fgUntie("/radios/nav2/dme/in-range");
|
||||||
|
|
||||||
|
fgUntie("/radios/adf/frequencies/selected");
|
||||||
|
fgUntie("/radios/adf/frequencies/standby");
|
||||||
|
fgUntie("/radios/adf/rotation");
|
||||||
|
}
|
||||||
|
|
||||||
// Search the database for the current frequencies given current location
|
// Search the database for the current frequencies given current location
|
||||||
void FGRadioStack::update( double lon, double lat, double elev ) {
|
void
|
||||||
|
FGRadioStack::update()
|
||||||
|
{
|
||||||
|
double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD;
|
||||||
|
double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD;
|
||||||
|
double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
|
||||||
|
|
||||||
need_update = false;
|
need_update = false;
|
||||||
|
|
||||||
Point3D aircraft = sgGeodToCart( Point3D( lon, lat, elev ) );
|
Point3D aircraft = sgGeodToCart( Point3D( lon, lat, elev ) );
|
||||||
|
@ -194,7 +298,12 @@ void FGRadioStack::update( double lon, double lat, double elev ) {
|
||||||
|
|
||||||
|
|
||||||
// Update current nav/adf radio stations based on current postition
|
// Update current nav/adf radio stations based on current postition
|
||||||
void FGRadioStack::search( double lon, double lat, double elev ) {
|
void FGRadioStack::search ()
|
||||||
|
{
|
||||||
|
double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD;
|
||||||
|
double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD;
|
||||||
|
double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
|
||||||
|
|
||||||
// nav1
|
// nav1
|
||||||
FGILS ils;
|
FGILS ils;
|
||||||
FGNav nav;
|
FGNav nav;
|
||||||
|
@ -249,7 +358,7 @@ void FGRadioStack::search( double lon, double lat, double elev ) {
|
||||||
} else {
|
} else {
|
||||||
nav1_valid = false;
|
nav1_valid = false;
|
||||||
nav1_radial = 0;
|
nav1_radial = 0;
|
||||||
nav2_dme_dist = 0;
|
nav1_dme_dist = 0;
|
||||||
// cout << "not picking up vor1. :-(" << endl;
|
// cout << "not picking up vor1. :-(" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,9 +432,75 @@ void FGRadioStack::search( double lon, double lat, double elev ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// periodic radio station search wrapper
|
/**
|
||||||
void fgRadioSearch( void ) {
|
* Return true if the NAV1 TO flag should be active.
|
||||||
current_radiostack->search( cur_fdm_state->get_Longitude(),
|
*/
|
||||||
cur_fdm_state->get_Latitude(),
|
bool
|
||||||
cur_fdm_state->get_Altitude() * FEET_TO_METER );
|
FGRadioStack::get_nav1_to_flag () const
|
||||||
|
{
|
||||||
|
if (nav1_inrange) {
|
||||||
|
double offset = fabs(nav1_heading - nav1_radial);
|
||||||
|
if (nav1_loc)
|
||||||
|
return (offset <= 8.0 || offset >= 352.0);
|
||||||
|
else
|
||||||
|
return (offset <= 20.0 || offset >= 340.0);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the NAV1 FROM flag should be active.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
FGRadioStack::get_nav1_from_flag () const
|
||||||
|
{
|
||||||
|
if (nav1_inrange) {
|
||||||
|
double offset = fabs(nav1_heading - nav1_radial);
|
||||||
|
if (nav1_loc)
|
||||||
|
return (offset >= 172.0 && offset <= 188.0);
|
||||||
|
else
|
||||||
|
return (offset >= 160.0 && offset <= 200.0);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the NAV2 TO flag should be active.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
FGRadioStack::get_nav2_to_flag () const
|
||||||
|
{
|
||||||
|
if (nav2_inrange) {
|
||||||
|
double offset = fabs(nav2_heading - nav2_radial);
|
||||||
|
if (nav2_loc)
|
||||||
|
return (offset <= 8.0 || offset >= 352.0);
|
||||||
|
else
|
||||||
|
return (offset <= 20.0 || offset >= 340.0);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the NAV2 FROM flag should be active.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
FGRadioStack::get_nav2_from_flag () const
|
||||||
|
{
|
||||||
|
if (nav2_inrange) {
|
||||||
|
double offset = fabs(nav2_heading - nav2_radial);
|
||||||
|
if (nav2_loc)
|
||||||
|
return (offset >= 172.0 && offset <= 188.0);
|
||||||
|
else
|
||||||
|
return (offset >= 160.0 && offset <= 200.0);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,22 @@
|
||||||
#define _FG_RADIOSTACK_HXX
|
#define _FG_RADIOSTACK_HXX
|
||||||
|
|
||||||
|
|
||||||
|
#include <Main/fgfs.hxx>
|
||||||
|
#include <Main/fg_props.hxx>
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#include <Navaids/ilslist.hxx>
|
#include <Navaids/ilslist.hxx>
|
||||||
#include <Navaids/navlist.hxx>
|
#include <Navaids/navlist.hxx>
|
||||||
|
|
||||||
|
|
||||||
class FGRadioStack {
|
|
||||||
|
class FGRadioStack : public FGSubsystem
|
||||||
|
{
|
||||||
|
|
||||||
|
SGValue * latitudeVal;
|
||||||
|
SGValue * longitudeVal;
|
||||||
|
SGValue * altitudeVal;
|
||||||
|
|
||||||
bool need_update;
|
bool need_update;
|
||||||
|
|
||||||
|
@ -121,11 +130,13 @@ public:
|
||||||
FGRadioStack();
|
FGRadioStack();
|
||||||
~FGRadioStack();
|
~FGRadioStack();
|
||||||
|
|
||||||
// Update nav/adf radios based on current postition
|
void init ();
|
||||||
void search( double lon, double lat, double elev );
|
void bind ();
|
||||||
|
void unbind ();
|
||||||
|
void update ();
|
||||||
|
|
||||||
// Update nav/adf radios based on current postition
|
// Update nav/adf radios based on current postition
|
||||||
void update( double lon, double lat, double elev );
|
void search ();
|
||||||
|
|
||||||
// NAV1 Setters
|
// NAV1 Setters
|
||||||
inline void set_nav1_freq( double freq ) {
|
inline void set_nav1_freq( double freq ) {
|
||||||
|
@ -170,7 +181,12 @@ public:
|
||||||
|
|
||||||
// Calculated values.
|
// Calculated values.
|
||||||
inline bool get_nav1_inrange() const { return nav1_inrange; }
|
inline bool get_nav1_inrange() const { return nav1_inrange; }
|
||||||
|
bool get_nav1_to_flag () const;
|
||||||
|
bool get_nav1_from_flag () const;
|
||||||
inline bool get_nav1_has_dme() const { return nav1_has_dme; }
|
inline bool get_nav1_has_dme() const { return nav1_has_dme; }
|
||||||
|
inline bool get_nav1_dme_inrange () const {
|
||||||
|
return nav1_inrange && nav1_has_dme;
|
||||||
|
}
|
||||||
inline bool get_nav1_has_gs() const { return nav1_has_gs; }
|
inline bool get_nav1_has_gs() const { return nav1_has_gs; }
|
||||||
inline bool get_nav1_loc() const { return nav1_loc; }
|
inline bool get_nav1_loc() const { return nav1_loc; }
|
||||||
inline double get_nav1_loclon() const { return nav1_loclon; }
|
inline double get_nav1_loclon() const { return nav1_loclon; }
|
||||||
|
@ -188,7 +204,12 @@ public:
|
||||||
inline double get_nav1_target_gs() const { return nav1_target_gs; }
|
inline double get_nav1_target_gs() const { return nav1_target_gs; }
|
||||||
|
|
||||||
inline bool get_nav2_inrange() const { return nav2_inrange; }
|
inline bool get_nav2_inrange() const { return nav2_inrange; }
|
||||||
|
bool get_nav2_to_flag () const;
|
||||||
|
bool get_nav2_from_flag () const;
|
||||||
inline bool get_nav2_has_dme() const { return nav2_has_dme; }
|
inline bool get_nav2_has_dme() const { return nav2_has_dme; }
|
||||||
|
inline bool get_nav2_dme_inrange () const {
|
||||||
|
return nav2_inrange && nav2_has_dme;
|
||||||
|
}
|
||||||
inline bool get_nav2_has_gs() const { return nav2_has_gs; }
|
inline bool get_nav2_has_gs() const { return nav2_has_gs; }
|
||||||
inline bool get_nav2_loc() const { return nav2_loc; }
|
inline bool get_nav2_loc() const { return nav2_loc; }
|
||||||
inline double get_nav2_loclon() const { return nav2_loclon; }
|
inline double get_nav2_loclon() const { return nav2_loclon; }
|
||||||
|
@ -214,9 +235,4 @@ public:
|
||||||
|
|
||||||
extern FGRadioStack *current_radiostack;
|
extern FGRadioStack *current_radiostack;
|
||||||
|
|
||||||
|
|
||||||
// periodic radio station search wrapper
|
|
||||||
void fgRadioSearch( void );
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _FG_RADIOSTACK_HXX
|
#endif // _FG_RADIOSTACK_HXX
|
||||||
|
|
|
@ -299,7 +299,7 @@ void FGSteam::_CatchUp()
|
||||||
scaling capability for the vacuum pump later on.
|
scaling capability for the vacuum pump later on.
|
||||||
When we have a real engine model, we can ask it.
|
When we have a real engine model, we can ask it.
|
||||||
*/
|
*/
|
||||||
the_ENGINE_rpm = FGBFI::getThrottle() * 26.0;
|
the_ENGINE_rpm = controls.get_throttle(0) * 26.0;
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
This is just temporary, until the static source works,
|
This is just temporary, until the static source works,
|
||||||
|
|
389
src/Main/bfi.cxx
389
src/Main/bfi.cxx
|
@ -4,6 +4,8 @@
|
||||||
//
|
//
|
||||||
// Copyright (C) 2000 David Megginson - david@megginson.com
|
// Copyright (C) 2000 David Megginson - david@megginson.com
|
||||||
//
|
//
|
||||||
|
// THIS CLASS IS DEPRECATED; USE THE PROPERTY MANAGER INSTEAD.
|
||||||
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License as
|
// modify it under the terms of the GNU General Public License as
|
||||||
// published by the Free Software Foundation; either version 2 of the
|
// published by the Free Software Foundation; either version 2 of the
|
||||||
|
@ -84,13 +86,6 @@ reinit ()
|
||||||
FG_LOG(FG_GENERAL, FG_INFO, "Starting BFI reinit");
|
FG_LOG(FG_GENERAL, FG_INFO, "Starting BFI reinit");
|
||||||
|
|
||||||
// TODO: add more AP stuff
|
// TODO: add more AP stuff
|
||||||
double elevator = FGBFI::getElevator();
|
|
||||||
double aileron = FGBFI::getAileron();
|
|
||||||
double rudder = FGBFI::getRudder();
|
|
||||||
double throttle = FGBFI::getThrottle();
|
|
||||||
double elevator_trim = FGBFI::getElevatorTrim();
|
|
||||||
double flaps = FGBFI::getFlaps();
|
|
||||||
double brake = FGBFI::getBrakes();
|
|
||||||
bool apHeadingLock = FGBFI::getAPHeadingLock();
|
bool apHeadingLock = FGBFI::getAPHeadingLock();
|
||||||
double apHeadingMag = FGBFI::getAPHeadingMag();
|
double apHeadingMag = FGBFI::getAPHeadingMag();
|
||||||
bool apAltitudeLock = FGBFI::getAPAltitudeLock();
|
bool apAltitudeLock = FGBFI::getAPAltitudeLock();
|
||||||
|
@ -113,16 +108,9 @@ reinit ()
|
||||||
cur_light_params.Update();
|
cur_light_params.Update();
|
||||||
fgUpdateLocalTime();
|
fgUpdateLocalTime();
|
||||||
fgUpdateWeatherDatabase();
|
fgUpdateWeatherDatabase();
|
||||||
fgRadioSearch();
|
current_radiostack->search();
|
||||||
|
|
||||||
// Restore all of the old states.
|
// Restore all of the old states.
|
||||||
FGBFI::setElevator(elevator);
|
|
||||||
FGBFI::setAileron(aileron);
|
|
||||||
FGBFI::setRudder(rudder);
|
|
||||||
FGBFI::setThrottle(throttle);
|
|
||||||
FGBFI::setElevatorTrim(elevator_trim);
|
|
||||||
FGBFI::setFlaps(flaps);
|
|
||||||
FGBFI::setBrakes(brake);
|
|
||||||
FGBFI::setAPHeadingLock(apHeadingLock);
|
FGBFI::setAPHeadingLock(apHeadingLock);
|
||||||
FGBFI::setAPHeadingMag(apHeadingMag);
|
FGBFI::setAPHeadingMag(apHeadingMag);
|
||||||
FGBFI::setAPAltitudeLock(apAltitudeLock);
|
FGBFI::setAPAltitudeLock(apAltitudeLock);
|
||||||
|
@ -229,9 +217,6 @@ FGBFI::init ()
|
||||||
fgTie("/sim/time/gmt", getDateString, setDateString);
|
fgTie("/sim/time/gmt", getDateString, setDateString);
|
||||||
fgTie("/sim/time/gmt-string", getGMTString);
|
fgTie("/sim/time/gmt-string", getGMTString);
|
||||||
fgTie("/sim/hud/visibility", getHUDVisible, setHUDVisible);
|
fgTie("/sim/hud/visibility", getHUDVisible, setHUDVisible);
|
||||||
fgTie("/sim/panel/visibility", getPanelVisible, setPanelVisible);
|
|
||||||
fgTie("/sim/panel/x-offset", getPanelXOffset, setPanelXOffset);
|
|
||||||
fgTie("/sim/panel/y-offset", getPanelYOffset, setPanelYOffset);
|
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
fgTie("/position/airport-id", getTargetAirport, setTargetAirport);
|
fgTie("/position/airport-id", getTargetAirport, setTargetAirport);
|
||||||
|
@ -260,22 +245,6 @@ FGBFI::init ()
|
||||||
fgTie("/velocities/speed-east", getSpeedEast);
|
fgTie("/velocities/speed-east", getSpeedEast);
|
||||||
fgTie("/velocities/speed-down", getSpeedDown);
|
fgTie("/velocities/speed-down", getSpeedDown);
|
||||||
|
|
||||||
// Controls
|
|
||||||
#if 0
|
|
||||||
fgTie("/controls/throttle", getThrottle, setThrottle);
|
|
||||||
fgTie("/controls/mixture", getMixture, setMixture);
|
|
||||||
fgTie("/controls/propellor-pitch", getPropAdvance, setPropAdvance);
|
|
||||||
fgTie("/controls/flaps", getFlaps, setFlaps);
|
|
||||||
fgTie("/controls/aileron", getAileron, setAileron);
|
|
||||||
fgTie("/controls/rudder", getRudder, setRudder);
|
|
||||||
fgTie("/controls/elevator", getElevator, setElevator);
|
|
||||||
fgTie("/controls/elevator-trim", getElevatorTrim, setElevatorTrim);
|
|
||||||
fgTie("/controls/brakes/all", getBrakes, setBrakes);
|
|
||||||
fgTie("/controls/brakes/left", getLeftBrake, setLeftBrake);
|
|
||||||
fgTie("/controls/brakes/right", getRightBrake, setRightBrake);
|
|
||||||
fgTie("/controls/brakes/center", getRightBrake, setCenterBrake);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Autopilot
|
// Autopilot
|
||||||
fgTie("/autopilot/locks/altitude", getAPAltitudeLock, setAPAltitudeLock);
|
fgTie("/autopilot/locks/altitude", getAPAltitudeLock, setAPAltitudeLock);
|
||||||
fgTie("/autopilot/settings/altitude", getAPAltitude, setAPAltitude);
|
fgTie("/autopilot/settings/altitude", getAPAltitude, setAPAltitude);
|
||||||
|
@ -285,34 +254,6 @@ FGBFI::init ()
|
||||||
getAPHeadingMag, setAPHeadingMag);
|
getAPHeadingMag, setAPHeadingMag);
|
||||||
fgTie("/autopilot/locks/nav1", getAPNAV1Lock, setAPNAV1Lock);
|
fgTie("/autopilot/locks/nav1", getAPNAV1Lock, setAPNAV1Lock);
|
||||||
|
|
||||||
// Radio navigation
|
|
||||||
fgTie("/radios/nav1/frequencies/selected", getNAV1Freq, setNAV1Freq);
|
|
||||||
fgTie("/radios/nav1/frequencies/standby", getNAV1AltFreq, setNAV1AltFreq);
|
|
||||||
fgTie("/radios/nav1/radials/actual", getNAV1Radial);
|
|
||||||
fgTie("/radios/nav1/radials/selected",
|
|
||||||
getNAV1SelRadial, setNAV1SelRadial);
|
|
||||||
fgTie("/radios/nav1/dme/distance", getNAV1DistDME);
|
|
||||||
fgTie("/radios/nav1/to-flag", getNAV1TO);
|
|
||||||
fgTie("/radios/nav1/from-flag", getNAV1FROM);
|
|
||||||
fgTie("/radios/nav1/in-range", getNAV1InRange);
|
|
||||||
fgTie("/radios/nav1/dme/in-range", getNAV1DMEInRange);
|
|
||||||
|
|
||||||
fgTie("/radios/nav2/frequencies/selected", getNAV2Freq, setNAV2Freq);
|
|
||||||
fgTie("/radios/nav2/frequencies/standby",
|
|
||||||
getNAV2AltFreq, setNAV2AltFreq);
|
|
||||||
fgTie("/radios/nav2/radials/actual", getNAV2Radial);
|
|
||||||
fgTie("/radios/nav2/radials/selected",
|
|
||||||
getNAV2SelRadial, setNAV2SelRadial);
|
|
||||||
fgTie("/radios/nav2/dme/distance", getNAV2DistDME);
|
|
||||||
fgTie("/radios/nav2/to-flag", getNAV2TO);
|
|
||||||
fgTie("/radios/nav2/from-flag", getNAV2FROM);
|
|
||||||
fgTie("/radios/nav2/in-range", getNAV2InRange);
|
|
||||||
fgTie("/radios/nav2/dme/in-range", getNAV2DMEInRange);
|
|
||||||
|
|
||||||
fgTie("/radios/adf/frequencies/selected", getADFFreq, setADFFreq);
|
|
||||||
fgTie("/radios/adf/frequencies/standby", getADFAltFreq, setADFAltFreq);
|
|
||||||
fgTie("/radios/adf/rotation", getADFRotation, setADFRotation);
|
|
||||||
|
|
||||||
// Weather
|
// Weather
|
||||||
fgTie("/environment/visibility", getVisibility, setVisibility);
|
fgTie("/environment/visibility", getVisibility, setVisibility);
|
||||||
fgTie("/environment/wind-north", getWindNorth, setWindNorth);
|
fgTie("/environment/wind-north", getWindNorth, setWindNorth);
|
||||||
|
@ -531,78 +472,6 @@ FGBFI::setHUDVisible (bool visible)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the 2D panel is visible.
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
FGBFI::getPanelVisible ()
|
|
||||||
{
|
|
||||||
return globals->get_options()->get_panel_status();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ensure that the 2D panel is visible or hidden.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
FGBFI::setPanelVisible (bool visible)
|
|
||||||
{
|
|
||||||
if (globals->get_options()->get_panel_status() != visible) {
|
|
||||||
globals->get_options()->toggle_panel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the panel's current x-shift.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
FGBFI::getPanelXOffset ()
|
|
||||||
{
|
|
||||||
if (current_panel != 0)
|
|
||||||
return current_panel->getXOffset();
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the panel's current x-shift.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
FGBFI::setPanelXOffset (int offset)
|
|
||||||
{
|
|
||||||
if (current_panel != 0)
|
|
||||||
current_panel->setXOffset(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the panel's current y-shift.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
FGBFI::getPanelYOffset ()
|
|
||||||
{
|
|
||||||
if (current_panel != 0)
|
|
||||||
return current_panel->getYOffset();
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the panel's current y-shift.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
FGBFI::setPanelYOffset (int offset)
|
|
||||||
{
|
|
||||||
if (current_panel != 0)
|
|
||||||
current_panel->setYOffset(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Position
|
// Position
|
||||||
|
@ -969,6 +838,7 @@ FGBFI::getSpeedDown ()
|
||||||
// Controls
|
// Controls
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the throttle setting, from 0.0 (none) to 1.0 (full).
|
* Get the throttle setting, from 0.0 (none) to 1.0 (full).
|
||||||
|
@ -1226,7 +1096,7 @@ FGBFI::setRightBrake (double brake)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1377,255 +1247,6 @@ FGBFI::setAPNAV1Lock (bool lock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
// Radio navigation.
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV1Freq ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav1_freq();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV1AltFreq ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav1_alt_freq();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV1Radial ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav1_radial();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV1SelRadial ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav1_sel_radial();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV1DistDME ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav1_dme_dist();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FGBFI::getNAV1TO ()
|
|
||||||
{
|
|
||||||
if (current_radiostack->get_nav1_inrange()) {
|
|
||||||
double heading = current_radiostack->get_nav1_heading();
|
|
||||||
double radial = current_radiostack->get_nav1_radial();
|
|
||||||
// double var = FGBFI::getMagVar();
|
|
||||||
if (current_radiostack->get_nav1_loc()) {
|
|
||||||
double offset = fabs(heading - radial);
|
|
||||||
return (offset<= 8.0 || offset >= 352.0);
|
|
||||||
} else {
|
|
||||||
// double offset =
|
|
||||||
// fabs(heading - var - radial);
|
|
||||||
double offset = fabs(heading - radial);
|
|
||||||
return (offset <= 20.0 || offset >= 340.0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FGBFI::getNAV1FROM ()
|
|
||||||
{
|
|
||||||
if (current_radiostack->get_nav1_inrange()) {
|
|
||||||
double heading = current_radiostack->get_nav1_heading();
|
|
||||||
double radial = current_radiostack->get_nav1_radial();
|
|
||||||
// double var = FGBFI::getMagVar();
|
|
||||||
if (current_radiostack->get_nav1_loc()) {
|
|
||||||
double offset = fabs(heading - radial);
|
|
||||||
return (offset >= 172.0 && offset<= 188.0);
|
|
||||||
} else {
|
|
||||||
// double offset =
|
|
||||||
// fabs(heading - var - radial);
|
|
||||||
double offset = fabs(heading - radial);
|
|
||||||
return (offset >= 160.0 && offset <= 200.0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FGBFI::getNAV1InRange ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav1_inrange();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FGBFI::getNAV1DMEInRange ()
|
|
||||||
{
|
|
||||||
return (current_radiostack->get_nav1_inrange() &&
|
|
||||||
current_radiostack->get_nav1_has_dme());
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV2Freq ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav2_freq();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV2AltFreq ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav2_alt_freq();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV2Radial ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav2_radial();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV2SelRadial ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav2_sel_radial();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getNAV2DistDME ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav2_dme_dist();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FGBFI::getNAV2TO ()
|
|
||||||
{
|
|
||||||
if (current_radiostack->get_nav2_inrange()) {
|
|
||||||
double heading = current_radiostack->get_nav2_heading();
|
|
||||||
double radial = current_radiostack->get_nav2_radial();
|
|
||||||
// double var = FGBFI::getMagVar();
|
|
||||||
if (current_radiostack->get_nav2_loc()) {
|
|
||||||
double offset = fabs(heading - radial);
|
|
||||||
return (offset<= 8.0 || offset >= 352.0);
|
|
||||||
} else {
|
|
||||||
// double offset =
|
|
||||||
// fabs(heading - var - radial);
|
|
||||||
double offset = fabs(heading - radial);
|
|
||||||
return (offset <= 20.0 || offset >= 340.0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FGBFI::getNAV2FROM ()
|
|
||||||
{
|
|
||||||
if (current_radiostack->get_nav2_inrange()) {
|
|
||||||
double heading = current_radiostack->get_nav2_heading();
|
|
||||||
double radial = current_radiostack->get_nav2_radial();
|
|
||||||
// double var = FGBFI::getMagVar();
|
|
||||||
if (current_radiostack->get_nav2_loc()) {
|
|
||||||
double offset = fabs(heading - radial);
|
|
||||||
return (offset >= 172.0 && offset<= 188.0);
|
|
||||||
} else {
|
|
||||||
// double offset =
|
|
||||||
// fabs(heading - var - radial);
|
|
||||||
double offset = fabs(heading - radial);
|
|
||||||
return (offset >= 160.0 && offset <= 200.0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
FGBFI::getNAV2InRange ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_nav2_inrange();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
FGBFI::getNAV2DMEInRange ()
|
|
||||||
{
|
|
||||||
return (current_radiostack->get_nav2_inrange() &&
|
|
||||||
current_radiostack->get_nav2_has_dme());
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getADFFreq ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_adf_freq();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getADFAltFreq ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_adf_alt_freq();
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
FGBFI::getADFRotation ()
|
|
||||||
{
|
|
||||||
return current_radiostack->get_adf_rotation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setNAV1Freq (double freq)
|
|
||||||
{
|
|
||||||
current_radiostack->set_nav1_freq(freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setNAV1AltFreq (double freq)
|
|
||||||
{
|
|
||||||
current_radiostack->set_nav1_alt_freq(freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setNAV1SelRadial (double radial)
|
|
||||||
{
|
|
||||||
current_radiostack->set_nav1_sel_radial(radial);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setNAV2Freq (double freq)
|
|
||||||
{
|
|
||||||
current_radiostack->set_nav2_freq(freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setNAV2AltFreq (double freq)
|
|
||||||
{
|
|
||||||
current_radiostack->set_nav2_alt_freq(freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setNAV2SelRadial (double radial)
|
|
||||||
{
|
|
||||||
current_radiostack->set_nav2_sel_radial(radial);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setADFFreq (double freq)
|
|
||||||
{
|
|
||||||
current_radiostack->set_adf_freq(freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setADFAltFreq (double freq)
|
|
||||||
{
|
|
||||||
current_radiostack->set_adf_alt_freq(freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
FGBFI::setADFRotation (double rot)
|
|
||||||
{
|
|
||||||
current_radiostack->set_adf_rotation(rot);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// GPS
|
// GPS
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
//
|
//
|
||||||
// Copyright (C) 2000 David Megginson - david@megginson.com
|
// Copyright (C) 2000 David Megginson - david@megginson.com
|
||||||
//
|
//
|
||||||
|
// THIS INTERFACE IS DEPRECATED; USE THE PROPERTY MANAGER INSTEAD.
|
||||||
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License as
|
// modify it under the terms of the GNU General Public License as
|
||||||
// published by the Free Software Foundation; either version 2 of the
|
// published by the Free Software Foundation; either version 2 of the
|
||||||
|
@ -73,16 +75,6 @@ public:
|
||||||
static bool getHUDVisible ();
|
static bool getHUDVisible ();
|
||||||
static void setHUDVisible (bool hudVisible);
|
static void setHUDVisible (bool hudVisible);
|
||||||
|
|
||||||
static bool getPanelVisible ();
|
|
||||||
static void setPanelVisible (bool panelVisible);
|
|
||||||
|
|
||||||
static int getPanelXOffset (); // pixels
|
|
||||||
static void setPanelXOffset (int i); // pixels
|
|
||||||
|
|
||||||
static int getPanelYOffset (); // pixels
|
|
||||||
static void setPanelYOffset (int i); // pixels
|
|
||||||
|
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
static double getLatitude (); // degrees
|
static double getLatitude (); // degrees
|
||||||
static void setLatitude (double latitude); // degrees
|
static void setLatitude (double latitude); // degrees
|
||||||
|
@ -135,6 +127,7 @@ public:
|
||||||
// static void setSpeedDown (double speed);
|
// static void setSpeedDown (double speed);
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Controls
|
// Controls
|
||||||
static double getThrottle (); // 0.0:1.0
|
static double getThrottle (); // 0.0:1.0
|
||||||
static void setThrottle (double throttle); // 0.0:1.0
|
static void setThrottle (double throttle); // 0.0:1.0
|
||||||
|
@ -172,6 +165,7 @@ public:
|
||||||
static double getCenterBrake (); // 0.0:1.0
|
static double getCenterBrake (); // 0.0:1.0
|
||||||
static void setCenterBrake (double brake); // 0.0:1.0
|
static void setCenterBrake (double brake); // 0.0:1.0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// Autopilot
|
// Autopilot
|
||||||
static bool getAPAltitudeLock ();
|
static bool getAPAltitudeLock ();
|
||||||
|
@ -192,57 +186,6 @@ public:
|
||||||
static bool getAPNAV1Lock ();
|
static bool getAPNAV1Lock ();
|
||||||
static void setAPNAV1Lock (bool lock);
|
static void setAPNAV1Lock (bool lock);
|
||||||
|
|
||||||
// Radio Navigation
|
|
||||||
static double getNAV1Freq ();
|
|
||||||
static void setNAV1Freq (double freq);
|
|
||||||
|
|
||||||
static double getNAV1AltFreq ();
|
|
||||||
static void setNAV1AltFreq (double freq);
|
|
||||||
|
|
||||||
static double getNAV1Radial (); // degrees
|
|
||||||
|
|
||||||
static double getNAV1SelRadial (); // degrees
|
|
||||||
static void setNAV1SelRadial (double radial); // degrees
|
|
||||||
|
|
||||||
static double getNAV1DistDME (); // nautical miles
|
|
||||||
|
|
||||||
static bool getNAV1TO ();
|
|
||||||
|
|
||||||
static bool getNAV1FROM ();
|
|
||||||
|
|
||||||
static bool getNAV1InRange ();
|
|
||||||
|
|
||||||
static bool getNAV1DMEInRange ();
|
|
||||||
|
|
||||||
static double getNAV2Freq ();
|
|
||||||
static void setNAV2Freq (double freq);
|
|
||||||
|
|
||||||
static double getNAV2AltFreq ();
|
|
||||||
static void setNAV2AltFreq (double freq);
|
|
||||||
|
|
||||||
static double getNAV2Radial (); // degrees
|
|
||||||
|
|
||||||
static double getNAV2SelRadial (); // degrees
|
|
||||||
static void setNAV2SelRadial (double radial); // degrees
|
|
||||||
|
|
||||||
static double getNAV2DistDME (); // nautical miles
|
|
||||||
|
|
||||||
static bool getNAV2TO ();
|
|
||||||
|
|
||||||
static bool getNAV2FROM ();
|
|
||||||
|
|
||||||
static bool getNAV2InRange ();
|
|
||||||
|
|
||||||
static bool getNAV2DMEInRange ();
|
|
||||||
|
|
||||||
static double getADFFreq ();
|
|
||||||
static void setADFFreq (double freq);
|
|
||||||
|
|
||||||
static double getADFAltFreq ();
|
|
||||||
static void setADFAltFreq (double freq);
|
|
||||||
|
|
||||||
static double getADFRotation (); // degrees
|
|
||||||
static void setADFRotation (double rot); // degrees
|
|
||||||
|
|
||||||
// GPS
|
// GPS
|
||||||
static string getTargetAirport ();
|
static string getTargetAirport ();
|
||||||
|
|
|
@ -663,21 +663,10 @@ bool fgInitSubsystems( void ) {
|
||||||
p_fix.append( "Navaids/default.fix" );
|
p_fix.append( "Navaids/default.fix" );
|
||||||
current_fixlist->init( p_fix );
|
current_fixlist->init( p_fix );
|
||||||
|
|
||||||
// Initialize the underlying radio stack model
|
// Radio stack subsystem.
|
||||||
current_radiostack = new FGRadioStack;
|
current_radiostack = new FGRadioStack;
|
||||||
|
current_radiostack->init();
|
||||||
current_radiostack->search( cur_fdm_state->get_Longitude(),
|
current_radiostack->bind();
|
||||||
cur_fdm_state->get_Latitude(),
|
|
||||||
cur_fdm_state->get_Altitude() * FEET_TO_METER );
|
|
||||||
|
|
||||||
current_radiostack->update( cur_fdm_state->get_Longitude(),
|
|
||||||
cur_fdm_state->get_Latitude(),
|
|
||||||
cur_fdm_state->get_Altitude() * FEET_TO_METER );
|
|
||||||
|
|
||||||
// Search radio database once per second
|
|
||||||
global_events.Register( "fgRadioSearch()", fgRadioSearch,
|
|
||||||
fgEVENT::FG_EVENT_READY, 1000);
|
|
||||||
|
|
||||||
|
|
||||||
// Initialize the Cockpit subsystem
|
// Initialize the Cockpit subsystem
|
||||||
if( fgCockpitInit( ¤t_aircraft )) {
|
if( fgCockpitInit( ¤t_aircraft )) {
|
||||||
|
@ -746,6 +735,8 @@ bool fgInitSubsystems( void ) {
|
||||||
"Error reading new panel from " << panel_path );
|
"Error reading new panel from " << panel_path );
|
||||||
} else {
|
} else {
|
||||||
FG_LOG( FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path );
|
FG_LOG( FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path );
|
||||||
|
current_panel->init();
|
||||||
|
current_panel->bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the BFI
|
// Initialize the BFI
|
||||||
|
|
|
@ -456,6 +456,7 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FG_LOG(FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path);
|
FG_LOG(FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path);
|
||||||
|
current_panel->unbind();
|
||||||
delete current_panel;
|
delete current_panel;
|
||||||
current_panel = new_panel;
|
current_panel = new_panel;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -642,7 +642,7 @@ void fgRenderFrame( void ) {
|
||||||
|
|
||||||
// set up moving parts
|
// set up moving parts
|
||||||
if (flaps_selector != NULL) {
|
if (flaps_selector != NULL) {
|
||||||
flaps_selector->select( (FGBFI::getFlaps() > 0.5f) ? 1 : 2 );
|
flaps_selector->select( (controls.get_flaps() > 0.5f) ? 1 : 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop_selector != NULL) {
|
if (prop_selector != NULL) {
|
||||||
|
@ -708,9 +708,17 @@ void fgRenderFrame( void ) {
|
||||||
glDisable( GL_DEPTH_TEST );
|
glDisable( GL_DEPTH_TEST );
|
||||||
// glDisable( GL_CULL_FACE );
|
// glDisable( GL_CULL_FACE );
|
||||||
// glDisable( GL_TEXTURE_2D );
|
// glDisable( GL_TEXTURE_2D );
|
||||||
|
|
||||||
|
// update the controls subsystem
|
||||||
|
controls.update();
|
||||||
|
|
||||||
hud_and_panel->apply();
|
hud_and_panel->apply();
|
||||||
fgCockpitUpdate();
|
fgCockpitUpdate();
|
||||||
|
|
||||||
|
// update the panel subsystem
|
||||||
|
if (current_panel != 0)
|
||||||
|
current_panel->update();
|
||||||
|
|
||||||
// We can do translucent menus, so why not. :-)
|
// We can do translucent menus, so why not. :-)
|
||||||
menus->apply();
|
menus->apply();
|
||||||
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
|
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
|
||||||
|
@ -823,9 +831,7 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
|
||||||
cur_fdm_state->get_Latitude() );
|
cur_fdm_state->get_Latitude() );
|
||||||
|
|
||||||
// Update radio stack model
|
// Update radio stack model
|
||||||
current_radiostack->update( cur_fdm_state->get_Longitude(),
|
current_radiostack->update();
|
||||||
cur_fdm_state->get_Latitude(),
|
|
||||||
cur_fdm_state->get_Altitude() * FEET_TO_METER );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue