1
0
Fork 0

Remove most compile warnings

This commit is contained in:
Markus Pargmann 2012-06-17 12:14:35 +02:00 committed by James Turner
parent e4fed256b7
commit ecfbb951ae
7 changed files with 78 additions and 76 deletions

View file

@ -81,7 +81,7 @@ FGModelMgr::add_model (SGPropertyNode * node)
<< t.getFormattedMessage() << t.getOrigin()); << t.getFormattedMessage() << t.getOrigin());
return; return;
} }
Instance * instance = new Instance; Instance * instance = new Instance;
SGModelPlacement *model = new SGModelPlacement; SGModelPlacement *model = new SGModelPlacement;
instance->model = model; instance->model = model;
@ -161,6 +161,7 @@ struct UpdateFunctor : public std::unary_function<FGModelMgr::Instance*, void>
{ {
SGModelPlacement* model = instance->model; SGModelPlacement* model = instance->model;
double lon, lat, elev, roll, pitch, heading; double lon, lat, elev, roll, pitch, heading;
lon = lat = elev = roll = pitch = heading = 0.0;
try { try {
// Optionally set position from properties // Optionally set position from properties

View file

@ -54,17 +54,20 @@ naRef FGNasalSys::propNodeGhost(SGPropertyNode* handle)
// array. This allows the Nasal handlers to do things like: // array. This allows the Nasal handlers to do things like:
// Node.getChild = func { _getChild(me.ghost, arg) } // Node.getChild = func { _getChild(me.ghost, arg) }
// //
#define NODEARG() \ #define NODENOARG() \
if(argc < 2 || !naIsGhost(args[0]) || \ if(argc < 2 || !naIsGhost(args[0]) || \
naGhost_type(args[0]) != &PropNodeGhostType) \ naGhost_type(args[0]) != &PropNodeGhostType) \
naRuntimeError(c, "bad argument to props function"); \ naRuntimeError(c, "bad argument to props function"); \
SGPropertyNode_ptr* node = (SGPropertyNode_ptr*)naGhost_ptr(args[0]); \ SGPropertyNode_ptr* node = (SGPropertyNode_ptr*)naGhost_ptr(args[0]);
#define NODEARG() \
NODENOARG(); \
naRef argv = args[1] naRef argv = args[1]
static naRef f_getType(naContext c, naRef me, int argc, naRef* args) static naRef f_getType(naContext c, naRef me, int argc, naRef* args)
{ {
using namespace simgear; using namespace simgear;
NODEARG(); NODENOARG();
const char* t = "unknown"; const char* t = "unknown";
switch((*node)->getType()) { switch((*node)->getType()) {
case props::NONE: t = "NONE"; break; case props::NONE: t = "NONE"; break;
@ -141,13 +144,13 @@ static naRef f_setAttribute(naContext c, naRef me, int argc, naRef* args)
static naRef f_getName(naContext c, naRef me, int argc, naRef* args) static naRef f_getName(naContext c, naRef me, int argc, naRef* args)
{ {
NODEARG(); NODENOARG();
return NASTR((*node)->getName()); return NASTR((*node)->getName());
} }
static naRef f_getIndex(naContext c, naRef me, int argc, naRef* args) static naRef f_getIndex(naContext c, naRef me, int argc, naRef* args)
{ {
NODEARG(); NODENOARG();
return naNum((*node)->getIndex()); return naNum((*node)->getIndex());
} }
@ -166,7 +169,7 @@ naRef makeVectorFromVec(naContext c, const T& vec)
static naRef f_getValue(naContext c, naRef me, int argc, naRef* args) static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
{ {
using namespace simgear; using namespace simgear;
NODEARG(); NODENOARG();
switch((*node)->getType()) { switch((*node)->getType()) {
case props::BOOL: case props::INT: case props::BOOL: case props::INT:
case props::LONG: case props::FLOAT: case props::LONG: case props::FLOAT:
@ -177,10 +180,10 @@ static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
SG_LOG(SG_NASAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN"); SG_LOG(SG_NASAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN");
return naNil(); return naNil();
} }
return naNum(dv); return naNum(dv);
} }
case props::STRING: case props::STRING:
case props::UNSPECIFIED: case props::UNSPECIFIED:
return NASTR((*node)->getStringValue()); return NASTR((*node)->getStringValue());
@ -228,12 +231,12 @@ static naRef f_setValue(naContext c, naRef me, int argc, naRef* args)
naRef n = naNumValue(val); naRef n = naNumValue(val);
if(naIsNil(n)) if(naIsNil(n))
naRuntimeError(c, "props.setValue() with non-number"); naRuntimeError(c, "props.setValue() with non-number");
double d = naNumValue(val).num; double d = naNumValue(val).num;
if (osg::isNaN(d)) { if (osg::isNaN(d)) {
naRuntimeError(c, "props.setValue() passed a NaN"); naRuntimeError(c, "props.setValue() passed a NaN");
} }
result = (*node)->setDoubleValue(d); result = (*node)->setDoubleValue(d);
} }
return naNum(result); return naNum(result);
@ -269,17 +272,17 @@ static naRef f_setDoubleValue(naContext c, naRef me, int argc, naRef* args)
naRef r = naNumValue(naVec_get(argv, 0)); naRef r = naNumValue(naVec_get(argv, 0));
if (naIsNil(r)) if (naIsNil(r))
naRuntimeError(c, "props.setDoubleValue() with non-number"); naRuntimeError(c, "props.setDoubleValue() with non-number");
if (osg::isNaN(r.num)) { if (osg::isNaN(r.num)) {
naRuntimeError(c, "props.setDoubleValue() passed a NaN"); naRuntimeError(c, "props.setDoubleValue() passed a NaN");
} }
return naNum((*node)->setDoubleValue(r.num)); return naNum((*node)->setDoubleValue(r.num));
} }
static naRef f_getParent(naContext c, naRef me, int argc, naRef* args) static naRef f_getParent(naContext c, naRef me, int argc, naRef* args)
{ {
NODEARG(); NODENOARG();
SGPropertyNode* n = (*node)->getParent(); SGPropertyNode* n = (*node)->getParent();
if(!n) return naNil(); if(!n) return naNil();
return propNodeGhostCreate(c, n); return propNodeGhostCreate(c, n);
@ -390,13 +393,13 @@ static naRef f_alias(naContext c, naRef me, int argc, naRef* args)
static naRef f_unalias(naContext c, naRef me, int argc, naRef* args) static naRef f_unalias(naContext c, naRef me, int argc, naRef* args)
{ {
NODEARG(); NODENOARG();
return naNum((*node)->unalias()); return naNum((*node)->unalias());
} }
static naRef f_getAliasTarget(naContext c, naRef me, int argc, naRef* args) static naRef f_getAliasTarget(naContext c, naRef me, int argc, naRef* args)
{ {
NODEARG(); NODENOARG();
return propNodeGhostCreate(c, (*node)->getAliasTarget()); return propNodeGhostCreate(c, (*node)->getAliasTarget());
} }

View file

@ -1,6 +1,6 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include <simgear/compiler.h> #include <simgear/compiler.h>
@ -23,8 +23,10 @@ MIDGTrack::MIDGTrack() {};
MIDGTrack::~MIDGTrack() {}; MIDGTrack::~MIDGTrack() {};
/*
* Unused function
*/
#if(0)
static uint32_t read_swab( char *buf, size_t offset, size_t size ) { static uint32_t read_swab( char *buf, size_t offset, size_t size ) {
uint32_t result = 0; uint32_t result = 0;
@ -51,6 +53,7 @@ static uint32_t read_swab( char *buf, size_t offset, size_t size ) {
return result; return result;
} }
#endif
static bool validate_cksum( uint8_t id, uint8_t size, char *buf, static bool validate_cksum( uint8_t id, uint8_t size, char *buf,
@ -88,6 +91,10 @@ static bool validate_cksum( uint8_t id, uint8_t size, char *buf,
void MIDGTrack::parse_msg( const int id, char *buf, MIDGpos *pos, MIDGatt *att ) void MIDGTrack::parse_msg( const int id, char *buf, MIDGpos *pos, MIDGatt *att )
{ {
/*
* Completely unused parser results. Removed from compiling to remove the warnings
*/
#if(0)
if ( id == 1 ) { if ( id == 1 ) {
uint32_t ts; uint32_t ts;
uint16_t status; uint16_t status;
@ -98,7 +105,7 @@ void MIDGTrack::parse_msg( const int id, char *buf, MIDGpos *pos, MIDGatt *att )
// timestamp // timestamp
ts = (uint32_t)read_swab( buf, 0, 4 ); ts = (uint32_t)read_swab( buf, 0, 4 );
// cout << " time stamp = " << ts << endl; // cout << " time stamp = " << ts << endl;
// status // status
status = (uint16_t)read_swab( buf, 4, 2 ); status = (uint16_t)read_swab( buf, 4, 2 );
// cout << " status = " << status << endl; // cout << " status = " << status << endl;
@ -312,18 +319,19 @@ void MIDGTrack::parse_msg( const int id, char *buf, MIDGpos *pos, MIDGatt *att )
// position dop // position dop
pdop = (uint16_t)read_swab( buf, 32, 2 ); pdop = (uint16_t)read_swab( buf, 32, 2 );
// cout << " pdop = " << pdop << endl; // cout << " pdop = " << pdop << endl;
// position accuracy // position accuracy
pacc = (uint16_t)read_swab( buf, 34, 2 ); pacc = (uint16_t)read_swab( buf, 34, 2 );
// cout << " pacc = " << pacc << endl; // cout << " pacc = " << pacc << endl;
// speed accuracy // speed accuracy
sacc = (uint16_t)read_swab( buf, 36, 2 ); sacc = (uint16_t)read_swab( buf, 36, 2 );
// cout << " sacc = " << sacc << endl; // cout << " sacc = " << sacc << endl;
} else { } else {
cout << "unknown id = " << id << endl; cout << "unknown id = " << id << endl;
} }
#endif
} }
@ -463,7 +471,7 @@ int MIDGTrack::next_message( SGIOChannel *ch, SGIOChannel *log,
// read checksum // read checksum
myread( ch, log, tmpbuf, 1 ); uint8_t cksum0 = (unsigned char)tmpbuf[0]; myread( ch, log, tmpbuf, 1 ); uint8_t cksum0 = (unsigned char)tmpbuf[0];
myread( ch, log, tmpbuf, 1 ); uint8_t cksum1 = (unsigned char)tmpbuf[0]; myread( ch, log, tmpbuf, 1 ); uint8_t cksum1 = (unsigned char)tmpbuf[0];
if ( validate_cksum( id, size, savebuf, cksum0, cksum1 ) ) { if ( validate_cksum( id, size, savebuf, cksum0, cksum1 ) ) {
parse_msg( id, savebuf, pos, att ); parse_msg( id, savebuf, pos, att );
return id; return id;
@ -480,7 +488,6 @@ int MIDGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
{ {
char tmpbuf[256]; char tmpbuf[256];
char savebuf[256]; char savebuf[256];
int result = 0;
cout << "in next_message()" << endl; cout << "in next_message()" << endl;
@ -488,7 +495,7 @@ int MIDGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
// scan for sync characters // scan for sync characters
uint8_t sync0, sync1; uint8_t sync0, sync1;
result = serial_read( serial, tmpbuf, 2 ); serial_read( serial, tmpbuf, 2 );
sync0 = (unsigned char)tmpbuf[0]; sync0 = (unsigned char)tmpbuf[0];
sync1 = (unsigned char)tmpbuf[1]; sync1 = (unsigned char)tmpbuf[1];
while ( (sync0 != 129 || sync1 != 161) && !myeof ) { while ( (sync0 != 129 || sync1 != 161) && !myeof ) {
@ -514,7 +521,7 @@ int MIDGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
serial_read( serial, tmpbuf, 2 ); serial_read( serial, tmpbuf, 2 );
uint8_t cksum0 = (unsigned char)tmpbuf[0]; uint8_t cksum0 = (unsigned char)tmpbuf[0];
uint8_t cksum1 = (unsigned char)tmpbuf[1]; uint8_t cksum1 = (unsigned char)tmpbuf[1];
if ( validate_cksum( id, size, savebuf, cksum0, cksum1 ) ) { if ( validate_cksum( id, size, savebuf, cksum0, cksum1 ) ) {
parse_msg( id, savebuf, pos, att ); parse_msg( id, savebuf, pos, att );
@ -529,7 +536,7 @@ int MIDGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
cout << "Check sum failure!" << endl; cout << "Check sum failure!" << endl;
return -1; return -1;
} }

View file

@ -77,15 +77,15 @@ bool inited = false;
// point value. By doing the BIG_ENDIAN test, I can optimize the // point value. By doing the BIG_ENDIAN test, I can optimize the
// routine for big-endian processors so it can be as efficient as // routine for big-endian processors so it can be as efficient as
// possible // possible
static void htond (double &x) static void htond (double &x)
{ {
if ( sgIsLittleEndian() ) { if ( sgIsLittleEndian() ) {
int *Double_Overlay; int *Double_Overlay;
int Holding_Buffer; int Holding_Buffer;
Double_Overlay = (int *) &x; Double_Overlay = (int *) &x;
Holding_Buffer = Double_Overlay [0]; Holding_Buffer = Double_Overlay [0];
Double_Overlay [0] = htonl (Double_Overlay [1]); Double_Overlay [0] = htonl (Double_Overlay [1]);
Double_Overlay [1] = htonl (Holding_Buffer); Double_Overlay [1] = htonl (Holding_Buffer);
} else { } else {
@ -94,15 +94,15 @@ static void htond (double &x)
} }
// Float version // Float version
static void htonf (float &x) static void htonf (float &x)
{ {
if ( sgIsLittleEndian() ) { if ( sgIsLittleEndian() ) {
int *Float_Overlay; int *Float_Overlay;
int Holding_Buffer; int Holding_Buffer;
Float_Overlay = (int *) &x; Float_Overlay = (int *) &x;
Holding_Buffer = Float_Overlay [0]; Holding_Buffer = Float_Overlay [0];
Float_Overlay [0] = htonl (Holding_Buffer); Float_Overlay [0] = htonl (Holding_Buffer);
} else { } else {
return; return;
@ -279,16 +279,13 @@ static void midg2fg( const MIDGpos pos, const MIDGatt att,
static void send_data( const MIDGpos pos, const MIDGatt att ) { static void send_data( const MIDGpos pos, const MIDGatt att ) {
int len;
int fdmsize = sizeof( FGNetFDM ); int fdmsize = sizeof( FGNetFDM );
// cout << "Running main loop" << endl;
FGNetFDM fgfdm; FGNetFDM fgfdm;
FGNetCtrls fgctrls; FGNetCtrls fgctrls;
midg2fg( pos, att, &fgfdm, &fgctrls ); midg2fg( pos, att, &fgfdm, &fgctrls );
len = fdm_sock.send(&fgfdm, fdmsize, 0); fdm_sock.send(&fgfdm, fdmsize, 0);
} }
@ -466,10 +463,10 @@ int main( int argc, char **argv ) {
MIDGpos pos0, pos1; MIDGpos pos0, pos1;
pos0 = pos1 = track.get_pospt( 0 ); pos0 = pos1 = track.get_pospt( 0 );
MIDGatt att0, att1; MIDGatt att0, att1;
att0 = att1 = track.get_attpt( 0 ); att0 = att1 = track.get_attpt( 0 );
while ( current_time < end_time ) { while ( current_time < end_time ) {
// cout << "current_time = " << current_time << " end_time = " // cout << "current_time = " << current_time << " end_time = "
// << end_time << endl; // << end_time << endl;
@ -566,7 +563,6 @@ int main( int argc, char **argv ) {
// process incoming data from the serial port // process incoming data from the serial port
int count = 0; int count = 0;
double current_time = 0.0;
MIDGpos pos; MIDGpos pos;
MIDGatt att; MIDGatt att;
@ -602,14 +598,14 @@ int main( int argc, char **argv ) {
if ( id == 10 ) { if ( id == 10 ) {
if ( att.get_msec() > att_time ) { if ( att.get_msec() > att_time ) {
att_time = att.get_msec(); att_time = att.get_msec();
current_time = att_time; //current_time = att_time;
} else { } else {
cout << "oops att back in time" << endl; cout << "oops att back in time" << endl;
} }
} else if ( id == 12 ) { } else if ( id == 12 ) {
if ( pos.get_msec() > pos_time ) { if ( pos.get_msec() > pos_time ) {
pos_time = pos.get_msec(); pos_time = pos.get_msec();
current_time = pos_time; //current_time = pos_time;
} else { } else {
cout << "oops pos back in time" << endl; cout << "oops pos back in time" << endl;
} }

View file

@ -1,6 +1,6 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include <iostream> #include <iostream>
#include <cstdio> #include <cstdio>
@ -430,7 +430,7 @@ int UGTrack::next_message( SGIOChannel *ch, SGIOChannel *log,
myread( ch, log, tmpbuf, 2 ); myread( ch, log, tmpbuf, 2 );
uint8_t cksum0 = (unsigned char)tmpbuf[0]; uint8_t cksum0 = (unsigned char)tmpbuf[0];
uint8_t cksum1 = (unsigned char)tmpbuf[1]; uint8_t cksum1 = (unsigned char)tmpbuf[1];
if ( validate_cksum( id, size, savebuf, cksum0, cksum1, ignore_checksum ) ) if ( validate_cksum( id, size, savebuf, cksum0, cksum1, ignore_checksum ) )
{ {
parse_msg( id, savebuf, gpspacket, imupacket, navpacket, servopacket, parse_msg( id, savebuf, gpspacket, imupacket, navpacket, servopacket,
@ -451,7 +451,6 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
{ {
char tmpbuf[256]; char tmpbuf[256];
char savebuf[256]; char savebuf[256];
int result = 0;
// cout << "in next_message()" << endl; // cout << "in next_message()" << endl;
@ -460,7 +459,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
// scan for sync characters // scan for sync characters
int scan_count = 0; int scan_count = 0;
uint8_t sync0, sync1; uint8_t sync0, sync1;
result = serial_read( serial, log, tmpbuf, 2 ); serial_read( serial, log, tmpbuf, 2 );
sync0 = (unsigned char)tmpbuf[0]; sync0 = (unsigned char)tmpbuf[0];
sync1 = (unsigned char)tmpbuf[1]; sync1 = (unsigned char)tmpbuf[1];
while ( (sync0 != START_OF_MSG0 || sync1 != START_OF_MSG1) && !myeof ) { while ( (sync0 != START_OF_MSG0 || sync1 != START_OF_MSG1) && !myeof ) {
@ -493,7 +492,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
uint8_t cksum1 = (unsigned char)tmpbuf[1]; uint8_t cksum1 = (unsigned char)tmpbuf[1];
// cout << "cksum0 = " << (int)cksum0 << " cksum1 = " << (int)cksum1 // cout << "cksum0 = " << (int)cksum0 << " cksum1 = " << (int)cksum1
// << endl; // << endl;
if ( validate_cksum( id, size, savebuf, cksum0, cksum1, ignore_checksum ) ) if ( validate_cksum( id, size, savebuf, cksum0, cksum1, ignore_checksum ) )
{ {
parse_msg( id, savebuf, gpspacket, imupacket, navpacket, servopacket, parse_msg( id, savebuf, gpspacket, imupacket, navpacket, servopacket,
@ -505,7 +504,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
cout << "Check sum failure!" << endl; cout << "Check sum failure!" << endl;
return -1; return -1;
} }

View file

@ -100,15 +100,15 @@ float gps_status = -1.0;
// point value. By doing the BIG_ENDIAN test, I can optimize the // point value. By doing the BIG_ENDIAN test, I can optimize the
// routine for big-endian processors so it can be as efficient as // routine for big-endian processors so it can be as efficient as
// possible // possible
static void htond (double &x) static void htond (double &x)
{ {
if ( sgIsLittleEndian() ) { if ( sgIsLittleEndian() ) {
int *Double_Overlay; int *Double_Overlay;
int Holding_Buffer; int Holding_Buffer;
Double_Overlay = (int *) &x; Double_Overlay = (int *) &x;
Holding_Buffer = Double_Overlay [0]; Holding_Buffer = Double_Overlay [0];
Double_Overlay [0] = htonl (Double_Overlay [1]); Double_Overlay [0] = htonl (Double_Overlay [1]);
Double_Overlay [1] = htonl (Holding_Buffer); Double_Overlay [1] = htonl (Holding_Buffer);
} else { } else {
@ -117,15 +117,15 @@ static void htond (double &x)
} }
// Float version // Float version
static void htonf (float &x) static void htonf (float &x)
{ {
if ( sgIsLittleEndian() ) { if ( sgIsLittleEndian() ) {
int *Float_Overlay; int *Float_Overlay;
int Holding_Buffer; int Holding_Buffer;
Float_Overlay = (int *) &x; Float_Overlay = (int *) &x;
Holding_Buffer = Float_Overlay [0]; Holding_Buffer = Float_Overlay [0];
Float_Overlay [0] = htonl (Holding_Buffer); Float_Overlay [0] = htonl (Holding_Buffer);
} else { } else {
return; return;
@ -353,7 +353,7 @@ static void ugear2fg( gps *gpspacket, imu *imupacket, nav *navpacket,
htonf(fdm->speedbrake); htonf(fdm->speedbrake);
htonf(fdm->spoilers); htonf(fdm->spoilers);
#if 0 #if 0
ctrls->version = FG_NET_CTRLS_VERSION; ctrls->version = FG_NET_CTRLS_VERSION;
ctrls->elevator_trim = 0.0; ctrls->elevator_trim = 0.0;
ctrls->flaps = 0.0; ctrls->flaps = 0.0;
@ -499,7 +499,6 @@ static void ugear2opengc( gps *gpspacket, imu *imupacket, nav *navpacket,
static void send_data_udp( gps *gpspacket, imu *imupacket, nav *navpacket, static void send_data_udp( gps *gpspacket, imu *imupacket, nav *navpacket,
servo *servopacket, health *healthpacket ) servo *servopacket, health *healthpacket )
{ {
int len;
int ogcsize = sizeof( ogcFGData ); int ogcsize = sizeof( ogcFGData );
int fdmsize = sizeof( FGNetFDM ); int fdmsize = sizeof( FGNetFDM );
// int ctrlsize = sizeof( FGNetCtrls ); // int ctrlsize = sizeof( FGNetCtrls );
@ -514,8 +513,8 @@ static void send_data_udp( gps *gpspacket, imu *imupacket, nav *navpacket,
&fgfdm, &fgctrls ); &fgfdm, &fgctrls );
ugear2opengc( gpspacket, imupacket, navpacket, servopacket, healthpacket, ugear2opengc( gpspacket, imupacket, navpacket, servopacket, healthpacket,
&fgogc ); &fgogc );
len = opengc_sock.send(&fgogc, ogcsize, 0); opengc_sock.send(&fgogc, ogcsize, 0);
len = fdm_sock.send(&fgfdm, fdmsize, 0); fdm_sock.send(&fgfdm, fdmsize, 0);
// len = ctrls_sock.send(&fgctrls, ctrlsize, 0); // len = ctrls_sock.send(&fgctrls, ctrlsize, 0);
} }
@ -776,16 +775,16 @@ int main( int argc, char **argv ) {
gps gps0, gps1; gps gps0, gps1;
gps0 = gps1 = track.get_gpspt( 0 ); gps0 = gps1 = track.get_gpspt( 0 );
imu imu0, imu1; imu imu0, imu1;
imu0 = imu1 = track.get_imupt( 0 ); imu0 = imu1 = track.get_imupt( 0 );
nav nav0, nav1; nav nav0, nav1;
nav0 = nav1 = track.get_navpt( 0 ); nav0 = nav1 = track.get_navpt( 0 );
servo servo0, servo1; servo servo0, servo1;
servo0 = servo1 = track.get_servopt( 0 ); servo0 = servo1 = track.get_servopt( 0 );
health health0, health1; health health0, health1;
health0 = health1 = track.get_healthpt( 0 ); health0 = health1 = track.get_healthpt( 0 );
@ -1087,7 +1086,7 @@ int main( int argc, char **argv ) {
} else { } else {
cout << "oops health back in time: " << healthpacket.time << " " << health_time << endl; cout << "oops health back in time: " << healthpacket.time << " " << health_time << endl;
} }
} }
if ( (current_time > gps_time + 2) || if ( (current_time > gps_time + 2) ||
@ -1106,7 +1105,7 @@ int main( int argc, char **argv ) {
command_mgr.add("hb"); command_mgr.add("hb");
command_heartbeat = current_time; command_heartbeat = current_time;
} }
// Command update @ 1hz // Command update @ 1hz
if ( current_time >= command_time + 1 ) { if ( current_time >= command_time + 1 ) {
command_mgr.update(&uavcom); command_mgr.update(&uavcom);
@ -1120,8 +1119,6 @@ int main( int argc, char **argv ) {
// double lonmin = fabs(navpacket.lon - londeg); // double lonmin = fabs(navpacket.lon - londeg);
int latdeg = (int)navpacket.lat; int latdeg = (int)navpacket.lat;
// double latmin = fabs(navpacket.lat - latdeg); // double latmin = fabs(navpacket.lat - latdeg);
char londir = 'E'; if ( londeg < 0 ) londir = 'W';
char latdir = 'N'; if ( latdeg < 0 ) latdir = 'S';
londeg = abs(londeg); londeg = abs(londeg);
latdeg = abs(latdeg); latdeg = abs(latdeg);
/*printf( "%.2f %c%02d:%.4f %c%03d:%.4f %.1f %.2f %.2f %.2f\n", /*printf( "%.2f %c%02d:%.4f %c%03d:%.4f %.1f %.2f %.2f %.2f\n",

View file

@ -60,15 +60,15 @@ bool inited = false;
// point value. By doing the BIG_ENDIAN test, I can optimize the // point value. By doing the BIG_ENDIAN test, I can optimize the
// routine for big-endian processors so it can be as efficient as // routine for big-endian processors so it can be as efficient as
// possible // possible
static void htond (double &x) static void htond (double &x)
{ {
if ( sgIsLittleEndian() ) { if ( sgIsLittleEndian() ) {
int *Double_Overlay; int *Double_Overlay;
int Holding_Buffer; int Holding_Buffer;
Double_Overlay = (int *) &x; Double_Overlay = (int *) &x;
Holding_Buffer = Double_Overlay [0]; Holding_Buffer = Double_Overlay [0];
Double_Overlay [0] = htonl (Double_Overlay [1]); Double_Overlay [0] = htonl (Double_Overlay [1]);
Double_Overlay [1] = htonl (Holding_Buffer); Double_Overlay [1] = htonl (Holding_Buffer);
} else { } else {
@ -77,15 +77,15 @@ static void htond (double &x)
} }
// Float version // Float version
static void htonf (float &x) static void htonf (float &x)
{ {
if ( sgIsLittleEndian() ) { if ( sgIsLittleEndian() ) {
int *Float_Overlay; int *Float_Overlay;
int Holding_Buffer; int Holding_Buffer;
Float_Overlay = (int *) &x; Float_Overlay = (int *) &x;
Holding_Buffer = Float_Overlay [0]; Holding_Buffer = Float_Overlay [0];
Float_Overlay [0] = htonl (Holding_Buffer); Float_Overlay [0] = htonl (Holding_Buffer);
} else { } else {
return; return;
@ -281,7 +281,6 @@ static void gps2fg( const GPSPoint p, FGNetFDM *fdm, FGNetCtrls *ctrls )
static void send_data( const GPSPoint p ) { static void send_data( const GPSPoint p ) {
int len;
// int ctrlsize = sizeof( FGNetCtrls ); // int ctrlsize = sizeof( FGNetCtrls );
int fdmsize = sizeof( FGNetFDM ); int fdmsize = sizeof( FGNetFDM );
@ -291,7 +290,7 @@ static void send_data( const GPSPoint p ) {
FGNetCtrls fgctrls; FGNetCtrls fgctrls;
gps2fg( p, &fgfdm, &fgctrls ); gps2fg( p, &fgfdm, &fgctrls );
len = fdm_sock.send(&fgfdm, fdmsize, 0); fdm_sock.send(&fgfdm, fdmsize, 0);
} }
@ -431,7 +430,7 @@ int main( int argc, char **argv ) {
GPSPoint p, p0, p1; GPSPoint p, p0, p1;
p0 = p1 = track.get_point( 0 ); p0 = p1 = track.get_point( 0 );
while ( current_time < end_time ) { while ( current_time < end_time ) {
// cout << "current_time = " << current_time << " end_time = " // cout << "current_time = " << current_time << " end_time = "
// << end_time << endl; // << end_time << endl;