From 5ebfab9364d4315394a136732fd464ffe2229588 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 20 May 2016 16:14:33 +0200 Subject: Improve timestamp handling Replace PPS representation from double to integer, and analyse in OutputUHD if the timestamp is as expected. --- src/OutputUHD.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/OutputUHD.h') diff --git a/src/OutputUHD.h b/src/OutputUHD.h index 8cbfb3d..f725268 100644 --- a/src/OutputUHD.h +++ b/src/OutputUHD.h @@ -101,7 +101,6 @@ enum refclk_lock_loss_behaviour_t { CRASH, IGNORE }; struct UHDWorkerData { bool running; - bool failed_due_to_fct; #if FAKE_UHD == 0 uhd::usrp::multi_usrp::sptr myUsrp; @@ -129,11 +128,6 @@ struct UHDWorkerData { // What to do when the reference clock PLL loses lock refclk_lock_loss_behaviour_t refclk_lock_loss_behaviour; - - // What transmission mode we're using defines by how - // much the FCT should increment for each - // transmission frame. - int fct_increment; }; @@ -143,7 +137,6 @@ class UHDWorker { uwd = uhdworkerdata; uwd->running = true; - uwd->failed_due_to_fct = false; uhd_thread = boost::thread(&UHDWorker::process_errhandler, this); } @@ -160,17 +153,18 @@ class UHDWorker { int num_underflows; int num_late_packets; - bool fct_discontinuity; - int expected_next_fct; uhd::tx_metadata_t md; - time_t tx_second; - double pps_offset; - double last_pps; + bool last_tx_time_initialised; + uint32_t last_tx_second; + uint32_t last_tx_pps; + + // Used to print statistics once a second + double last_usrp_time; void print_async_metadata(const struct UHDWorkerFrameData *frame); void handle_frame(const struct UHDWorkerFrameData *frame); - void tx_frame(const struct UHDWorkerFrameData *frame); + void tx_frame(const struct UHDWorkerFrameData *frame, bool ts_update); struct UHDWorkerData *uwd; boost::thread uhd_thread; @@ -279,6 +273,13 @@ class OutputUHD: public ModOutput, public RemoteControllable { boost::unique_future gps_fix_future; boost::thread gps_fix_task; + + // What transmission mode we're using defines by how + // much the FCT should increment for each + // transmission frame. + int fct_increment; + int last_fct; + // Wait time in seconds to get fix static const int initial_gps_fix_wait = 180; -- cgit v1.2.3