filter and cds gain, burst and continuous value to asic changed, bug fix to scanning function addresses in server_funcs.c

This commit is contained in:
2020-07-14 17:09:51 +02:00
parent a096434864
commit 35dbc3813d
14 changed files with 309 additions and 17 deletions

View File

@ -989,6 +989,18 @@ class Detector {
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
void setBurstMode(defs::burstMode value, Positions pos = {});
/** [Gotthard2] */
Result<bool> getCDSGain(Positions pos = {}) const;
/** default disabled */
void setCDSGain(bool value, Positions pos = {});
/** [Gotthard2] */
Result<int> getFilter(Positions pos = {}) const;
/** default 0 */
void setFilter(int value, Positions pos = {});
/** [Gotthard2] */
Result<bool> getCurrentSource(Positions pos = {}) const;

View File

@ -283,7 +283,7 @@
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(DAC_INDEX, mv, {det_id}); \
os << OutString(t) << (!args.empty() ? " mv\n" : "\n"); \
os << OutString(t) << (!args.empty() ? " mv\n" : "\n"); \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
bool mv = false; \
if (args.size() == 2) { \
@ -835,6 +835,8 @@ class CmdProxy {
{"vetophoton", &CmdProxy::VetoPhoton},
{"vetoref", &CmdProxy::VetoReference},
{"burstmode", &CmdProxy::BurstMode},
{"cdsgain", &CmdProxy::cdsgain},
{"filter", &CmdProxy::filter},
{"currentsource", &CmdProxy::currentsource},
{"timingsource", &CmdProxy::timingsource},
{"veto", &CmdProxy::veto},
@ -1119,10 +1121,6 @@ class CmdProxy {
"ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb]["
"Moench] Delay after trigger");
TIME_COMMAND(burstperiod, getBurstPeriod, setBurstPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst "
"period. Only in burst mode and auto timing mode.");
GET_COMMAND(framesl, getNumberOfFramesLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] "
"Number of frames left in acquisition."
@ -1906,6 +1904,18 @@ class CmdProxy {
"timing mode and burst mode. Use timing command to set timing mode and "
"burstmode command to set burst mode.");
TIME_COMMAND(burstperiod, getBurstPeriod, setBurstPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst "
"period. Only in burst mode and auto timing mode.");
INTEGER_COMMAND(cdsgain, getCDSGain, setCDSGain, StringTo<bool>,
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "
"is disabled.");
INTEGER_COMMAND(
filter, getFilter, setFilter, StringTo<int>,
"[0|1|2|3]\n\t[Gotthard2] Set filter resistor. Default is 0.");
INTEGER_COMMAND(currentsource, getCurrentSource, setCurrentSource,
StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable current source. "

View File

@ -1305,6 +1305,22 @@ void Detector::setBurstMode(defs::burstMode value, Positions pos) {
pimpl->Parallel(&Module::setBurstMode, pos, value);
}
Result<bool> Detector::getCDSGain(Positions pos) const {
return pimpl->Parallel(&Module::getCDSGain, pos);
}
void Detector::setCDSGain(bool value, Positions pos) {
pimpl->Parallel(&Module::setCDSGain, pos, value);
}
Result<int> Detector::getFilter(Positions pos) const {
return pimpl->Parallel(&Module::getFilter, pos);
}
void Detector::setFilter(int value, Positions pos) {
pimpl->Parallel(&Module::setFilter, pos, value);
}
Result<bool> Detector::getCurrentSource(Positions pos) const {
return pimpl->Parallel(&Module::getCurrentSource, pos);
}

View File

@ -1534,6 +1534,18 @@ void Module::setBurstMode(slsDetectorDefs::burstMode value) {
}
}
bool Module::getCDSGain() { return sendToDetector<int>(F_GET_CDS_GAIN); }
void Module::setCDSGain(bool value) {
sendToDetector(F_SET_CDS_GAIN, static_cast<int>(value), nullptr);
}
int Module::getFilter() { return sendToDetector<int>(F_GET_FILTER); }
void Module::setFilter(int value) {
sendToDetector(F_SET_FILTER, value, nullptr);
}
bool Module::getCurrentSource() {
return sendToDetector<int>(F_GET_CURRENT_SOURCE);
}

View File

@ -375,6 +375,10 @@ class Module : public virtual slsDetectorDefs {
void setVetoReference(const int gainIndex, const int value);
burstMode getBurstMode();
void setBurstMode(burstMode value);
bool getCDSGain();
void setCDSGain(bool value);
int getFilter();
void setFilter(int value);
bool getCurrentSource();
void setCurrentSource(bool value);
slsDetectorDefs::timingSourceType getTimingSource();

View File

@ -374,6 +374,66 @@ TEST_CASE("burstmode", "[.cmd][.new]") {
}
}
TEST_CASE("cdsgain", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
auto prev_val = det.getCDSGain();
{
std::ostringstream oss;
proxy.Call("cdsgain", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "cdsgain 1\n");
}
{
std::ostringstream oss;
proxy.Call("cdsgain", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "cdsgain 0\n");
}
{
std::ostringstream oss;
proxy.Call("cdsgain", {}, -1, GET, oss);
REQUIRE(oss.str() == "cdsgain 0\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setCDSGain(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("cdsgain", {}, -1, GET));
}
}
TEST_CASE("filter", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
auto prev_val = det.getFilter();
{
std::ostringstream oss;
proxy.Call("filter", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "filter 1\n");
}
{
std::ostringstream oss;
proxy.Call("filter", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "filter 0\n");
}
{
std::ostringstream oss;
proxy.Call("filter", {}, -1, GET, oss);
REQUIRE(oss.str() == "filter 0\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setFilter(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("filter", {}, -1, GET));
}
}
TEST_CASE("currentsource", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);