This commit is contained in:
2020-05-08 16:31:26 +02:00
parent 9c7ff84b73
commit 13c1f7c2d6
14 changed files with 377 additions and 203 deletions

View File

@ -791,7 +791,7 @@ class Detector {
Result<bool> getActive(Positions pos = {}) const;
/** [Eiger] */
void setActive(bool active, Positions pos = {});
void setActive(const bool active, Positions pos = {});
/** [Eiger] */
Result<bool> getRxPadDeactivatedMode(Positions pos = {}) const;

View File

@ -1031,11 +1031,11 @@ Result<ns> Detector::getMeasuredSubFramePeriod(Positions pos) const {
}
Result<bool> Detector::getActive(Positions pos) const {
return pimpl->Parallel(&Module::activate, pos, -1);
return pimpl->Parallel(&Module::getActivate, pos);
}
void Detector::setActive(bool active, Positions pos) {
pimpl->Parallel(&Module::activate, pos, static_cast<int>(active));
void Detector::setActive(const bool active, Positions pos) {
pimpl->Parallel(&Module::setActivate, pos, active);
}
Result<bool> Detector::getRxPadDeactivatedMode(Positions pos) const {

View File

@ -515,7 +515,7 @@ void DetectorImpl::readFrameFromReceiver() {
nDetPixelsX = nX * nPixelsX;
nDetPixelsY = nY * nPixelsY;
// det type
eiger = (zHeader.detType == static_cast<int>(3))
eiger = (zHeader.detType == EIGER)
? true
: false; // to be changed to EIGER when
// firmware updates its header data

View File

@ -346,19 +346,19 @@ void Module::setHostname(const std::string &hostname,
sls::strcpy_safe(shm()->hostname, hostname.c_str());
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.close();
LOG(logINFO) << "Checking Detector Version Compatibility";
if (!initialChecks) {
try {
checkDetectorVersionCompatibility();
} catch (const DetectorError &e) {
LOG(logWARNING) << "Bypassing Initial Checks at your own risk!";
}
} else {
try {
checkDetectorVersionCompatibility();
LOG(logINFO) << "Detector Version Compatibility - Success";
} catch (const DetectorError &e) {
if (!initialChecks) {
LOG(logWARNING) << "Bypassing Initial Checks at your own risk!";
} else {
throw;
}
}
if (shm()->myDetectorType == EIGER) {
setActivate(true);
}
LOG(logINFO) << "Detector connecting - updating!";
}
std::string Module::getHostname() const { return shm()->hostname; }
@ -2457,16 +2457,29 @@ void Module::writeAdcRegister(uint32_t addr, uint32_t val) {
sendToDetector(F_WRITE_ADC_REG, args, nullptr);
}
int Module::activate(int enable) {
bool Module::getActivate() {
int retval = -1, retval2 = -1;
int arg = -1;
sendToDetector(F_ACTIVATE, arg, retval);
sendToDetectorStop(F_ACTIVATE, arg, retval2);
if (retval != retval2) {
std::ostringstream oss;
oss << "Inconsistent activate state. Control Server: " << retval
<< ". Stop Server: " << retval2;
throw RuntimeError(oss.str());
}
return retval;
}
void Module::setActivate(const bool enable) {
int retval = -1;
int arg = static_cast<int>(enable);
LOG(logDEBUG1) << "Setting activate flag to " << enable;
sendToDetector(F_ACTIVATE, enable, retval);
sendToDetectorStop(F_ACTIVATE, enable, retval);
LOG(logDEBUG1) << "Activate: " << retval;
sendToDetector(F_ACTIVATE, arg, retval);
sendToDetectorStop(F_ACTIVATE, arg, retval);
if (shm()->useReceiverFlag) {
sendToReceiver(F_RECEIVER_ACTIVATE, retval, nullptr);
}
return retval;
}
bool Module::getDeactivatedRxrPaddingMode() {

View File

@ -1095,12 +1095,8 @@ class Module : public virtual slsDetectorDefs {
*/
void writeAdcRegister(uint32_t addr, uint32_t val);
/**
* Activates/Deactivates the detector (Eiger only)
* @param enable active (1) or inactive (0), -1 gets
* @returns 0 (inactive) or 1 (active)for activate mode
*/
int activate(int const enable = -1);
bool getActivate();
void setActivate(const bool enable);
bool getDeactivatedRxrPaddingMode();