mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
jungfrau: gainmode
This commit is contained in:
@ -40,6 +40,7 @@ std::string ToString(const defs::M3_GainCaps s);
|
||||
std::string ToString(const defs::portPosition s);
|
||||
std::string ToString(const defs::ethernetInterface s);
|
||||
std::string ToString(const defs::vetoAlgorithm s);
|
||||
std::string ToString(const defs::gainMode s);
|
||||
|
||||
std::string ToString(const slsDetectorDefs::xy &coord);
|
||||
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
|
||||
@ -305,6 +306,7 @@ template <> defs::M3_GainCaps StringTo(const std::string &s);
|
||||
template <> defs::portPosition StringTo(const std::string &s);
|
||||
template <> defs::ethernetInterface StringTo(const std::string &s);
|
||||
template <> defs::vetoAlgorithm StringTo(const std::string &s);
|
||||
template <> defs::gainMode StringTo(const std::string &s);
|
||||
|
||||
template <> uint32_t StringTo(const std::string &s);
|
||||
template <> uint64_t StringTo(const std::string &s);
|
||||
|
@ -414,6 +414,8 @@ typedef struct {
|
||||
|
||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
||||
|
||||
enum gainMode { NORMAL_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2 };
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/** scan structure */
|
||||
|
@ -233,6 +233,8 @@ enum detFuncs {
|
||||
F_GET_CHIP_VERSION,
|
||||
F_GET_DEFAULT_DAC,
|
||||
F_SET_DEFAULT_DAC,
|
||||
F_GET_GAIN_MODE,
|
||||
F_SET_GAIN_MODE,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||
@ -572,6 +574,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_CHIP_VERSION: return "F_GET_CHIP_VERSION";
|
||||
case F_GET_DEFAULT_DAC: return "F_GET_DEFAULT_DAC";
|
||||
case F_SET_DEFAULT_DAC: return "F_SET_DEFAULT_DAC";
|
||||
case F_GET_GAIN_MODE: return "F_GET_GAIN_MODE";
|
||||
case F_SET_GAIN_MODE: return "F_SET_GAIN_MODE";
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
|
@ -579,6 +579,19 @@ std::string ToString(const defs::vetoAlgorithm s) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToString(const defs::gainMode s) {
|
||||
switch (s) {
|
||||
case defs::NORMAL_GAIN_MODE:
|
||||
return std::string("normal");
|
||||
case defs::FORCE_SWITCH_G1:
|
||||
return std::string("forceswitchg1");
|
||||
case defs::FORCE_SWITCH_G2:
|
||||
return std::string("forceswitchg2");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
const std::string &ToString(const std::string &s) { return s; }
|
||||
|
||||
template <> defs::detectorType StringTo(const std::string &s) {
|
||||
@ -962,6 +975,16 @@ template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
||||
throw sls::RuntimeError("Unknown veto algorithm " + s);
|
||||
}
|
||||
|
||||
template <> defs::gainMode StringTo(const std::string &s) {
|
||||
if (s == "normal")
|
||||
return defs::NORMAL_GAIN_MODE;
|
||||
if (s == "forceswitchg1")
|
||||
return defs::FORCE_SWITCH_G1;
|
||||
if (s == "forceswitchg2")
|
||||
return defs::FORCE_SWITCH_G2;
|
||||
throw sls::RuntimeError("Unknown gain mode " + s);
|
||||
}
|
||||
|
||||
template <> uint32_t StringTo(const std::string &s) {
|
||||
int base = s.find("0x") != std::string::npos ? 16 : 10;
|
||||
return std::stoul(s, nullptr, base);
|
||||
|
Reference in New Issue
Block a user