mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
Merge branch 'developer' into fixtests
This commit is contained in:
@ -1091,12 +1091,6 @@ class Detector {
|
||||
* send data or communicated with FEB or BEB */
|
||||
void setActive(const bool active, Positions pos = {});
|
||||
|
||||
/** [Eiger] */
|
||||
Result<bool> getRxPadDeactivatedMode(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger] Pad deactivated modules in receiver. Enabled by default */
|
||||
void setRxPadDeactivatedMode(bool pad, Positions pos = {});
|
||||
|
||||
/** [Eiger] Advanced */
|
||||
Result<bool> getPartialReset(Positions pos = {}) const;
|
||||
|
||||
|
@ -1669,50 +1669,6 @@ std::string CmdProxy::RateCorrection(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Activate(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0, 1] [(optional) padding|nopadding]\n\t[Eiger] 1 is default. "
|
||||
"0 deactivates readout and does not send data. \n\tPadding will "
|
||||
"pad data files for deactivates readouts."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getActive(std::vector<int>{det_id});
|
||||
auto p = det->getRxPadDeactivatedMode(std::vector<int>{det_id});
|
||||
Result<std::string> pResult(p.size());
|
||||
for (unsigned int i = 0; i < p.size(); ++i) {
|
||||
pResult[i] = p[i] ? "padding" : "nopadding";
|
||||
}
|
||||
os << OutString(t) << ' ' << OutString(pResult) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.empty() || args.size() > 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
int t = StringTo<int>(args[0]);
|
||||
det->setActive(t, std::vector<int>{det_id});
|
||||
os << args[0];
|
||||
if (args.size() == 2) {
|
||||
bool p = true;
|
||||
if (args[1] == "nopadding") {
|
||||
p = false;
|
||||
} else if (args[1] != "padding") {
|
||||
throw sls::RuntimeError(
|
||||
"Unknown argument for deactivated padding.");
|
||||
}
|
||||
det->setRxPadDeactivatedMode(p, std::vector<int>{det_id});
|
||||
os << ' ' << args[1];
|
||||
}
|
||||
os << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::PulsePixel(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
|
@ -925,7 +925,7 @@ class CmdProxy {
|
||||
{"interruptsubframe", &CmdProxy::interruptsubframe},
|
||||
{"measuredperiod", &CmdProxy::measuredperiod},
|
||||
{"measuredsubperiod", &CmdProxy::measuredsubperiod},
|
||||
{"activate", &CmdProxy::Activate},
|
||||
{"activate", &CmdProxy::activate},
|
||||
{"partialreset", &CmdProxy::partialreset},
|
||||
{"pulse", &CmdProxy::PulsePixel},
|
||||
{"pulsenmove", &CmdProxy::PulsePixelAndMove},
|
||||
@ -1131,7 +1131,6 @@ class CmdProxy {
|
||||
std::string ZMQHWM(int action);
|
||||
/* Eiger Specific */
|
||||
std::string RateCorrection(int action);
|
||||
std::string Activate(int action);
|
||||
std::string PulsePixel(int action);
|
||||
std::string PulsePixelAndMove(int action);
|
||||
std::string PulseChip(int action);
|
||||
@ -1857,6 +1856,11 @@ class CmdProxy {
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
|
||||
"frame period between last sub frame and previous one.");
|
||||
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
activate, getActive, setActive, StringTo<int>,
|
||||
"[0, 1] \n\t[Eiger] 1 is default. 0 deactivates readout and does not send data.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
partialreset, getPartialReset, setPartialReset, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at "
|
||||
|
@ -1430,13 +1430,6 @@ void Detector::setActive(const bool active, Positions pos) {
|
||||
pimpl->Parallel(&Module::setActivate, pos, active);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getRxPadDeactivatedMode(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getDeactivatedRxrPaddingMode, pos);
|
||||
}
|
||||
|
||||
void Detector::setRxPadDeactivatedMode(bool pad, Positions pos) {
|
||||
pimpl->Parallel(&Module::setDeactivatedRxrPaddingMode, pos, pad);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getPartialReset(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getCounterBit, pos);
|
||||
@ -2138,6 +2131,7 @@ void Detector::setAdditionalJsonParameter(const std::string &key,
|
||||
void Detector::programFPGA(const std::string &fname, Positions pos) {
|
||||
std::vector<char> buffer = pimpl->readProgrammingFile(fname);
|
||||
pimpl->Parallel(&Module::programFPGA, pos, buffer);
|
||||
rebootController(pos);
|
||||
}
|
||||
|
||||
void Detector::resetFPGA(Positions pos) {
|
||||
@ -2160,7 +2154,6 @@ void Detector::updateFirmwareAndServer(const std::string &sname,
|
||||
Positions pos) {
|
||||
pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname);
|
||||
programFPGA(fname, pos);
|
||||
rebootController(pos);
|
||||
}
|
||||
|
||||
Result<uint32_t> Detector::readRegister(uint32_t addr, Positions pos) const {
|
||||
|
@ -1215,12 +1215,7 @@ int Module::getReceiverPort() const { return shm()->rxTCPPort; }
|
||||
|
||||
int Module::setReceiverPort(int port_number) {
|
||||
if (port_number >= 0 && port_number != shm()->rxTCPPort) {
|
||||
if (shm()->useReceiverFlag) {
|
||||
shm()->rxTCPPort =
|
||||
sendToReceiver<int>(F_SET_RECEIVER_PORT, port_number);
|
||||
} else {
|
||||
shm()->rxTCPPort = port_number;
|
||||
}
|
||||
shm()->rxTCPPort = port_number;
|
||||
}
|
||||
return shm()->rxTCPPort;
|
||||
}
|
||||
@ -1559,15 +1554,6 @@ void Module::setActivate(const bool enable) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Module::getDeactivatedRxrPaddingMode() const {
|
||||
return sendToReceiver<int>(F_GET_RECEIVER_DEACTIVATED_PADDING);
|
||||
}
|
||||
|
||||
void Module::setDeactivatedRxrPaddingMode(bool padding) {
|
||||
sendToReceiver(F_SET_RECEIVER_DEACTIVATED_PADDING,
|
||||
static_cast<int>(padding), nullptr);
|
||||
}
|
||||
|
||||
bool Module::getCounterBit() const {
|
||||
return (
|
||||
!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, GET_FLAG)));
|
||||
@ -2567,21 +2553,13 @@ void Module::setADCInvert(uint32_t value) {
|
||||
int Module::getControlPort() const { return shm()->controlPort; }
|
||||
|
||||
void Module::setControlPort(int port_number) {
|
||||
if (strlen(shm()->hostname) > 0) {
|
||||
shm()->controlPort = sendToDetector<int>(F_SET_PORT, port_number);
|
||||
} else {
|
||||
shm()->controlPort = port_number;
|
||||
}
|
||||
shm()->controlPort = port_number;
|
||||
}
|
||||
|
||||
int Module::getStopPort() const { return shm()->stopPort; }
|
||||
|
||||
void Module::setStopPort(int port_number) {
|
||||
if (strlen(shm()->hostname) > 0) {
|
||||
shm()->stopPort = sendToDetectorStop<int>(F_SET_PORT, port_number);
|
||||
} else {
|
||||
shm()->stopPort = port_number;
|
||||
}
|
||||
shm()->stopPort = port_number;
|
||||
}
|
||||
|
||||
bool Module::getLockDetector() const {
|
||||
@ -3512,12 +3490,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
<< " returned error: " << client.readErrorMessage();
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
if (moduleIndex == 0) {
|
||||
LOG(logINFO) << "Copied to flash and checksum verified";
|
||||
}
|
||||
|
||||
LOG(logINFO) << "FPGA programmed successfully";
|
||||
rebootController();
|
||||
}
|
||||
|
||||
void Module::programFPGAviaNios(std::vector<char> buffer) {
|
||||
@ -3595,6 +3568,5 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
LOG(logINFO) << "FPGA programmed successfully";
|
||||
rebootController();
|
||||
}
|
||||
} // namespace sls
|
||||
|
@ -349,8 +349,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
int64_t getMeasuredSubFramePeriod() const;
|
||||
bool getActivate() const;
|
||||
void setActivate(const bool enable);
|
||||
bool getDeactivatedRxrPaddingMode() const;
|
||||
void setDeactivatedRxrPaddingMode(bool padding);
|
||||
bool getCounterBit() const;
|
||||
void setCounterBit(bool cb);
|
||||
void pulsePixel(int n = 0, int x = 0, int y = 0);
|
||||
|
@ -190,7 +190,6 @@ TEST_CASE("rx_tcpport", "[.cmd][.rx]") {
|
||||
proxy.Call("rx_tcpport", {}, i, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_tcpport " + std::to_string(port + i) + '\n');
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("rx_tcpport", {"15"}, -1, PUT));
|
||||
port = 5754;
|
||||
proxy.Call("rx_tcpport", {std::to_string(port)}, -1, PUT);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
|
Reference in New Issue
Block a user