eiger: always change speed when changing dr

This commit is contained in:
2020-07-28 17:06:46 +02:00
parent df3ae7f409
commit 99ec7f0046

View File

@ -228,7 +228,9 @@ void Module::setExptime(int gateIndex, int64_t value) {
}
}
int64_t Module::getPeriod() const { return sendToDetector<int64_t>(F_GET_PERIOD); }
int64_t Module::getPeriod() const {
return sendToDetector<int64_t>(F_GET_PERIOD);
}
void Module::setPeriod(int64_t value) {
sendToDetector(F_SET_PERIOD, value, nullptr);
@ -276,20 +278,23 @@ void Module::setDynamicRange(int dr) {
sendToReceiver<int>(F_SET_RECEIVER_DYNAMIC_RANGE, retval);
}
// EIGER only, update speed and rate correction when dr changes
if (dr != prev_val) {
// update speed
if (shm()->myDetectorType == EIGER) {
if (dr == 32) {
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with "
"Dynamic Range of 32";
setClockDivider(RUN_CLOCK, 2);
} else if (prev_val == 32) {
} else {
LOG(logINFO) << "Setting Clock to Full Speed for Dynamic Range of "
<< dr;
setClockDivider(RUN_CLOCK, 0);
}
// EIGER only, update speed and rate correction when dr changes
if (dr != prev_val) {
updateRateCorrection();
}
}
}
slsDetectorDefs::timingMode Module::getTimingMode() const {
return sendToDetector<timingMode>(F_SET_TIMING_MODE, GET_FLAG);
@ -831,7 +836,8 @@ void Module::setReceiverSilentMode(bool enable) {
nullptr);
}
slsDetectorDefs::frameDiscardPolicy Module::getReceiverFramesDiscardPolicy() const {
slsDetectorDefs::frameDiscardPolicy
Module::getReceiverFramesDiscardPolicy() const {
return static_cast<frameDiscardPolicy>(
sendToReceiver<int>(F_GET_RECEIVER_DISCARD_POLICY));
}
@ -1103,7 +1109,9 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings,
}
}
std::string Module::getSettingsDir() const { return std::string(shm()->settingsDir); }
std::string Module::getSettingsDir() const {
return std::string(shm()->settingsDir);
}
std::string Module::setSettingsDir(const std::string &dir) {
sls::strcpy_safe(shm()->settingsDir, dir.c_str());
@ -1173,7 +1181,9 @@ void Module::setRateCorrection(int64_t t) {
sendToDetector(F_SET_RATE_CORRECT, t, nullptr);
}
int Module::getReadNLines() const { return sendToDetector<int>(F_GET_READ_N_LINES); }
int Module::getReadNLines() const {
return sendToDetector<int>(F_GET_READ_N_LINES);
}
void Module::setReadNLines(const int value) {
sendToDetector(F_SET_READ_N_LINES, value, nullptr);
@ -1231,7 +1241,8 @@ void Module::setDeactivatedRxrPaddingMode(bool padding) {
}
bool Module::getCounterBit() const {
return (!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, GET_FLAG)));
return (
!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, GET_FLAG)));
}
void Module::setCounterBit(bool cb) {
@ -1295,7 +1306,8 @@ void Module::resetTemperatureEvent() {
}
bool Module::getAutoComparatorDisableMode() const {
return static_cast<bool>(sendToDetector<int>(F_AUTO_COMP_DISABLE, GET_FLAG));
return static_cast<bool>(
sendToDetector<int>(F_AUTO_COMP_DISABLE, GET_FLAG));
}
void Module::setAutoComparatorDisableMode(bool val) {
@ -1750,7 +1762,9 @@ void Module::setCounterMask(uint32_t countermask) {
}
}
int Module::getNumberOfGates() const { return sendToDetector<int>(F_GET_NUM_GATES); }
int Module::getNumberOfGates() const {
return sendToDetector<int>(F_GET_NUM_GATES);
}
void Module::setNumberOfGates(int value) {
sendToDetector(F_SET_NUM_GATES, value, nullptr);