mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
wip
This commit is contained in:
parent
6dfcd9607f
commit
550810a3ca
@ -1098,7 +1098,7 @@ enum gainMode getGainMode() {
|
||||
|
||||
switch (retval_force) {
|
||||
case DAQ_FRCE_GAIN_STG_0_VAL:
|
||||
return NORMAL_GAIN_MODE;
|
||||
return DYNAMICGAIN;
|
||||
case DAQ_FRCE_GAIN_STG_1_VAL:
|
||||
return FORCE_SWITCH_G1;
|
||||
case DAQ_FRCE_GAIN_STG_2_VAL:
|
||||
@ -1131,7 +1131,7 @@ void setGainMode(enum gainMode mode) {
|
||||
uint32_t value = bus_r(addr);
|
||||
|
||||
switch (mode) {
|
||||
case NORMAL_GAIN_MODE:
|
||||
case DYNAMICGAIN:
|
||||
value &= ~(DAQ_FRCE_SWTCH_GAIN_MSK);
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO, ("Set gain mode - Normal Gain Mode [DAQ Reg:0x%x]\n",
|
||||
@ -1151,6 +1151,27 @@ void setGainMode(enum gainMode mode) {
|
||||
LOG(logINFO, ("Set gain mode - Force Switch G2 [DAQ Reg:0x%x]\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIX_G1:
|
||||
value &= ~(DAQ_FIX_GAIN_MSK);
|
||||
value |= DAQ_FIX_GAIN_STG_1_VAL;
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO,
|
||||
("Set gain mode - Fix G1 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIX_G2:
|
||||
value &= ~(DAQ_FIX_GAIN_MSK);
|
||||
value |= DAQ_FIX_GAIN_STG_2_VAL;
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO,
|
||||
("Set gain mode - Fix G2 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIX_G0: //????
|
||||
value &= ~(DAQ_FIX_GAIN_MSK);
|
||||
value |= DAQ_FIX_GAIN_STG_2_VAL;
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO,
|
||||
("Set gain mode - Fix G2 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("This gain mode %d is not defined\n", (int)mode));
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ class Detector {
|
||||
/** [Jungfrau]*/
|
||||
Result<defs::gainMode> getGainMode(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Options: NORMAL_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2,
|
||||
/** [Jungfrau] Options: DYNAMICGAIN, FORCE_SWITCH_G1, FORCE_SWITCH_G2,
|
||||
* FIX_G1, FIX_G2, FIX_G0, FIX_HG0 \n\CAUTION: Do not use FIX_G0 and FIX_HG0
|
||||
* blindly, you can damage the detector!!!\n
|
||||
*/
|
||||
|
@ -1494,9 +1494,10 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
||||
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
||||
switch (getDetectorType().squash()) {
|
||||
case defs::JUNGFRAU:
|
||||
return std::vector<defs::gainMode>{defs::NORMAL_GAIN_MODE,
|
||||
defs::FORCE_SWITCH_G1,
|
||||
defs::FORCE_SWITCH_G2};
|
||||
return std::vector<defs::gainMode>{
|
||||
defs::DYNAMICGAIN, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
|
||||
defs::FIX_G1, defs::FIX_G2, defs::FIX_G0,
|
||||
defs::FIX_HG0};
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Gain mode is not implemented for this detector.");
|
||||
|
@ -463,8 +463,18 @@ TEST_CASE("gainmode", "[.cmd]") {
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gainmode", {"normal"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode normal\n");
|
||||
proxy.Call("gainmode", {"fixg1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode fixg1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gainmode", {"fixg2"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode fixg2\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gainmode", {"dynamic"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode dynamic\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setGainMode(prev_val[i], {i});
|
||||
|
@ -415,7 +415,7 @@ typedef struct {
|
||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
||||
|
||||
enum gainMode {
|
||||
NORMAL_GAIN_MODE,
|
||||
DYNAMICGAIN,
|
||||
FORCE_SWITCH_G1,
|
||||
FORCE_SWITCH_G2,
|
||||
FIX_G1,
|
||||
|
@ -581,8 +581,8 @@ 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::DYNAMICGAIN:
|
||||
return std::string("dynamicgain");
|
||||
case defs::FORCE_SWITCH_G1:
|
||||
return std::string("forceswitchg1");
|
||||
case defs::FORCE_SWITCH_G2:
|
||||
@ -984,8 +984,8 @@ template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
||||
}
|
||||
|
||||
template <> defs::gainMode StringTo(const std::string &s) {
|
||||
if (s == "normal")
|
||||
return defs::NORMAL_GAIN_MODE;
|
||||
if (s == "dynamicgain")
|
||||
return defs::DYNAMICGAIN;
|
||||
if (s == "forceswitchg1")
|
||||
return defs::FORCE_SWITCH_G1;
|
||||
if (s == "forceswitchg2")
|
||||
|
Loading…
x
Reference in New Issue
Block a user