This commit is contained in:
2020-07-17 17:33:43 +02:00
parent 546bef5e5a
commit b7cb341ee3
15 changed files with 212 additions and 176 deletions

View File

@ -259,6 +259,38 @@ int64_t Module::getPeriodLeft() const {
return sendToDetectorStop<int64_t>(F_GET_PERIOD_LEFT);
}
int Module::getDynamicRange() {
return sendToDetector<int>(F_SET_DYNAMIC_RANGE, GET_FLAG);
}
void Module::setDynamicRange(int n) {
int prev_val = n;
if (shm()->myDetectorType == EIGER) {
prev_val = getDynamicRange();
}
auto retval = sendToDetector<int>(F_SET_DYNAMIC_RANGE, n);
if (shm()->useReceiverFlag) {
int arg = retval;
sendToReceiver<int>(F_SET_RECEIVER_DYNAMIC_RANGE, arg);
}
// changes in dr
if (n != prev_val) {
// update speed for usability
if (n == 32) {
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with "
"Dynamic Range of 32";
setClockDivider(RUN_CLOCK, 2);
} else if (prev_val == 32) {
LOG(logINFO) << "Setting Clock to Full Speed for Dynamic Range of "
<< n;
setClockDivider(RUN_CLOCK, 0);
}
updateRateCorrection();
}
}
slsDetectorDefs::timingMode Module::getTimingMode() {
return sendToDetector<timingMode>(F_SET_TIMING_MODE, GET_FLAG);
}
@ -1017,38 +1049,6 @@ void Module::setClientStreamingIP(const sls::IpAddr ip) {
// Eiger Specific
int Module::getDynamicRange() {
return sendToDetector<int>(F_SET_DYNAMIC_RANGE, GET_FLAG);
}
void Module::setDynamicRange(int n) {
int prev_val = n;
if (shm()->myDetectorType == EIGER) {
prev_val = getDynamicRange();
}
auto retval = sendToDetector<int>(F_SET_DYNAMIC_RANGE, n);
if (shm()->useReceiverFlag) {
int arg = retval;
sendToReceiver<int>(F_SET_RECEIVER_DYNAMIC_RANGE, arg);
}
// changes in dr
if (n != prev_val) {
// update speed for usability
if (n == 32) {
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with "
"Dynamic Range of 32";
setClockDivider(RUN_CLOCK, 2);
} else if (prev_val == 32) {
LOG(logINFO) << "Setting Clock to Full Speed for Dynamic Range of "
<< n;
setClockDivider(RUN_CLOCK, 0);
}
updateRateCorrection();
}
}
int64_t Module::getSubExptime() {
return sendToDetector<int64_t>(F_GET_SUB_EXPTIME);
}