Merge branch 'developer' into g2cont

This commit is contained in:
maliakal_d 2020-09-24 17:18:04 +02:00
commit c01ce3d514
21 changed files with 545 additions and 420 deletions

View File

@ -342,7 +342,7 @@ class Detector(CppDetectorApi):
def framesl(self):
"""
[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of frames left in acquisition.\n
[Gotthard2] only in continuous mode.
[Gotthard2] only in continuous auto mode.
:setter: Not Implemented
"""
return self.getNumberOfFramesLeft()
@ -1492,7 +1492,7 @@ class Detector(CppDetectorApi):
[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of triggers left in acquisition.\n
Note
----
[Gotthard2] only in continuous mode.
Only when external trigger used.
:setter: Not Implemented
"""
return self.getNumberOfTriggersLeft()
@ -2119,6 +2119,18 @@ class Detector(CppDetectorApi):
def bursts(self, value):
self.setNumberOfBursts(value)
@property
@element
def burstsl(self):
"""
[Gotthard2] Number of bursts left in acquisition.\n
Note
----
Only in burst auto mode.
:setter: Not Implemented
"""
return self.getNumberOfBurstsLeft()
@property
@element
def filter(self):

View File

@ -965,6 +965,10 @@ void init_det(py::module &m) {
(void (Detector::*)(sls::ns, sls::Positions)) &
Detector::setBurstPeriod,
py::arg(), py::arg() = Positions{})
.def("getNumberOfBurstsLeft",
(Result<int64_t>(Detector::*)(sls::Positions) const) &
Detector::getNumberOfBurstsLeft,
py::arg() = Positions{})
.def("getInjectChannel",
(Result<std::array<int, 2>>(Detector::*)(sls::Positions)) &
Detector::getInjectChannel,

View File

@ -1077,11 +1077,21 @@ int64_t getBurstPeriod() {
}
int64_t getNumFramesLeft() {
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
// continuous and auto
if ((burstMode == CONTINUOUS_INTERNAL ||
burstMode == CONTINUOUS_EXTERNAL) &&
getTiming() == AUTO_TIMING) {
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
}
return -1;
}
int64_t getNumTriggersLeft() {
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
// trigger
if (getTiming() == TRIGGER_EXPOSURE) {
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
}
return -1;
}
int64_t getDelayAfterTriggerLeft() {
@ -1094,6 +1104,15 @@ int64_t getPeriodLeft() {
(1E-9 * systemFrequency);
}
int64_t getNumBurstsLeft() {
// burst and auto
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
getTiming() == AUTO_TIMING) {
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
}
return -1;
}
int64_t getFramesFromStart() {
return get64BitReg(FRAMES_FROM_START_LSB_REG, FRAMES_FROM_START_MSB_REG);
}

View File

@ -267,6 +267,9 @@ int64_t getNumTriggersLeft();
int64_t getDelayAfterTriggerLeft();
int64_t getPeriodLeft();
#endif
#ifdef GOTTHARD2D
int64_t getNumBurstsLeft();
#endif
#ifdef GOTTHARDD
int64_t getExpTimeLeft();
#endif

View File

@ -238,4 +238,5 @@ int set_adc_config(int);
int get_bad_channels(int);
int set_bad_channels(int);
int reconfigure_udp(int);
int validate_udp_configuration(int);
int validate_udp_configuration(int);
int get_bursts_left(int);

View File

@ -357,6 +357,7 @@ void function_table() {
flist[F_SET_BAD_CHANNELS] = &set_bad_channels;
flist[F_RECONFIGURE_UDP] = &reconfigure_udp;
flist[F_VALIDATE_UDP_CONFIG] = &validate_udp_configuration;
flist[F_GET_BURSTS_LEFT] = &get_bursts_left;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -8067,4 +8068,19 @@ int validate_udp_configuration(int file_des) {
}
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_bursts_left(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int64_t retval = -1;
#ifndef GOTTHARD2D
functionNotImplemented();
#else
// get only
retval = getNumBurstsLeft();
LOG(logDEBUG1, ("retval num bursts left %lld\n", (long long int)retval));
#endif
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
}

View File

@ -214,11 +214,11 @@ class Detector {
void setDelayAfterTrigger(ns value, Positions pos = {});
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
* [Gotthard2] only in continuous auto mode */
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
* Only when external trigger used */
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2]
@ -1140,6 +1140,9 @@ class Detector {
* mode */
void setBurstPeriod(ns value, Positions pos = {});
/** [Gotthard2] only in burst auto mode */
Result<int64_t> getNumberOfBurstsLeft(Positions pos = {}) const;
/** [Gotthard2] offset channel, increment channel */
Result<std::array<int, 2>> getInjectChannel(Positions pos = {});

View File

@ -1,4 +1,5 @@
#include "CmdProxy.h"
#include "HelpDacs.h"
#include "TimeHelper.h"
#include "ToString.h"
#include "bit_utils.h"
@ -33,7 +34,11 @@ void CmdProxy::Call(const std::string &command,
args = arguments;
det_id = detector_id;
ReplaceIfDepreciated(cmd);
std::string temp;
while (temp != cmd) {
temp = cmd;
ReplaceIfDepreciated(cmd);
}
auto it = functions.find(cmd);
if (it != functions.end()) {
@ -51,6 +56,10 @@ bool CmdProxy::ReplaceIfDepreciated(std::string &command) {
<< command
<< " is depreciated and will be removed. Please migrate to: "
<< d_it->second;
// insert old command into arguments (for dacs)
if (d_it->second == "dac") {
args.insert(args.begin(), command);
}
command = d_it->second;
return true;
}
@ -905,45 +914,59 @@ std::string CmdProxy::TemperatureValues(int action) {
std::string CmdProxy::Dac(int action) {
std::ostringstream os;
os << cmd << ' ';
// dac indices only for ctb
if (args.size() > 0 && action != defs::HELP_ACTION) {
if (is_int(args[0]) &&
det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw sls::RuntimeError(
"Dac indices can only be used for chip test board. Use daclist "
"to get list of dac names for current detector.");
}
}
if (action == defs::HELP_ACTION) {
os << "[dac index] [dac or mV value] [(optional unit) mV] "
"\n\t[Ctb] Dac."
<< '\n';
} else if (det->getDetectorType().squash(defs::GENERIC) !=
defs::CHIPTESTBOARD) {
throw sls::RuntimeError(
"Dac command can only be used for chip test board. Use daclist to "
"get list of dac commands for current detector.");
if (args.size() == 0) {
os << GetHelpDac(std::to_string(0)) << '\n';
} else {
os << args[0] << ' ' << GetHelpDac(args[0]) << '\n';
}
} else if (action == defs::GET_ACTION) {
bool mv = false;
if (args.empty())
WrongNumberOfParameters(1); // This prints slightly wrong
defs::dacIndex dacIndex = StringTo<defs::dacIndex>(args[0]);
bool mV = false;
if (args.size() == 2) {
if ((args[1] != "mv") && (args[1] != "mV")) {
throw sls::RuntimeError("Unknown argument " + args[1] +
". Did you mean mV?");
}
mv = true;
mV = true;
} else if (args.size() > 2) {
WrongNumberOfParameters(1);
}
auto t =
det->getDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv,
std::vector<int>{det_id});
os << args[0] << ' ' << OutString(t)
<< (args.size() > 1 ? " mV\n" : "\n");
auto t = det->getDAC(dacIndex, mV, std::vector<int>{det_id});
os << args[0] << ' ' << OutString(t) << (mV ? " mV\n" : "\n");
} else if (action == defs::PUT_ACTION) {
bool mv = false;
if (args.empty())
WrongNumberOfParameters(1); // This prints slightly wrong
defs::dacIndex dacIndex = StringTo<defs::dacIndex>(args[0]);
bool mV = false;
if (args.size() == 3) {
if ((args[2] != "mv") && (args[2] != "mV")) {
throw sls::RuntimeError("Unknown argument " + args[2] +
". Did you mean mV?");
}
mv = true;
mV = true;
} else if (args.size() > 3 || args.size() < 2) {
WrongNumberOfParameters(2);
}
det->setDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
StringTo<int>(args[1]), mv, std::vector<int>{det_id});
os << args[0] << ' ' << args[1] << (args.size() > 2 ? " mV\n" : "\n");
det->setDAC(dacIndex, StringTo<int>(args[1]), mV,
std::vector<int>{det_id});
os << args[0] << ' ' << args[1] << (mV ? " mV\n" : "\n");
} else {
throw sls::RuntimeError("Unknown action");
}

View File

@ -318,46 +318,6 @@
return os.str(); \
}
/** dac */
#define DAC_COMMAND(CMDNAME, GETFCN, SETFCN, DAC_INDEX, 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) { \
bool mv = false; \
if (args.size() == 1) { \
if ((args[0] != "mv") && (args[0] != "mV")) { \
throw sls::RuntimeError("Unknown argument " + args[0] + \
". Did you mean mV?"); \
} \
mv = true; \
} else if (args.size() > 1) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(DAC_INDEX, mv, std::vector<int>{det_id}); \
os << OutString(t) << (!args.empty() ? " mV\n" : "\n"); \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
bool mv = false; \
if (args.size() == 2) { \
if ((args[1] != "mv") && (args[1] != "mV")) { \
throw sls::RuntimeError("Unknown argument " + args[1] + \
". Did you mean mV?"); \
} \
mv = true; \
} else if (args.size() > 2 || args.empty()) { \
WrongNumberOfParameters(1); \
} \
det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, \
std::vector<int>{det_id}); \
os << args.front() << (args.size() > 1 ? " mV\n" : "\n"); \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** set only, no arguments, no id */
#define EXECUTE_SET_COMMAND_NOID(CMDNAME, SETFCN, HLPSTR) \
std::string CMDNAME(const int action) { \
@ -615,7 +575,7 @@ class CmdProxy {
/** temperature */
/** dacs */
/** super old dacs */
{"vtr", "vtrim"},
{"vrf", "vrpreamp"},
{"vrs", "vrshaper"},
@ -627,6 +587,70 @@ class CmdProxy {
{"viinsh", "vishaper"},
{"vpl", "vcal_n"},
{"vph", "vcal_p"},
/** dacs */
{"vthreshold", "dac"},
{"vsvp", "dac"},
{"vsvn", "dac"},
{"vtrim", "dac"},
{"vrpreamp", "dac"},
{"vrshaper", "dac"},
{"vtgstv", "dac"},
{"vcmp_ll", "dac"},
{"vcmp_lr", "dac"},
{"vcal", "dac"},
{"vcmp_rl", "dac"},
{"vcmp_rr", "dac"},
{"rxb_rb", "dac"},
{"rxb_lb", "dac"},
{"vcp", "dac"},
{"vcn", "dac"},
{"vishaper", "dac"},
{"iodelay", "dac"},
{"vref_ds", "dac"},
{"vcascn_pb", "dac"},
{"vcascp_pb", "dac"},
{"vout_cm", "dac"},
{"vcasc_out", "dac"},
{"vin_cm", "dac"},
{"vref_comp", "dac"},
{"ib_test_c", "dac"},
{"vrshaper_n", "dac"},
{"vipre", "dac"},
{"vdcsh", "dac"},
{"vth1", "dac"},
{"vth2", "dac"},
{"vth3", "dac"},
{"vcal_n", "dac"},
{"vcal_p", "dac"},
{"vcassh", "dac"},
{"vcas", "dac"},
{"vicin", "dac"},
{"vipre_out", "dac"},
{"vref_h_adc", "dac"},
{"vb_comp_fe", "dac"},
{"vb_comp_adc", "dac"},
{"vcom_cds", "dac"},
{"vref_rstore", "dac"},
{"vb_opa_1st", "dac"},
{"vref_comp_fe", "dac"},
{"vcom_adc1", "dac"},
{"vref_prech", "dac"},
{"vref_l_adc", "dac"},
{"vref_cds", "dac"},
{"vb_cs", "dac"},
{"vb_opa_fd", "dac"},
{"vcom_adc2", "dac"},
{"adcvpp", "dac"},
{"vb_ds", "dac"},
{"vb_comp", "dac"},
{"vb_pixbuf", "dac"},
{"vin_com", "dac"},
{"vdd_prot", "dac"},
{"vbp_colbuf", "dac"},
{"vb_sda", "dac"},
{"vcasc_sfp", "dac"},
{"vipre_cds", "dac"},
{"ibias_sfp", "dac"},
/* acquisition */
{"busy", "clearbusy"},
@ -764,70 +788,6 @@ class CmdProxy {
{"temp_slowadc", &CmdProxy::temp_slowadc},
/* dacs */
{"vthreshold", &CmdProxy::vthreshold},
{"vsvp", &CmdProxy::vsvp},
{"vsvn", &CmdProxy::vsvn},
{"vtrim", &CmdProxy::vtrim},
{"vrpreamp", &CmdProxy::vrpreamp},
{"vrshaper", &CmdProxy::vrshaper},
{"vtgstv", &CmdProxy::vtgstv},
{"vcmp_ll", &CmdProxy::vcmp_ll},
{"vcmp_lr", &CmdProxy::vcmp_lr},
{"vcal", &CmdProxy::vcal},
{"vcmp_rl", &CmdProxy::vcmp_rl},
{"vcmp_rr", &CmdProxy::vcmp_rr},
{"rxb_rb", &CmdProxy::rxb_rb},
{"rxb_lb", &CmdProxy::rxb_lb},
{"vcp", &CmdProxy::vcp},
{"vcn", &CmdProxy::vcn},
{"vishaper", &CmdProxy::vishaper},
{"iodelay", &CmdProxy::iodelay},
{"vref_ds", &CmdProxy::vref_ds},
{"vcascn_pb", &CmdProxy::vcascn_pb},
{"vcascp_pb", &CmdProxy::vcascp_pb},
{"vout_cm", &CmdProxy::vout_cm},
{"vcasc_out", &CmdProxy::vcasc_out},
{"vin_cm", &CmdProxy::vin_cm},
{"vref_comp", &CmdProxy::vref_comp},
{"ib_test_c", &CmdProxy::ib_test_c},
{"vrshaper_n", &CmdProxy::vrshaper_n},
{"vipre", &CmdProxy::vipre},
{"vdcsh", &CmdProxy::vdcsh},
{"vth1", &CmdProxy::vth1},
{"vth2", &CmdProxy::vth2},
{"vth3", &CmdProxy::vth3},
{"vcal_n", &CmdProxy::vcal_n},
{"vcal_p", &CmdProxy::vcal_p},
{"vcassh", &CmdProxy::vcassh},
{"vcas", &CmdProxy::vcas},
{"vicin", &CmdProxy::vicin},
{"vipre_out", &CmdProxy::vipre_out},
{"vref_h_adc", &CmdProxy::vref_h_adc},
{"vb_comp_fe", &CmdProxy::vb_comp_fe},
{"vb_comp_adc", &CmdProxy::vb_comp_adc},
{"vcom_cds", &CmdProxy::vcom_cds},
{"vref_rstore", &CmdProxy::vref_rstore},
{"vb_opa_1st", &CmdProxy::vb_opa_1st},
{"vref_comp_fe", &CmdProxy::vref_comp_fe},
{"vcom_adc1", &CmdProxy::vcom_adc1},
{"vref_prech", &CmdProxy::vref_prech},
{"vref_l_adc", &CmdProxy::vref_l_adc},
{"vref_cds", &CmdProxy::vref_cds},
{"vb_cs", &CmdProxy::vb_cs},
{"vb_opa_fd", &CmdProxy::vb_opa_fd},
{"vcom_adc2", &CmdProxy::vcom_adc2},
{"adcvpp", &CmdProxy::adcvpp},
{"vb_ds", &CmdProxy::vb_ds},
{"vb_comp", &CmdProxy::vb_comp},
{"vb_pixbuf", &CmdProxy::vb_pixbuf},
{"vin_com", &CmdProxy::vin_com},
{"vdd_prot", &CmdProxy::vdd_prot},
{"vbp_colbuf", &CmdProxy::vbp_colbuf},
{"vb_sda", &CmdProxy::vb_sda},
{"vcasc_sfp", &CmdProxy::vcasc_sfp},
{"vipre_cds", &CmdProxy::vipre_cds},
{"ibias_sfp", &CmdProxy::ibias_sfp},
{"dac", &CmdProxy::Dac},
{"daclist", &CmdProxy::daclist},
{"dacvalues", &CmdProxy::DacValues},
@ -947,6 +907,7 @@ class CmdProxy {
/* Gotthard2 Specific */
{"bursts", &CmdProxy::bursts},
{"burstperiod", &CmdProxy::burstperiod},
{"burstsl", &CmdProxy::burstsl},
{"inj_ch", &CmdProxy::InjectChannel},
{"vetophoton", &CmdProxy::VetoPhoton},
{"vetoref", &CmdProxy::VetoReference},
@ -1249,12 +1210,12 @@ class CmdProxy {
GET_COMMAND(framesl, getNumberOfFramesLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] "
"Number of frames left in acquisition."
"\n\t[Gotthard2] only in continuous mode.");
"\n\t[Gotthard2] only in continuous auto mode.");
GET_COMMAND(triggersl, getNumberOfTriggersLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] "
"Number of triggers left in acquisition."
"\n\t[Gotthard2] only in continuous mode.");
"Number of triggers left in acquisition. Only when external "
"trigger used.");
TIME_GET_COMMAND(delayl, getDelayAfterTriggerLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench]"
@ -1365,269 +1326,6 @@ class CmdProxy {
/* dacs */
DAC_COMMAND(
vthreshold, getDAC, setDAC, defs::VTHRESHOLD,
"[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
"Detector threshold voltage for single photon counters.\n\t[Eiger] "
"Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same value. "
"\n\t[Mythen3] Sets vth1, vth2 and vth3 to the same value.");
DAC_COMMAND(vsvp, getDAC, setDAC, defs::VSVP,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vsvn, getDAC, setDAC, defs::VSVN,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage "
"to define feedback resistance of the first shaper"); // TODO
DAC_COMMAND(vtrim, getDAC, setDAC, defs::VTRIM,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] Dac for "
"the voltage defining the trim bit size."); // TODO
DAC_COMMAND(vrpreamp, getDAC, setDAC, defs::VRPREAMP,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage "
"to define the preamplifier feedback resistance."); // TODO
DAC_COMMAND(vrshaper, getDAC, setDAC, defs::VRSHAPER,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage to define feedback resistance of "
"the first shaper"); // TODO
DAC_COMMAND(vtgstv, getDAC, setDAC, defs::VTGSTV,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcmp_ll, getDAC, setDAC, defs::VCMP_LL,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcmp_lr, getDAC, setDAC, defs::VCMP_LR,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcal, getDAC, setDAC, defs::VCAL,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcmp_rl, getDAC, setDAC, defs::VCMP_RL,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcmp_rr, getDAC, setDAC, defs::VCMP_RR,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(rxb_rb, getDAC, setDAC, defs::RXB_RB,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(rxb_lb, getDAC, setDAC, defs::RXB_LB,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcp, getDAC, setDAC, defs::VCP,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcn, getDAC, setDAC, defs::VCN,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vishaper, getDAC, setDAC, defs::VISHAPER,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] Dac for "
"the bias current for the shaper."); // TODO
DAC_COMMAND(iodelay, getDAC, setDAC, defs::IO_DELAY,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vref_ds, getDAC, setDAC, defs::VREF_DS,
"[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ?? "); // TODO
DAC_COMMAND(vcascn_pb, getDAC, setDAC, defs::VCASCN_PB,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO
DAC_COMMAND(vcascp_pb, getDAC, setDAC, defs::VCASCP_PB,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO
DAC_COMMAND(vout_cm, getDAC, setDAC, defs::VOUT_CM,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? \n\t[Moench] Dac for 5"); // TODO
DAC_COMMAND(vcasc_out, getDAC, setDAC, defs::VCASC_OUT,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO
DAC_COMMAND(vin_cm, getDAC, setDAC, defs::VIN_CM,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? \n\t[Moench] Dac for 2"); // TODO
DAC_COMMAND(vref_comp, getDAC, setDAC, defs::VREF_COMP,
"[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ?? "); // TODO
DAC_COMMAND(ib_test_c, getDAC, setDAC, defs::IB_TESTC,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO
DAC_COMMAND(vrshaper_n, getDAC, setDAC, defs::VRSHAPER_N,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] voltage "
"to define feedback resistance of the second shaper.");
DAC_COMMAND(
vipre, getDAC, setDAC, defs::VIPRE,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's input transistor current.\n\t[Moench] Dac for 1");
DAC_COMMAND(vdcsh, getDAC, setDAC, defs::VDCSH,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the reference (DC) voltage for the shaper.");
DAC_COMMAND(vth1, getDAC, setDAC, defs::VTH1,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"first detector threshold voltage.");
DAC_COMMAND(vth2, getDAC, setDAC, defs::VTH2,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"second detector threshold voltage.");
DAC_COMMAND(vth3, getDAC, setDAC, defs::VTH3,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"third detector threshold voltage.");
DAC_COMMAND(vcal_n, getDAC, setDAC, defs::VCAL_N,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the low voltage for analog pulsing.");
DAC_COMMAND(vcal_p, getDAC, setDAC, defs::VCAL_P,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the high voltage for analog pulsing.");
DAC_COMMAND(vcassh, getDAC, setDAC, defs::VCASSH,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the shaper's cascode voltage.");
DAC_COMMAND(vcas, getDAC, setDAC, defs::VCAS,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the preamplifier's cascode voltage.");
DAC_COMMAND(vicin, getDAC, setDAC, defs::VICIN,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the bias current for the comparator.");
DAC_COMMAND(vipre_out, getDAC, setDAC, defs::VIPRE_OUT,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"preamplifier's output transistor current."); // TODO
DAC_COMMAND(vref_h_adc, getDAC, setDAC, defs::VREF_H_ADC,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage high of ADC.");
DAC_COMMAND(vb_comp_fe, getDAC, setDAC, defs::VB_COMP_FE,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of analogue front end.");
DAC_COMMAND(vb_comp_adc, getDAC, setDAC, defs::VB_COMP_ADC,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of ADC.");
DAC_COMMAND(vcom_cds, getDAC, setDAC, defs::VCOM_CDS,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of CDS stage.");
DAC_COMMAND(
vref_rstore, getDAC, setDAC, defs::VREF_RSTORE,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference charging voltage of temparory storage cell in high gain.");
DAC_COMMAND(vb_opa_1st, getDAC, setDAC, defs::VB_OPA_1ST,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] dac dac "
"for opa current for driving the other DACs in chip.");
DAC_COMMAND(vref_comp_fe, getDAC, setDAC, defs::VREF_COMP_FE,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of the comparator of analogue front end.");
DAC_COMMAND(vcom_adc1, getDAC, setDAC, defs::VCOM_ADC1,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 1.");
DAC_COMMAND(
vref_prech, getDAC, setDAC, defs::VREF_PRECH,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2][Jungfrau] Dac "
"for reference votlage for precharing the preamplifier."); // TODO also
// for
// jungfrau?
DAC_COMMAND(vref_l_adc, getDAC, setDAC, defs::VREF_L_ADC,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage low for ADC.");
DAC_COMMAND(vref_cds, getDAC, setDAC, defs::VREF_CDS,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of CDS applied to the temporary storage "
"cell in medium and low gain.");
DAC_COMMAND(vb_cs, getDAC, setDAC, defs::VB_CS,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current injection into preamplifier.");
DAC_COMMAND(vb_opa_fd, getDAC, setDAC, defs::VB_OPA_FD,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current for CDS opa stage.");
DAC_COMMAND(vcom_adc2, getDAC, setDAC, defs::VCOM_ADC2,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 2.");
DAC_COMMAND(
adcvpp, getDAC, setDAC, defs::ADC_VPP,
"[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
"\n\tAdvanced User function! ");
DAC_COMMAND(vb_ds, getDAC, setDAC, defs::VB_DS,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vb_comp, getDAC, setDAC, defs::VB_COMP,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vb_pixbuf, getDAC, setDAC, defs::VB_PIXBUF,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vin_com, getDAC, setDAC, defs::VIN_COM,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vdd_prot, getDAC, setDAC, defs::VDD_PROT,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vbp_colbuf, getDAC, setDAC, defs::VBP_COLBUF,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
DAC_COMMAND(vb_sda, getDAC, setDAC, defs::VB_SDA,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
DAC_COMMAND(vcasc_sfp, getDAC, setDAC, defs::VCASC_SFP,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
DAC_COMMAND(vipre_cds, getDAC, setDAC, defs::VIPRE_CDS,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
DAC_COMMAND(ibias_sfp, getDAC, setDAC, defs::IBIAS_SFP,
"[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.");
@ -2116,6 +1814,10 @@ class CmdProxy {
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] "
"Period between 2 bursts. Only in burst mode and auto timing mode.");
GET_COMMAND(burstsl, getNumberOfBurstsLeft,
"\n\t[Gotthard2] Number of bursts left in acquisition. Only in "
"burst auto mode.");
INTEGER_COMMAND_VEC_ID(
cdsgain, getCDSGain, setCDSGain, StringTo<bool>,
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "

View File

@ -1353,6 +1353,10 @@ void Detector::setBurstPeriod(ns value, Positions pos) {
pimpl->Parallel(&Module::setBurstPeriod, pos, value.count());
}
Result<int64_t> Detector::getNumberOfBurstsLeft(Positions pos) const {
return pimpl->Parallel(&Module::getNumberOfBurstsLeft, pos);
}
Result<std::array<int, 2>> Detector::getInjectChannel(Positions pos) {
return pimpl->Parallel(&Module::getInjectChannel, pos);
}

View File

@ -0,0 +1,302 @@
#include "string_utils.h"
std::string GetHelpDac(std::string dac) {
if (sls::is_int(dac)) {
return std::string("[dac name] [dac or mV value] [(optional unit) mV] "
"\n\t[Ctb] Use dac index for dac name.");
}
if (dac == "vthreshold") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
"Detector threshold voltage for single photon counters.\n\t[Eiger] "
"Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same "
"value. \n\t[Mythen3] Sets vth1, vth2 and vth3 to the same value.");
}
if (dac == "vsvp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? ");
}
if (dac == "vsvn") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define "
"feedback resistance of the first shaper");
}
if (dac == "vtrim") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? "
"\n\t[Mythen3] Dac for the voltage defining the trim bit size.");
}
if (dac == "vrpreamp") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define the "
"preamplifier feedback resistance.");
}
if (dac == "vrshaper") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define "
"feedback resistance of the first shaper");
}
if (dac == "vtgstv") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_ll") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_lr") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcal") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_rl") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_rr") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "rxb_rb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "rxb_lb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcn") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vishaper") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "iodelay") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vref_ds") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ??");
}
if (dac == "vcascn_pb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vcascp_pb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vout_cm") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 5");
}
if (dac == "vcasc_out") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vin_cm") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 2");
}
if (dac == "vref_comp") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ??");
}
if (dac == "ib_test_c") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vrshaper_n") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] voltage to "
"define feedback resistance of the second shaper.");
}
if (dac == "vipre") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's input transistor current.\n\t[Moench] Dac for 1");
}
if (dac == "vdcsh") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"reference (DC) voltage for the shaper.");
}
if (dac == "vth1") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for first "
"detector threshold voltage.");
}
if (dac == "vth2") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"second detector threshold voltage.");
}
if (dac == "vth3") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for third "
"detector threshold voltage.");
}
if (dac == "vcal_n") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"low voltage for analog pulsing.");
}
if (dac == "vcal_p") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"high voltage for analog pulsing.");
}
if (dac == "vcassh") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"shaper's cascode voltage.");
}
if (dac == "vcas") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's cascode voltage.");
}
if (dac == "vicin") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"bias current for the comparator.");
}
if (dac == "vipre_out") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"preamplifier's output transistor current.");
}
if (dac == "vref_h_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage high of ADC.");
}
if (dac == "vb_comp_fe") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of analogue front end.");
}
if (dac == "vb_comp_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of ADC.");
}
if (dac == "vcom_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of CDS stage.");
}
if (dac == "vref_rstore") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard2] Dac for reference charging voltage "
"of temparory storage cell in high gain.");
}
if (dac == "vb_opa_1st") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] dac dac for "
"opa current for driving the other DACs in chip.");
}
if (dac == "vref_comp_fe") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of the comparator of analogue front end.");
}
if (dac == "vcom_adc1") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 1.");
}
if (dac == "vref_prech") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2][Jungfrau] "
"Dac for reference votlage for precharing the preamplifier.");
}
if (dac == "vref_l_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage low for ADC.");
}
if (dac == "vref_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of CDS applied to the temporary storage cell in "
"medium and low gain.");
}
if (dac == "vb_cs") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current injection into preamplifier.");
}
if (dac == "vb_opa_fd") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current for CDS opa stage.");
}
if (dac == "vcom_adc2") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 2.");
}
if (dac == "adcvpp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
"\n\tAdvanced User function! ");
}
if (dac == "vb_ds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vb_comp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vb_pixbuf") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vin_com") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vdd_prot") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vbp_colbuf") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
}
if (dac == "vb_sda") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
}
if (dac == "vcasc_sfp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
}
if (dac == "vipre_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
}
if (dac == "ibias_sfp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7");
}
// clang-format off
if (dac == "vtgstv") { return std::string(""); }
// clang-format on
throw sls::RuntimeError("Unknown dac command");
}

View File

@ -1355,6 +1355,10 @@ void Module::setBurstPeriod(int64_t value) {
sendToDetector(F_SET_BURST_PERIOD, value, nullptr);
}
int64_t Module::getNumberOfBurstsLeft() const {
return sendToDetectorStop<int64_t>(F_GET_BURSTS_LEFT);
}
std::array<int, 2> Module::getInjectChannel() const {
return sendToDetector<std::array<int, 2>>(F_GET_INJECT_CHANNEL);
}

View File

@ -372,6 +372,7 @@ class Module : public virtual slsDetectorDefs {
void setNumberOfBursts(int64_t value);
int64_t getBurstPeriod() const;
void setBurstPeriod(int64_t value);
int64_t getNumberOfBurstsLeft() const;
std::array<int, 2> getInjectChannel() const;
void setInjectChannel(const int offsetChannel, const int incrementChannel);
void sendVetoPhoton(const int chipIndex,

View File

@ -284,6 +284,17 @@ TEST_CASE("burstperiod", "[.cmd][.new]") {
}
}
TEST_CASE("burstsl", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
REQUIRE_NOTHROW(proxy.Call("burstsl", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("burstsl", {}, -1, GET));
}
}
TEST_CASE("inj_ch", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);

View File

@ -213,6 +213,7 @@ enum detFuncs {
F_SET_BAD_CHANNELS,
F_RECONFIGURE_UDP,
F_VALIDATE_UDP_CONFIG,
F_GET_BURSTS_LEFT,
NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
@ -529,7 +530,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_BAD_CHANNELS: return "F_SET_BAD_CHANNELS";
case F_RECONFIGURE_UDP: return "F_RECONFIGURE_UDP";
case F_VALIDATE_UDP_CONFIG: return "F_VALIDATE_UDP_CONFIG";
case F_GET_BURSTS_LEFT: return "F_GET_BURSTS_LEFT";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";

View File

@ -51,4 +51,7 @@ implementation should not be used in a performance critical place.
std::vector<std::string> split(const std::string &strToSplit, char delimeter);
std::string RemoveUnit(std::string &str);
bool is_int(const std::string& s);
} // namespace sls

View File

@ -3,11 +3,10 @@
#define APILIB 0x200810
#define APIRECEIVER 0x200810
#define APIGUI 0x200804
#define APICTB 0x200910
#define APIMOENCH 0x200910
#define APIMYTHEN3 0x200923
#define APIGOTTHARD 0x200917
#define APIJUNGFRAU 0x200917
#define APIEIGER 0x200918
#define APIMYTHEN3 0x200923
#define APIGOTTHARD2 0x200924

View File

@ -686,41 +686,41 @@ template <> defs::readoutMode StringTo(const std::string &s) {
}
template <> defs::dacIndex StringTo(const std::string &s) {
if (s == "dac 0")
if (s == "dac 0" || s == "0")
return defs::DAC_0;
if (s == "dac 1")
if (s == "dac 1" || s == "1")
return defs::DAC_1;
if (s == "dac 2")
if (s == "dac 2" || s == "2")
return defs::DAC_2;
if (s == "dac 3")
if (s == "dac 3" || s == "3")
return defs::DAC_3;
if (s == "dac 4")
if (s == "dac 4" || s == "4")
return defs::DAC_4;
if (s == "dac 5")
if (s == "dac 5"|| s == "5")
return defs::DAC_5;
if (s == "dac 6")
if (s == "dac 6"|| s == "6")
return defs::DAC_6;
if (s == "dac 7")
if (s == "dac 7"|| s == "7")
return defs::DAC_7;
if (s == "dac 8")
if (s == "dac 8"|| s == "8")
return defs::DAC_8;
if (s == "dac 9")
if (s == "dac 9"|| s == "9")
return defs::DAC_9;
if (s == "dac 10")
if (s == "dac 10"|| s == "10")
return defs::DAC_10;
if (s == "dac 11")
if (s == "dac 11"|| s == "11")
return defs::DAC_11;
if (s == "dac 12")
if (s == "dac 12"|| s == "12")
return defs::DAC_12;
if (s == "dac 13")
if (s == "dac 13"|| s == "13")
return defs::DAC_13;
if (s == "dac 14")
if (s == "dac 14"|| s == "14")
return defs::DAC_14;
if (s == "dac 15")
if (s == "dac 15"|| s == "15")
return defs::DAC_15;
if (s == "dac 16")
if (s == "dac 16"|| s == "16")
return defs::DAC_16;
if (s == "dac 17")
if (s == "dac 17"|| s == "17")
return defs::DAC_17;
if (s == "vsvp")
return defs::VSVP;

View File

@ -30,4 +30,10 @@ std::string RemoveUnit(std::string &str) {
return unit;
}
bool is_int(const std::string &s) {
return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) {
return !std::isdigit(c);
}) == s.end();
}
}; // namespace sls

View File

@ -66,4 +66,14 @@ TEST_CASE("Many characters in a row") {
REQUIRE(std::string(str) == "someeequite::ongstring");
}
TEST_CASE("Check is string is integer"){
REQUIRE(sls::is_int("75"));
REQUIRE(sls::is_int("11675"));
REQUIRE_FALSE(sls::is_int("7.5"));
REQUIRE_FALSE(sls::is_int("hej"));
REQUIRE_FALSE(sls::is_int("7a"));
REQUIRE_FALSE(sls::is_int(""));
}
// TEST_CASE("concat things not being strings")