From a552e3bc8264c3e94585e8b4433196587b8e7563 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 29 Mar 2003 03:43:39 +0000 Subject: [PATCH] If the main frame rate is less than the requested io rate, don't send multiple copies of the same data for the sole purpose of faking it. --- src/Main/fg_io.cxx | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx index 997fa36b1..458f956c6 100644 --- a/src/Main/fg_io.cxx +++ b/src/Main/fg_io.cxx @@ -267,17 +267,12 @@ FGIO::init() } -// process any serial port work +// process any IO channel work void FGIO::update( double delta_time_sec ) { // cout << "processing I/O channels" << endl; - - // SGTimeStamp current_time; - // current_time.stamp(); - // static SGTimeStamp start_time = current_time; - // double elapsed_time = (current_time - start_time) / 1000000.0; - // cout << " Elapsed time = " << elapsed_time << endl; + // cout << " Elapsed time = " << delta_time_sec << endl; typedef vector< FGProtocol* > container; container::iterator i = io_channels.begin(); @@ -287,14 +282,16 @@ FGIO::update( double delta_time_sec ) if ( p->is_enabled() ) { p->dec_count_down( delta_time_sec ); - double dt = 1 / p->get_hz(); - while ( p->get_count_down() < 0.33 * dt ) { - p->process(); + double dt = 1 / p->get_hz(); + if ( p->get_count_down() < 0.33 * dt ) { + p->process(); + p->inc_count(); + while ( p->get_count_down() < 0.33 * dt ) { p->inc_count_down( dt ); - p->inc_count(); + } + // double ave = elapsed_time / p->get_count(); + // cout << " ave rate = " << ave << endl; } - // double ave = elapsed_time / p->get_count(); - // cout << " ave rate = " << ave << endl; } } } -- 2.39.5