mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 08:38:00 +02:00
Mythen3 improved synchronization (#231)
Disabling scans for multi module Mythen3, since there is no feedback of the detectors being ready startDetector first starts the slaves then the master acquire firs calls startDetector for the slaves then acquire on the master getMaster to read back from hardware which one is master
This commit is contained in:
@ -1056,11 +1056,15 @@ void DetectorImpl::registerDataCallback(void (*userCallback)(detectorData *,
|
||||
}
|
||||
|
||||
int DetectorImpl::acquire() {
|
||||
|
||||
// ensure acquire isnt started multiple times by same client
|
||||
if (!isAcquireReady()) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// We need this to handle Mythen3 synchronization
|
||||
auto detector_type = Parallel(&Module::getDetectorType, {}).squash();
|
||||
|
||||
try {
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
@ -1088,7 +1092,25 @@ int DetectorImpl::acquire() {
|
||||
|
||||
// start and read all
|
||||
try {
|
||||
Parallel(&Module::startAndReadAll, {});
|
||||
if(detector_type == defs::MYTHEN3 && detectors.size() > 1){
|
||||
//Multi module mythen
|
||||
std::vector<int> master;
|
||||
std::vector<int> slaves;
|
||||
auto is_master = Parallel(&Module::isMaster, {});
|
||||
slaves.reserve(detectors.size()-1); //check this one!!
|
||||
for (size_t i = 0; i<detectors.size(); ++i){
|
||||
if(is_master[i])
|
||||
master.push_back(i);
|
||||
else
|
||||
slaves.push_back(i);
|
||||
}
|
||||
Parallel(&Module::startAcquisition, slaves);
|
||||
Parallel(&Module::startAndReadAll, master);
|
||||
}else{
|
||||
//Normal acquire
|
||||
Parallel(&Module::startAndReadAll, {});
|
||||
}
|
||||
|
||||
} catch (...) {
|
||||
if (receiver)
|
||||
Parallel(&Module::stopReceiver, {});
|
||||
|
Reference in New Issue
Block a user