Fixes for cygwin32 builds.
This commit is contained in:
parent
426c76de6c
commit
39f4bea43e
10 changed files with 100 additions and 45 deletions
|
@ -181,6 +181,9 @@
|
|||
/* Define if you have the wait3 system call. */
|
||||
#undef HAVE_WAIT3
|
||||
|
||||
/* Define if you have gdbm installed system wide. */
|
||||
#undef HAVE_GDBM
|
||||
|
||||
/* Define if you have zlib installed system wide. */
|
||||
#undef HAVE_ZLIB
|
||||
|
||||
|
|
|
@ -24,9 +24,18 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h> // for gdbm open flags
|
||||
#include <sys/stat.h> // for gdbm open flags
|
||||
#include <gdbm.h>
|
||||
|
||||
#ifdef HAVE_GDBM
|
||||
# include <gdbm.h>
|
||||
#else
|
||||
# include <simgear/gdbm/gdbm.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
|
|
|
@ -32,7 +32,15 @@
|
|||
#endif
|
||||
|
||||
|
||||
#include <gdbm.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GDBM
|
||||
# include <gdbm.h>
|
||||
#else
|
||||
# include <simgear/gdbm/gdbm.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) {
|
|||
if ( current_ilslist->query( lon, lat, elev, nav1_freq,
|
||||
&ils, &nav1_heading, &nav1_dist) ) {
|
||||
nav1_inrange = true;
|
||||
nav1_loc = true;
|
||||
nav1_lon = ils.get_loclon();
|
||||
nav1_lat = ils.get_loclat();
|
||||
nav1_elev = ils.get_gselev();
|
||||
|
@ -61,7 +62,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) {
|
|||
// << " dist = " << nav1_dist << endl;
|
||||
} else {
|
||||
nav1_inrange = false;
|
||||
cout << "not picking up vor. :-(" << endl;
|
||||
// cout << "not picking up vor. :-(" << endl;
|
||||
}
|
||||
|
||||
// nav1
|
||||
|
@ -69,6 +70,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) {
|
|||
if ( current_navlist->query( lon, lat, elev, nav2_freq,
|
||||
&nav, &nav2_heading, &nav2_dist) ) {
|
||||
nav2_inrange = true;
|
||||
nav2_loc = false;
|
||||
nav2_lon = nav.get_lon();
|
||||
nav2_lat = nav.get_lat();
|
||||
nav2_elev = nav.get_elev();
|
||||
|
@ -78,7 +80,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) {
|
|||
// << " dist = " << nav2_dist << endl;
|
||||
} else {
|
||||
nav2_inrange = false;
|
||||
cout << "not picking up vor. :-(" << endl;
|
||||
// cout << "not picking up vor. :-(" << endl;
|
||||
}
|
||||
|
||||
// adf
|
||||
|
@ -95,7 +97,7 @@ void FGRadioStack::update( double lon, double lat, double elev ) {
|
|||
// << " dist = " << junk << endl;
|
||||
} else {
|
||||
adf_inrange = false;
|
||||
cout << "not picking up adf. :-(" << endl;
|
||||
// cout << "not picking up adf. :-(" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class FGRadioStack {
|
|||
double nav1_target_gs;
|
||||
|
||||
bool nav2_inrange;
|
||||
bool nav2_loc;
|
||||
double nav2_freq;
|
||||
double nav2_radial;
|
||||
double nav2_lon;
|
||||
|
@ -98,6 +99,7 @@ public:
|
|||
inline double get_nav1_target_gs() const { return nav1_target_gs; }
|
||||
|
||||
inline bool get_nav2_inrange() const { return nav2_inrange; }
|
||||
inline bool get_nav2_loc() const { return nav2_loc; }
|
||||
inline double get_nav2_radial() const { return nav2_radial; }
|
||||
inline double get_nav2_lon() const { return nav2_lon; }
|
||||
inline double get_nav2_lat() const { return nav2_lat; }
|
||||
|
|
|
@ -214,6 +214,7 @@ void FGSteam::_CatchUp()
|
|||
// Everything below is a transient hack; expect it to disappear
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if 0
|
||||
/* KMYF ILS */
|
||||
#define NAV1_LOC (1)
|
||||
#define NAV1_Lat ( 32.0 + 48.94/60.0)
|
||||
|
@ -229,17 +230,11 @@ void FGSteam::_CatchUp()
|
|||
/* HAILE intersection */
|
||||
#define ADF_Lat ( 32.0 + 46.79/60.0)
|
||||
#define ADF_Lon (-117.0 - 02.70/60.0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
double FGSteam::get_HackGS_deg () {
|
||||
|
||||
double x = current_radiostack->get_nav1_dist();
|
||||
double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev())
|
||||
* FEET_TO_METER;
|
||||
double angle = atan2( y, x ) * RAD_TO_DEG;
|
||||
return current_radiostack->get_nav1_target_gs() - angle;
|
||||
|
||||
#if 0
|
||||
double x,y,dme;
|
||||
if (0==NAV1_LOC) return 0.0;
|
||||
|
@ -251,6 +246,16 @@ double FGSteam::get_HackGS_deg () {
|
|||
y = FGBFI::getAltitude() - NAV1_Alt;
|
||||
return 3.0 - (y/x) * 60.0 / 6000.0;
|
||||
#endif
|
||||
|
||||
if ( current_radiostack->get_nav1_inrange() ) {
|
||||
double x = current_radiostack->get_nav1_dist();
|
||||
double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev())
|
||||
* FEET_TO_METER;
|
||||
double angle = atan2( y, x ) * RAD_TO_DEG;
|
||||
return current_radiostack->get_nav1_target_gs() - angle;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -265,16 +270,21 @@ double FGSteam::get_HackVOR1_deg () {
|
|||
r = atan2 ( x, y ) * RAD_TO_DEG - NAV1_Rad - FGBFI::getMagVar();
|
||||
#endif
|
||||
|
||||
r = current_radiostack->get_nav1_radial() -
|
||||
current_radiostack->get_nav1_heading() + 180.0;
|
||||
// cout << "Radial = " << current_radiostack->get_nav1_radial()
|
||||
// << " Bearing = " << current_radiostack->get_nav1_heading() << endl;
|
||||
if ( current_radiostack->get_nav1_inrange() ) {
|
||||
r = current_radiostack->get_nav1_radial() -
|
||||
current_radiostack->get_nav1_heading() + 180.0;
|
||||
// cout << "Radial = " << current_radiostack->get_nav1_radial()
|
||||
// << " Bearing = " << current_radiostack->get_nav1_heading()
|
||||
// << endl;
|
||||
|
||||
if (r> 180.0) r-=360.0; else
|
||||
if (r<-180.0) r+=360.0;
|
||||
if ( fabs(r) > 90.0 )
|
||||
r = ( r<0.0 ? -r-180.0 : -r+180.0 );
|
||||
if (NAV1_LOC) r*=5.0;
|
||||
if (r> 180.0) r-=360.0; else
|
||||
if (r<-180.0) r+=360.0;
|
||||
if ( fabs(r) > 90.0 )
|
||||
r = ( r<0.0 ? -r-180.0 : -r+180.0 );
|
||||
if ( current_radiostack->get_nav1_loc() ) r*=5.0;
|
||||
} else {
|
||||
r = 0.0;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -291,37 +301,55 @@ double FGSteam::get_HackVOR2_deg () {
|
|||
r = atan2 ( x, y ) * RAD_TO_DEG - NAV2_Rad - FGBFI::getMagVar();
|
||||
#endif
|
||||
|
||||
r = current_radiostack->get_nav2_radial() -
|
||||
current_radiostack->get_nav2_heading() + 180.0;
|
||||
// cout << "Radial = " << current_radiostack->get_nav1_radial()
|
||||
// << " Bearing = " << current_radiostack->get_nav1_heading() << endl;
|
||||
if ( current_radiostack->get_nav2_inrange() ) {
|
||||
r = current_radiostack->get_nav2_radial() -
|
||||
current_radiostack->get_nav2_heading() + 180.0;
|
||||
// cout << "Radial = " << current_radiostack->get_nav1_radial()
|
||||
// << " Bearing = " << current_radiostack->get_nav1_heading() << endl;
|
||||
|
||||
if (r> 180.0) r-=360.0; else
|
||||
if (r<-180.0) r+=360.0;
|
||||
if ( fabs(r) > 90.0 )
|
||||
r = ( r<0.0 ? -r-180.0 : -r+180.0 );
|
||||
if (r> 180.0) r-=360.0; else
|
||||
if (r<-180.0) r+=360.0;
|
||||
if ( fabs(r) > 90.0 )
|
||||
r = ( r<0.0 ? -r-180.0 : -r+180.0 );
|
||||
} else {
|
||||
r = 0.0;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
double FGSteam::get_HackOBS1_deg ()
|
||||
{ return NAV1_Rad;
|
||||
double FGSteam::get_HackOBS1_deg () {
|
||||
return current_radiostack->get_nav1_radial();
|
||||
}
|
||||
|
||||
|
||||
double FGSteam::get_HackOBS2_deg ()
|
||||
{ return NAV2_Rad;
|
||||
double FGSteam::get_HackOBS2_deg () {
|
||||
return current_radiostack->get_nav2_radial();
|
||||
}
|
||||
|
||||
|
||||
double FGSteam::get_HackADF_deg ()
|
||||
{ double r;
|
||||
double x,y;
|
||||
y = 60.0 * ( ADF_Lat - FGBFI::getLatitude () );
|
||||
x = 60.0 * ( ADF_Lon - FGBFI::getLongitude() )
|
||||
* cos ( FGBFI::getLatitude () / RAD_TO_DEG );
|
||||
r = atan2 ( x, y ) * RAD_TO_DEG - FGBFI::getHeading ();
|
||||
return r;
|
||||
double FGSteam::get_HackADF_deg () {
|
||||
double r;
|
||||
|
||||
#if 0
|
||||
double x,y;
|
||||
y = 60.0 * ( ADF_Lat - FGBFI::getLatitude () );
|
||||
x = 60.0 * ( ADF_Lon - FGBFI::getLongitude() )
|
||||
* cos ( FGBFI::getLatitude () / RAD_TO_DEG );
|
||||
r = atan2 ( x, y ) * RAD_TO_DEG - FGBFI::getHeading ();
|
||||
#endif
|
||||
|
||||
if ( current_radiostack->get_adf_inrange() ) {
|
||||
r = current_radiostack->get_adf_heading() - FGBFI::getHeading() + 180.0;
|
||||
|
||||
// cout << "Radial = " << current_radiostack->get_adf_heading()
|
||||
// << " Heading = " << FGBFI::getHeading() << endl;
|
||||
} else {
|
||||
r = 0.0;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,6 +72,9 @@
|
|||
/* Define if you have the vprintf function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define if you have gdbm installed system wide. */
|
||||
#undef HAVE_GDBM
|
||||
|
||||
/* Define if you have zlib installed system wide. */
|
||||
#undef HAVE_ZLIB
|
||||
|
||||
|
|
|
@ -8,6 +8,6 @@ libNavaids_a_SOURCES = \
|
|||
nav.hxx navlist.hxx navlist.cxx
|
||||
|
||||
testnavs_SOURCES = testnavs.cxx
|
||||
testnavs_LDADD = libNavaids.a -lsgdebug -lsgmath -lsgmisc -lz
|
||||
testnavs_LDADD = libNavaids.a -lsgmath -lsgmisc -lsgdebug -lz
|
||||
|
||||
INCLUDES += -I$(top_builddir) -I$(top_builddir)/src
|
||||
|
|
|
@ -71,7 +71,7 @@ bool FGJoyClient::process() {
|
|||
FG_LOG( FG_IO, FG_DEBUG, "Success reading data." );
|
||||
int *msg;
|
||||
msg = (int *)buf;
|
||||
FG_LOG( FG_IO, FG_INFO, "X = " << msg[0] << " Y = " << msg[1] );
|
||||
FG_LOG( FG_IO, FG_DEBUG, "X = " << msg[0] << " Y = " << msg[1] );
|
||||
double aileron = ((double)msg[0] / 2048.0) - 1.0;
|
||||
double elevator = ((double)msg[1] / 2048.0) - 1.0;
|
||||
if ( fabs(aileron) < 0.05 ) {
|
||||
|
|
|
@ -53,12 +53,12 @@ int result;
|
|||
|
||||
#if defined( __CYGWIN__ )
|
||||
#include <errno.h>
|
||||
const char *const *sys_errlist = _sys_errlist;
|
||||
#else
|
||||
extern const char *const sys_errlist[];
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
extern const char *const sys_errlist[];
|
||||
|
||||
int current_port = 10000;
|
||||
u_short base_port = 10000;
|
||||
u_short end_port = 10010;
|
||||
|
|
Loading…
Reference in a new issue