X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FATC-Outputs.cxx;h=bb3d265c403727c71a17f4ec2cba2150db504d26;hb=c1f250fd3340acb6b74603ba71771b441d7e7bb3;hp=a74ccf757d27d6b46a5efd5bf715a80215fc4d63;hpb=0da1cc6de035bb2f79a2419f034cfbef0e114bcb;p=flightgear.git diff --git a/src/Network/ATC-Outputs.cxx b/src/Network/ATC-Outputs.cxx index a74ccf757..bb3d265c4 100644 --- a/src/Network/ATC-Outputs.cxx +++ b/src/Network/ATC-Outputs.cxx @@ -31,11 +31,17 @@ # include # include # include +# include +# include #endif +#include +#include + #include STL_STRING #include +#include #include
@@ -47,6 +53,7 @@ SG_USING_STD(string); // Lock the ATC hardware static int ATCLock( int fd ) { +#if defined( unix ) || defined( __CYGWIN__ ) // rewind lseek( fd, 0, SEEK_SET ); @@ -57,11 +64,15 @@ static int ATCLock( int fd ) { } return result; +#else + return -1; +#endif } // Release the ATC hardware static int ATCRelease( int fd ) { +#if defined( unix ) || defined( __CYGWIN__ ) // rewind lseek( fd, 0, SEEK_SET ); @@ -74,6 +85,9 @@ static int ATCRelease( int fd ) { } return result; +#else + return -1; +#endif } @@ -93,6 +107,7 @@ FGATCOutput::FGATCOutput( const int _board, const SGPath &_config_file ) : // Write a radios command static int ATCSetRadios( int fd, unsigned char data[ATC_RADIO_DISPLAY_BYTES] ) { +#if defined( unix ) || defined( __CYGWIN__ ) // rewind lseek( fd, 0, SEEK_SET ); @@ -103,6 +118,9 @@ static int ATCSetRadios( int fd, unsigned char data[ATC_RADIO_DISPLAY_BYTES] ) { } return result; +#else + return -1; +#endif } @@ -110,6 +128,7 @@ static int ATCSetRadios( int fd, unsigned char data[ATC_RADIO_DISPLAY_BYTES] ) { static int ATCSetStepper( int fd, unsigned char channel, unsigned char value ) { +#if defined( unix ) || defined( __CYGWIN__ ) // rewind lseek( fd, 0, SEEK_SET ); @@ -125,11 +144,15 @@ static int ATCSetStepper( int fd, unsigned char channel, SG_LOG( SG_IO, SG_DEBUG, "Sent cmd = " << (int)channel << " value = " << (int)value ); return result; +#else + return -1; +#endif } // Read status of last stepper written to static unsigned char ATCReadStepper( int fd ) { +#if defined( unix ) || defined( __CYGWIN__ ) int result; // rewind @@ -145,11 +168,15 @@ static unsigned char ATCReadStepper( int fd ) { SG_LOG( SG_IO, SG_DEBUG, "Read result = " << (int)buf[0] ); return buf[0]; +#else + return 0; +#endif } // Turn a lamp on or off void ATCSetLamp( int fd, int channel, bool value ) { +#if defined( unix ) || defined( __CYGWIN__ ) // lamp channels 0-63 are written to LampPort0, channels 64-127 // are written to LampPort1 @@ -168,6 +195,7 @@ void ATCSetLamp( int fd, int channel, bool value ) { SG_LOG( SG_IO, SG_ALERT, "Write failed" ); exit( -1 ); } +#endif } @@ -245,6 +273,7 @@ bool FGATCOutput::open( int lock_fd ) { #endif +#ifdef ATCFLIGHTSIM_HAVE_COMPASS ///////////////////////////////////////////////////////////////////// // Home the compass stepper motor ///////////////////////////////////////////////////////////////////// @@ -295,6 +324,7 @@ bool FGATCOutput::open( int lock_fd ) { } compass_position = 0.0; +#endif ///////////////////////////////////////////////////////////////////// // Blank the radio display @@ -358,7 +388,6 @@ bool FGATCOutput::open( int lock_fd ) { ///////////////////////////////////////////////////////////////////// bool FGATCOutput::do_lamps() { - if ( lamps_out_node != NULL ) { for ( int i = 0; i < lamps_out_node->nChildren(); ++i ) { // read the next config entry from the property tree @@ -908,7 +937,9 @@ bool FGATCOutput::process() { do_lamps(); do_radio_display(); +#ifdef ATCFLIGHTSIM_HAVE_COMPASS do_steppers(); +#endif return true; }