startdetector (non blocking) is allowed at modular level

This commit is contained in:
2022-02-21 09:42:24 +01:00
parent 6d794cdf4b
commit 5e97bcde7f
5 changed files with 22 additions and 18 deletions

View File

@ -1516,7 +1516,7 @@ class CmdProxy {
"\n\tStops receiver listener for detector data packets and closes "
"current data file (if file write enabled).");
EXECUTE_SET_COMMAND_NOID(
EXECUTE_SET_COMMAND(
start, startDetector,
"\n\tStarts detector acquisition. Status changes to RUNNING or WAITING "
"and automatically returns to idle at the end of acquisition. If the "

View File

@ -756,22 +756,24 @@ void Detector::startReceiver() { pimpl->Parallel(&Module::startReceiver, {}); }
void Detector::stopReceiver() { pimpl->Parallel(&Module::stopReceiver, {}); }
void Detector::startDetector() {
auto detector_type = getDetectorType().squash();
void Detector::startDetector(Positions pos) {
auto detector_type = getDetectorType(pos).squash();
if (detector_type == defs::MYTHEN3 && size() > 1) {
auto is_master = getMaster();
int masterPosition = 0;
std::vector<int> slaves;
for (int i = 0; i < size(); ++i) {
if (is_master[i])
std::vector<int> slaves(pos);
auto is_master = getMaster(pos);
int masterPosition = -1;
for (unsigned int i = 0; i < is_master.size(); ++i) {
if (is_master[i]) {
masterPosition = i;
else
slaves.push_back(i);
slaves.erase(pos.begin() + i);
}
}
pimpl->Parallel(&Module::startAcquisition, pos);
if (masterPosition != -1) {
pimpl->Parallel(&Module::startAcquisition, {masterPosition});
}
pimpl->Parallel(&Module::startAcquisition, slaves);
pimpl->Parallel(&Module::startAcquisition, {masterPosition});
} else {
pimpl->Parallel(&Module::startAcquisition, {});
pimpl->Parallel(&Module::startAcquisition, pos);
}
}