mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
added drlist and timinglist, moved daclist and settingslist from cmdprozy.cpp to .h
This commit is contained in:
parent
de69e666a9
commit
d4e11e56ea
@ -215,6 +215,9 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setDynamicRange(int value);
|
void setDynamicRange(int value);
|
||||||
|
|
||||||
|
/** list of possible dynamic ranges for this detector */
|
||||||
|
std::vector<int> getDynamicRangeList() const;
|
||||||
|
|
||||||
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,6 +228,9 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setTimingMode(defs::timingMode value, Positions pos = {});
|
void setTimingMode(defs::timingMode value, Positions pos = {});
|
||||||
|
|
||||||
|
/** list of possible timing modes for this detector */
|
||||||
|
std::vector<defs::timingMode> getTimingModeList() const;
|
||||||
|
|
||||||
/** [Eiger][Jungfrau] */
|
/** [Eiger][Jungfrau] */
|
||||||
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
|
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
|
||||||
|
|
||||||
|
@ -332,25 +332,6 @@ std::string CmdProxy::DetectorSize(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CmdProxy::SettingsList(int action) {
|
|
||||||
std::ostringstream os;
|
|
||||||
os << cmd << ' ';
|
|
||||||
if (action == defs::HELP_ACTION) {
|
|
||||||
os << "\n\tList of settings implemented for this detector" << '\n';
|
|
||||||
} else if (action == defs::GET_ACTION) {
|
|
||||||
if (!args.empty()) {
|
|
||||||
WrongNumberOfParameters(0);
|
|
||||||
}
|
|
||||||
auto t = det->getSettingsList();
|
|
||||||
os << ToString(t) << "\n";
|
|
||||||
} else if (action == defs::PUT_ACTION) {
|
|
||||||
throw sls::RuntimeError("Cannot put");
|
|
||||||
} else {
|
|
||||||
throw sls::RuntimeError("Unknown action");
|
|
||||||
}
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CmdProxy::GapPixels(int action) {
|
std::string CmdProxy::GapPixels(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
@ -921,26 +902,6 @@ std::string CmdProxy::Dac(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CmdProxy::DacList(int action) {
|
|
||||||
std::ostringstream os;
|
|
||||||
os << cmd << ' ';
|
|
||||||
if (action == defs::HELP_ACTION) {
|
|
||||||
os << "\n\tGets the list of commands for every dac for this detector."
|
|
||||||
<< '\n';
|
|
||||||
} else if (action == defs::GET_ACTION) {
|
|
||||||
if (!args.empty()) {
|
|
||||||
WrongNumberOfParameters(0);
|
|
||||||
}
|
|
||||||
auto t = det->getDacList();
|
|
||||||
os << ToString(t) << '\n';
|
|
||||||
} else if (action == defs::PUT_ACTION) {
|
|
||||||
throw sls::RuntimeError("Cannot put");
|
|
||||||
} else {
|
|
||||||
throw sls::RuntimeError("Unknown action");
|
|
||||||
}
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CmdProxy::DacValues(int action) {
|
std::string CmdProxy::DacValues(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
|
@ -414,6 +414,27 @@
|
|||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** get only no id (vector, not result) */
|
||||||
|
#define GET_COMMAND_NOID(CMDNAME, GETFCN, HLPSTR) \
|
||||||
|
std::string CMDNAME(const int action) { \
|
||||||
|
std::ostringstream os; \
|
||||||
|
os << cmd << ' '; \
|
||||||
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
|
os << HLPSTR << '\n'; \
|
||||||
|
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||||
|
if (!args.empty()) { \
|
||||||
|
WrongNumberOfParameters(0); \
|
||||||
|
} \
|
||||||
|
auto t = det->GETFCN(); \
|
||||||
|
os << sls::ToString(t) << '\n'; \
|
||||||
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
|
throw sls::RuntimeError("Cannot put"); \
|
||||||
|
} else { \
|
||||||
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
|
} \
|
||||||
|
return os.str(); \
|
||||||
|
}
|
||||||
|
|
||||||
/** get only hex*/
|
/** get only hex*/
|
||||||
#define GET_COMMAND_HEX(CMDNAME, GETFCN, HLPSTR) \
|
#define GET_COMMAND_HEX(CMDNAME, GETFCN, HLPSTR) \
|
||||||
std::string CMDNAME(const int action) { \
|
std::string CMDNAME(const int action) { \
|
||||||
@ -627,7 +648,7 @@ class CmdProxy {
|
|||||||
{"detectornumber", &CmdProxy::detectornumber},
|
{"detectornumber", &CmdProxy::detectornumber},
|
||||||
{"type", &CmdProxy::type},
|
{"type", &CmdProxy::type},
|
||||||
{"detsize", &CmdProxy::DetectorSize},
|
{"detsize", &CmdProxy::DetectorSize},
|
||||||
{"settingslist", &CmdProxy::SettingsList},
|
{"settingslist", &CmdProxy::settingslist},
|
||||||
{"settings", &CmdProxy::settings},
|
{"settings", &CmdProxy::settings},
|
||||||
{"trimbits", &CmdProxy::trimbits},
|
{"trimbits", &CmdProxy::trimbits},
|
||||||
{"trimval", &CmdProxy::trimval},
|
{"trimval", &CmdProxy::trimval},
|
||||||
@ -645,7 +666,9 @@ class CmdProxy {
|
|||||||
{"delayl", &CmdProxy::delayl},
|
{"delayl", &CmdProxy::delayl},
|
||||||
{"periodl", &CmdProxy::periodl},
|
{"periodl", &CmdProxy::periodl},
|
||||||
{"dr", &CmdProxy::DynamicRange},
|
{"dr", &CmdProxy::DynamicRange},
|
||||||
|
{"drlist", &CmdProxy::drlist},
|
||||||
{"timing", &CmdProxy::timing},
|
{"timing", &CmdProxy::timing},
|
||||||
|
{"timinglist", &CmdProxy::timinglist},
|
||||||
{"speed", &CmdProxy::Speed},
|
{"speed", &CmdProxy::Speed},
|
||||||
{"adcphase", &CmdProxy::Adcphase},
|
{"adcphase", &CmdProxy::Adcphase},
|
||||||
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
||||||
@ -737,7 +760,7 @@ class CmdProxy {
|
|||||||
{"ibias_sfp", &CmdProxy::ibias_sfp},
|
{"ibias_sfp", &CmdProxy::ibias_sfp},
|
||||||
|
|
||||||
{"dac", &CmdProxy::Dac},
|
{"dac", &CmdProxy::Dac},
|
||||||
{"daclist", &CmdProxy::DacList},
|
{"daclist", &CmdProxy::daclist},
|
||||||
{"dacvalues", &CmdProxy::DacValues},
|
{"dacvalues", &CmdProxy::DacValues},
|
||||||
|
|
||||||
/* on chip dacs */
|
/* on chip dacs */
|
||||||
@ -994,7 +1017,6 @@ class CmdProxy {
|
|||||||
std::string PackageVersion(int action);
|
std::string PackageVersion(int action);
|
||||||
std::string ClientVersion(int action);
|
std::string ClientVersion(int action);
|
||||||
std::string DetectorSize(int action);
|
std::string DetectorSize(int action);
|
||||||
std::string SettingsList(int action);
|
|
||||||
std::string GapPixels(int action);
|
std::string GapPixels(int action);
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
std::string Acquire(int action);
|
std::string Acquire(int action);
|
||||||
@ -1011,7 +1033,6 @@ class CmdProxy {
|
|||||||
/** temperature */
|
/** temperature */
|
||||||
/* dacs */
|
/* dacs */
|
||||||
std::string Dac(int action);
|
std::string Dac(int action);
|
||||||
std::string DacList(int action);
|
|
||||||
std::string DacValues(int action);
|
std::string DacValues(int action);
|
||||||
/* acquisition */
|
/* acquisition */
|
||||||
std::string ReceiverStatus(int action);
|
std::string ReceiverStatus(int action);
|
||||||
@ -1103,6 +1124,9 @@ class CmdProxy {
|
|||||||
GET_COMMAND(type, getDetectorType,
|
GET_COMMAND(type, getDetectorType,
|
||||||
"\n\tSerial number or MAC of detector (hex).");
|
"\n\tSerial number or MAC of detector (hex).");
|
||||||
|
|
||||||
|
GET_COMMAND_NOID(settingslist, getSettingsList,
|
||||||
|
"\n\tList of settings implemented for this detector.");
|
||||||
|
|
||||||
INTEGER_COMMAND(settings, getSettings, setSettings,
|
INTEGER_COMMAND(settings, getSettings, setSettings,
|
||||||
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||||
"[standard, fast, highgain, dynamicgain, lowgain, "
|
"[standard, fast, highgain, dynamicgain, lowgain, "
|
||||||
@ -1172,6 +1196,9 @@ class CmdProxy {
|
|||||||
" Period left for current frame."
|
" Period left for current frame."
|
||||||
"\n\t[Gotthard2] only in continuous mode.");
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
|
GET_COMMAND_NOID(drlist, getDynamicRangeList,
|
||||||
|
"\n\tGets the list of dynamic ranges for this detector.");
|
||||||
|
|
||||||
INTEGER_COMMAND(timing, getTimingMode, setTimingMode,
|
INTEGER_COMMAND(timing, getTimingMode, setTimingMode,
|
||||||
sls::StringTo<slsDetectorDefs::timingMode>,
|
sls::StringTo<slsDetectorDefs::timingMode>,
|
||||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
|
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
|
||||||
@ -1180,6 +1207,9 @@ class CmdProxy {
|
|||||||
"[auto|trigger|gating|trigger_gating]\n\t[Eiger] "
|
"[auto|trigger|gating|trigger_gating]\n\t[Eiger] "
|
||||||
"[auto|trigger|gating|burst_trigger]");
|
"[auto|trigger|gating|burst_trigger]");
|
||||||
|
|
||||||
|
GET_COMMAND_NOID(timinglist, getTimingModeList,
|
||||||
|
"\n\tGets the list of timing modes for this detector.");
|
||||||
|
|
||||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||||
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
|
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
|
||||||
"ADC clock.");
|
"ADC clock.");
|
||||||
@ -1510,6 +1540,10 @@ class CmdProxy {
|
|||||||
DAC_COMMAND(ibias_sfp, getDAC, setDAC, defs::IBIAS_SFP,
|
DAC_COMMAND(ibias_sfp, getDAC, setDAC, defs::IBIAS_SFP,
|
||||||
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 7");
|
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 7");
|
||||||
|
|
||||||
|
GET_COMMAND_NOID(
|
||||||
|
daclist, getDacList,
|
||||||
|
"\n\tGets the list of commands for every dac for this detector.");
|
||||||
|
|
||||||
/* on chip dacs */
|
/* on chip dacs */
|
||||||
INTEGER_USER_IND_COMMAND(
|
INTEGER_USER_IND_COMMAND(
|
||||||
vchip_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>,
|
vchip_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>,
|
||||||
|
@ -285,6 +285,17 @@ void Detector::setDynamicRange(int value) {
|
|||||||
updateRxRateCorrections();
|
updateRxRateCorrections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<int> Detector::getDynamicRangeList() const {
|
||||||
|
switch (getDetectorType().squash()) {
|
||||||
|
case defs::EIGER:
|
||||||
|
return std::vector<int>{4, 8, 16, 32};
|
||||||
|
case defs::MYTHEN3:
|
||||||
|
return std::vector<int>{8, 16, 32};
|
||||||
|
default:
|
||||||
|
return std::vector<int>{16};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Result<defs::timingMode> Detector::getTimingMode(Positions pos) const {
|
Result<defs::timingMode> Detector::getTimingMode(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getTimingMode, pos);
|
return pimpl->Parallel(&Module::getTimingMode, pos);
|
||||||
}
|
}
|
||||||
@ -293,6 +304,22 @@ void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setTimingMode, pos, value);
|
pimpl->Parallel(&Module::setTimingMode, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<defs::timingMode> Detector::getTimingModeList() const {
|
||||||
|
switch (getDetectorType().squash()) {
|
||||||
|
case defs::EIGER:
|
||||||
|
return std::vector<defs::timingMode>{defs::AUTO_TIMING,
|
||||||
|
defs::TRIGGER_EXPOSURE,
|
||||||
|
defs::GATED, defs::BURST_TRIGGER};
|
||||||
|
case defs::MYTHEN3:
|
||||||
|
return std::vector<defs::timingMode>{defs::AUTO_TIMING,
|
||||||
|
defs::TRIGGER_EXPOSURE,
|
||||||
|
defs::GATED, defs::TRIGGER_GATED};
|
||||||
|
default:
|
||||||
|
return std::vector<defs::timingMode>{defs::AUTO_TIMING,
|
||||||
|
defs::TRIGGER_EXPOSURE};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
||||||
auto res = pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
|
auto res = pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
|
||||||
Result<defs::speedLevel> speedResult(res.size());
|
Result<defs::speedLevel> speedResult(res.size());
|
||||||
|
@ -493,6 +493,13 @@ TEST_CASE("dr", "[.cmd][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("drlist", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("drlist", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("drlist", {}, -1, PUT));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("timing", "[.cmd][.new]") {
|
TEST_CASE("timing", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -555,6 +562,13 @@ TEST_CASE("timing", "[.cmd][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("timinglist", "[.cmd][.new]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("timinglist", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("timinglist", {}, -1, PUT));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("speed", "[.cmd][.new]") {
|
TEST_CASE("speed", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user