merge fix

This commit is contained in:
2021-10-08 09:50:36 +02:00
45 changed files with 272 additions and 398 deletions

View File

@ -1108,12 +1108,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;

View File

@ -207,7 +207,8 @@ std::string CmdProxy::Acquire(int action) {
"detector acquisition for number of frames set\n\t- monitors "
"detector status from running to idle\n\t- stops the receiver "
"listener (if enabled)\n\t- increments file index if file write "
"enabled\n\t- resets acquiring flag";
"enabled\n\t- resets acquiring flag"
<< '\n';
} else {
if (det->empty()) {
throw sls::RuntimeError(
@ -964,9 +965,9 @@ std::string CmdProxy::CurrentSource(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[0|1]\n\t[Gotthard2] Enable or disable current source. Default "
"is disabled.\n[0|1] [fix|nofix] [select source] [(only for "
"chipv1.1)normal|low]\n\t[Jungfrau] Disable or enable current "
os << "\n\t[0|1]\n\t\t[Gotthard2] Enable or disable current source. Default "
"is disabled.\n\t[0|1] [fix|nofix] [select source] [(only for "
"chipv1.1)normal|low]\n\t\t[Jungfrau] Disable or enable current "
"source with some parameters. The select source is 0-63 for "
"chipv1.0 and a 64 bit mask for chipv1.1. To disable, one needs "
"only one argument '0'."
@ -1337,9 +1338,9 @@ std::string CmdProxy::Trigger(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "trigger") {
os << "[Eiger][Mythen3] Sends software trigger signal to detector";
os << "\n\t[Eiger][Mythen3] Sends software trigger signal to detector";
} else if (cmd == "blockingtrigger") {
os << "[Eiger] Sends software trigger signal to detector and "
os << "\n\t[Eiger] Sends software trigger signal to detector and "
"blocks till "
"the frames are sent out for that trigger.";
} else {
@ -1423,9 +1424,9 @@ std::string CmdProxy::UDPDestinationList(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[entry=n_val] [ip=x.x.x.x] [(optional)ip2=x.x.x.x] "
"\n[mac=xx:xx:xx:xx:xx:xx] "
"[(optional)mac2=xx:xx:xx:xx:xx:xx]\n[port=value] "
os << "[ip=x.x.x.x] [(optional)ip2=x.x.x.x] "
"\n\t[mac=xx:xx:xx:xx:xx:xx] "
"[(optional)mac2=xx:xx:xx:xx:xx:xx]\n\t[port=value] "
"[(optional)port2=value\n\tThe order of ip, mac and port does "
"not matter. entry_value can be >0 only for Eiger and Jungfrau "
"where round robin is implemented. If 'auto' used, then ip is "
@ -1607,8 +1608,8 @@ std::string CmdProxy::ZMQHWM(int action) {
if (action == defs::HELP_ACTION) {
os << "[n_limit] \n\tClient's zmq receive high water mark. Default is "
"the zmq library's default (1000), can also be set here using "
"-1. \n This is a high number and can be set to 2 for gui "
"purposes. \n One must also set the receiver's send high water "
"-1. \n\tThis is a high number and can be set to 2 for gui "
"purposes. \n\tOne must also set the receiver's send high water "
"mark to similar value. Final effect is sum of them.\n\t Setting "
"it via command line is useful only before zmq enabled (before "
"opening gui)."
@ -1668,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 << ' ';

View File

@ -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);
@ -1206,7 +1205,7 @@ class CmdProxy {
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
"Serial number of detector.");
GET_COMMAND_HEX(
GET_COMMAND(
moduleid, getModuleId,
"\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
"that is streamed out in the UDP header of the detector. Picked up from a file on the module.");
@ -1381,9 +1380,9 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID(
readnrows, getReadNRows, setReadNRows, StringTo<int>,
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
"\n\t[1-256]\n\t\t[Eiger] Number of rows to readout per half module "
"starting from the centre. Options: 0 - 256. 256 is default. The "
"permissible values depend on dynamic range and 10Gbe enabled.\n[8-512 (multiple of 8)]\n\t[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.");
"permissible values depend on dynamic range and 10Gbe enabled.\n\t[8-512 (multiple of 8)]\n\t\t[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.");
/** temperature */
GET_COMMAND_NOID(
@ -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 "

View File

@ -1450,13 +1450,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);
@ -2158,6 +2151,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) {
@ -2180,7 +2174,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 {

View File

@ -1312,12 +1312,7 @@ int Module::getReceiverPort(const int rxIndex) const { return shm()->receivers[r
int Module::setReceiverPort(int port_number, const int rxIndex) {
if (port_number >= 0 && port_number != shm()->receivers[rxIndex].tcpPort) {
if (shm()->useReceiverFlag) {
shm()->receivers[rxIndex].tcpPort =
sendToReceiver<int>(rxIndex, F_SET_RECEIVER_PORT, port_number);
} else {
shm()->receivers[rxIndex].tcpPort = port_number;
}
shm()->receivers[rxIndex].tcpPort = port_number;
}
return shm()->receivers[rxIndex].tcpPort;
}
@ -1707,17 +1702,6 @@ void Module::setActivate(const bool enable) {
}
}
bool Module::getDeactivatedRxrPaddingMode() const {
const int rxIndex = 0;
return sendToReceiver<int>(rxIndex, F_GET_RECEIVER_DEACTIVATED_PADDING);
}
void Module::setDeactivatedRxrPaddingMode(bool padding) {
const int rxIndex = -1;
sendToReceiver(rxIndex, 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)));
@ -2738,21 +2722,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 {
@ -3712,12 +3688,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) {
@ -3795,6 +3766,5 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
throw RuntimeError(os.str());
}
LOG(logINFO) << "FPGA programmed successfully";
rebootController();
}
} // namespace sls

View File

@ -357,8 +357,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);

View File

@ -55,7 +55,7 @@ TEST_CASE("defaultpattern", "[.cmd]") {
REQUIRE_NOTHROW(proxy.Call("defaultpattern", {}, -1, PUT));
} else {
REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, GET));
REQUIRE_NOTHROW(proxy.Call("defaultpattern", {}, -1, PUT));
REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, PUT));
}
}

View File

@ -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) {

View File

@ -1754,29 +1754,29 @@ TEST_CASE("defaultdac", "[.cmd]") {
}
}
if (det_type == defs::JUNGFRAU) {
std::vector<defs::dacIndex> daclist = {defs::VB_COMP, defs::VREF_DS,
std::vector<defs::dacIndex> daclist = {defs::VREF_PRECH, defs::VREF_DS,
defs::VREF_COMP};
for (auto it : daclist) {
auto dacname = sls::ToString(it);
auto prev_val = det.getDefaultDac(it, defs::DYNAMICGAIN);
auto prev_val = det.getDefaultDac(it, defs::GAIN0);
{
std::ostringstream oss;
proxy.Call("defaultdac", {dacname, "1000", "dynamicgain"}, -1,
proxy.Call("defaultdac", {dacname, "1000", "gain0"}, -1,
PUT, oss);
REQUIRE(oss.str() ==
std::string("defaultdac ") + dacname +
std::string(" dynamicgain 1000\n"));
std::string(" gain0 1000\n"));
}
{
std::ostringstream oss;
proxy.Call("defaultdac", {dacname, "dynamicgain"}, -1, GET,
proxy.Call("defaultdac", {dacname, "gain0"}, -1, GET,
oss);
REQUIRE(oss.str() ==
std::string("defaultdac ") + dacname +
std::string(" dynamicgain 1000\n"));
std::string(" gain0 1000\n"));
}
for (int i = 0; i != det.size(); ++i) {
det.setDefaultDac(it, prev_val[i], defs::DYNAMICGAIN, {i});
det.setDefaultDac(it, prev_val[i], defs::GAIN0, {i});
}
}
}
@ -2240,7 +2240,8 @@ TEST_CASE("udp_cleardst", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
REQUIRE_THROWS(proxy.Call("udp_cleardst", {}, -1, GET));
REQUIRE_NOTHROW(proxy.Call("udp_cleardst", {}, -1, PUT));
/* dont clear all udp destinations */
/*REQUIRE_NOTHROW(proxy.Call("udp_cleardst", {}, -1, PUT));*/
}
TEST_CASE("udp_firstdst", "[.cmd]") {
@ -2252,18 +2253,20 @@ TEST_CASE("udp_firstdst", "[.cmd]") {
{
std::ostringstream oss;
proxy.Call("udp_firstdst", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "udp_firstdst 10\n");
REQUIRE(oss.str() == "udp_firstdst 0\n");
}
{
std::ostringstream oss;
proxy.Call("udp_firstdst", {}, -1, GET, oss);
REQUIRE(oss.str() == "udp_firstdst 0\n");
}
/*
{
std::ostringstream oss;
proxy.Call("udp_firstdst", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "udp_firstdst 1\n");
}
*/
REQUIRE_THROWS(proxy.Call("udp_firstdst", {"33"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
@ -2291,7 +2294,9 @@ TEST_CASE("udp_srcmac", "[.cmd]") {
REQUIRE(oss.str() == "udp_srcmac 00:50:c2:42:34:12\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setSourceUDPMAC(prev_val[i], {i});
if (prev_val[i].str() != "00:00:00:00:00:00") {
det.setSourceUDPMAC(prev_val[i], {i});
}
}
}
@ -2361,7 +2366,9 @@ TEST_CASE("udp_srcmac2", "[.cmd]") {
REQUIRE(oss.str() == "udp_srcmac2 00:50:c2:42:34:12\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setSourceUDPMAC2(prev_val[i], {i});
if (prev_val[i].str() != "00:00:00:00:00:00") {
det.setSourceUDPMAC2(prev_val[i], {i});
}
}
} else {
REQUIRE_THROWS(proxy.Call("udp_srcmac2", {}, -1, GET));