mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-20 03:33:12 +01:00
Using a loop to stop (#585)
* loop for stop, 10 retries For example, if module A got a "stop" during an acquisition, it stops to an 'Idle' state. If module B gets a "stop" before an acquisition, it will return it is in 'Idle' state and continue to start the next acquisition, but module B then waits for "ready for trigger" synchronization from module A, which it will never get. Since module B missed the asynchronous stop command, the workaround in the client is to send another "stop" command (upto 10 retries) till it returns Idle.
This commit is contained in:
@@ -780,7 +780,39 @@ void Detector::startDetectorReadout() {
|
||||
}
|
||||
|
||||
void Detector::stopDetector(Positions pos) {
|
||||
pimpl->Parallel(&Module::stopAcquisition, pos);
|
||||
|
||||
// stop and check status X times
|
||||
int retries{0};
|
||||
//avoid default construction of runStatus::IDLE on squash
|
||||
auto status = getDetectorStatus().squash(defs::runStatus::RUNNING);
|
||||
while(status != defs::runStatus::IDLE){
|
||||
pimpl->Parallel(&Module::stopAcquisition, pos);
|
||||
status = getDetectorStatus().squash(defs::runStatus::RUNNING);
|
||||
++retries;
|
||||
|
||||
if(retries == 10)
|
||||
throw RuntimeError("Could not stop detector");
|
||||
}
|
||||
|
||||
|
||||
// validate consistent frame numbers
|
||||
switch (getDetectorType().squash()) {
|
||||
case defs::EIGER:
|
||||
case defs::JUNGFRAU:
|
||||
case defs::MOENCH:
|
||||
case defs::CHIPTESTBOARD: {
|
||||
auto res = getNextFrameNumber(pos);
|
||||
if (!res.equal()) {
|
||||
uint64_t maxVal = 0;
|
||||
for (auto it : res) {
|
||||
maxVal = std::max(maxVal, it);
|
||||
}
|
||||
setNextFrameNumber(maxVal + 1);
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
|
||||
|
||||
Reference in New Issue
Block a user