From: curt Date: Tue, 27 May 2003 19:15:58 +0000 (+0000) Subject: Added some test code (currently commented out) to limit a remote visual X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=af13301cbd2ccc4f6d1d6dda718d7f5520f29659;p=flightgear.git Added some test code (currently commented out) to limit a remote visual slave to a specific frame rate (i.e. 30hz). This is potentially desireable if you are running on the ragged edge between 30/60 hz ... It would be nice at some point to make the code a bit more flexible and configurable so it could be activated from the command line or preferences file. --- diff --git a/src/Network/native_fdm.cxx b/src/Network/native_fdm.cxx index 8a8d743a9..985ac08b4 100644 --- a/src/Network/native_fdm.cxx +++ b/src/Network/native_fdm.cxx @@ -401,10 +401,23 @@ bool FGNativeFDM::process() { FGNetFDM2Props( &buf ); } } else { - while ( io->read( (char *)(& buf), length ) == length ) { - SG_LOG( SG_IO, SG_DEBUG, "Success reading data." ); - FGNetFDM2Props( &buf ); + // double dt = 1000000.0 / 30.0; + // SGTimeStamp current; current.stamp(); + int result; + result = io->read( (char *)(& buf), length ); + if ( result == length ) { + SG_LOG( SG_IO, SG_DEBUG, " Success reading data." ); + FGNetFDM2Props( &buf ); + } + while ( result == length /* || current - last_time < dt */ ) { + result = io->read( (char *)(& buf), length ); + if ( result == length ) { + SG_LOG( SG_IO, SG_DEBUG, " Success reading data." ); + FGNetFDM2Props( &buf ); + } + // current.stamp(); } + // last_time = current; } }