From ec2a933e20819549246c343020c3d6028e622b84 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Fri, 10 Mar 2023 16:27:51 +0100 Subject: [PATCH] Important BUGfix: effectively there was no sleep period in the thread handling the data from the UlDAQ --- src/lasp/device/lasp_streammgr.cpp | 6 ++++++ src/lasp/device/lasp_uldaq_impl.cpp | 5 +++-- src/lasp/dsp/lasp_ppm.cpp | 1 - 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lasp/device/lasp_streammgr.cpp b/src/lasp/device/lasp_streammgr.cpp index 4ae3fa7..42adf4c 100644 --- a/src/lasp/device/lasp_streammgr.cpp +++ b/src/lasp/device/lasp_streammgr.cpp @@ -420,12 +420,18 @@ void StreamMgr::addInDataHandler(InDataHandler &handler) { "is called more than once on a handler object"); } _inDataHandlers.push_back(&handler); + DEBUGTRACE_PRINT(_inDataHandlers.size()); + } + void StreamMgr::removeInDataHandler(InDataHandler &handler) { DEBUGTRACE_ENTER; checkRightThread(); std::scoped_lock lck(_inDataHandler_mtx); _inDataHandlers.remove(&handler); + + DEBUGTRACE_PRINT(_inDataHandlers.size()); + } Daq::StreamStatus StreamMgr::getStreamStatus(const StreamType type) const { diff --git a/src/lasp/device/lasp_uldaq_impl.cpp b/src/lasp/device/lasp_uldaq_impl.cpp index bda3819..9041ff9 100644 --- a/src/lasp/device/lasp_uldaq_impl.cpp +++ b/src/lasp/device/lasp_uldaq_impl.cpp @@ -252,6 +252,7 @@ InBufHandler::InBufHandler(DT9837A &daq, InDaqCallback cb) } void InBufHandler::start() { + DEBUGTRACE_ENTER; ScanStatus status; TransferStatus transferStatus; UlError err = ulDaqInScanStatus(daq.getHandle(), &status, &transferStatus); @@ -455,9 +456,9 @@ void DT9837A::threadFcn(InDaqCallback inCallback, OutDaqCallback outCallback) { _stopThread = true; break; } - } else { - std::this_thread::sleep_for(std::chrono::microseconds(sleeptime_us)); } + + std::this_thread::sleep_for(std::chrono::microseconds(sleeptime_us)); } /// Update stream status that we are not running anymore diff --git a/src/lasp/dsp/lasp_ppm.cpp b/src/lasp/dsp/lasp_ppm.cpp index 12bcd2b..4e9c640 100644 --- a/src/lasp/dsp/lasp_ppm.cpp +++ b/src/lasp/dsp/lasp_ppm.cpp @@ -22,7 +22,6 @@ bool PPMHandler::inCallback_threaded(const DaqData &d) { dmat data = d.toFloat(); - const us nchannels = d.nchannels; assert(data.n_cols == nchannels);