From ebb352b13ae42a6054af985e7566f93f93eb7dc4 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Mon, 6 Nov 2023 16:08:07 +0100 Subject: [PATCH] Dev: : gui acq finished callback for different status (#850) * fix acquisition finished status to have different status for different modules, but does not have to be error. for eg. jf sync fw (2.4.1 gives idle for master and stopped for slaves when stopping acquiistion) --- slsDetectorSoftware/src/DetectorImpl.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index 9bf392e5a..e22f58fc8 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -1220,10 +1220,26 @@ int DetectorImpl::acquire() { dataProcessingThread.join(); if (acquisition_finished != nullptr) { - int status = Parallel(&Module::getRunStatus, {}).squash(ERROR); + // status + runStatus status = IDLE; + auto statusList = Parallel(&Module::getRunStatus, {}); + status = statusList.squash(ERROR); + // difference, but none error + if (status == ERROR && (!statusList.any(ERROR))) { + // handle jf sync issue (master idle, slaves stopped) + if (statusList.contains_only(IDLE, STOPPED)) { + status = STOPPED; + } + else + status = statusList.squash(RUNNING); + } + + // progress auto a = Parallel(&Module::getReceiverProgress, {}); double progress = (*std::max_element(a.begin(), a.end())); - acquisition_finished(progress, status, acqFinished_p); + + // callback + acquisition_finished(progress, static_cast(status), acqFinished_p); } clock_gettime(CLOCK_REALTIME, &end);