fix to not throw exception when stopping detector when it really stopped, expecting idle instead of stopped flag (#595)

This commit is contained in:
Dhanya Thattil
2022-12-12 11:39:20 +01:00
committed by GitHub
parent ff5aa13073
commit 3fb22dc20a
2 changed files with 11 additions and 1 deletions

View File

@ -826,7 +826,12 @@ void Detector::stopDetector(Positions pos) {
int retries{0};
// avoid default construction of runStatus::IDLE on squash
auto status = getDetectorStatus().squash(defs::runStatus::RUNNING);
while (status != defs::runStatus::IDLE) {
while (status != defs::runStatus::IDLE &&
status != defs::runStatus::STOPPED) {
if (status == defs::runStatus::ERROR) {
throw RuntimeError(
"Could not stop detector. Returned error status.");
}
pimpl->Parallel(&Module::stopAcquisition, pos);
status = getDetectorStatus().squash(defs::runStatus::RUNNING);
++retries;