diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 6c610de27..362eef1ea 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -2292,7 +2292,7 @@ class Detector(CppDetectorApi): @property @element - def filtercell(self): + def filtercells(self): """ [Jungfrau] Set filter capacitor. Note @@ -2301,8 +2301,8 @@ class Detector(CppDetectorApi): """ return self.getFilterCell() - @filtercell.setter - def filtercell(self, value): + @filtercells.setter + def filtercells(self, value): ut.set_using_dict(self.setFilterCell, value) @property diff --git a/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h b/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h index c632c3190..5db0ac0d5 100644 --- a/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h +++ b/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h @@ -452,6 +452,7 @@ Time before end of exposure when comparator is disabled */ #define ASIC_CTRL_DS_TMR_OFST (8) #define ASIC_CTRL_DS_TMR_MSK (0x000000FF << ASIC_CTRL_DS_TMR_OFST) #define ASIC_CTRL_DS_TMR_VAL ((0x1F << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK) +#define ASIC_CTRL_DS_TMR_CHIP1_1_VAL ((0xFF << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK) // tET = (ET + 1) * 25ns (increase timeout range between 2 consecutive storage // cells) #define ASIC_CTRL_EXPSRE_TMR_OFST (16) diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index b986f47e5..f762537ad 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -1829,11 +1829,15 @@ int64_t getComparatorDisableTime() { } void configureASICTimer() { - LOG(logINFO, ("Configuring ASIC Timer\n")); bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_PRCHRG_TMR_MSK) | ASIC_CTRL_PRCHRG_TMR_VAL); - bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_DS_TMR_MSK) | - ASIC_CTRL_DS_TMR_VAL); + + uint32_t val = ASIC_CTRL_DS_TMR_VAL; + if (getChipVersion() == 11) { + val = ASIC_CTRL_DS_TMR_CHIP1_1_VAL; + } + bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_DS_TMR_MSK) | val); + LOG(logINFO, ("Configured ASIC Timer [0x%x]\n", bus_r(ASIC_CTRL_REG))); } int setReadoutSpeed(int val) { @@ -2213,7 +2217,8 @@ int getFilterCell() { // flip all contents of register //TODO FIRMWARE FIX regval ^= BIT32_MASK; #endif - uint32_t retval = (regval & CONFIG_V11_FLTR_CLL_MSK) >> CONFIG_V11_FLTR_CLL_OFST; + uint32_t retval = + (regval & CONFIG_V11_FLTR_CLL_MSK) >> CONFIG_V11_FLTR_CLL_OFST; // count number of bits = which icell return (__builtin_popcount(retval)); } @@ -2336,13 +2341,12 @@ int getFixCurrentSource() { int getNormalCurrentSource() { if (getChipVersion() == 11) { - //TODO FIRMWARE FIX TOGGLING + // TODO FIRMWARE FIX TOGGLING int regval = bus_r(CONFIG_V11_STATUS_REG); #ifndef VIRTUAL regval ^= BIT32_MASK; #endif - int low = ((regval & - CONFIG_V11_STATUS_CRRNT_SRC_LOW_MSK) >> + int low = ((regval & CONFIG_V11_STATUS_CRRNT_SRC_LOW_MSK) >> CONFIG_V11_STATUS_CRRNT_SRC_LOW_OFST); return (low == 0 ? 1 : 0); } diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index 2c46b78c0..bb75c0666 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -82,8 +82,13 @@ std::map CmdProxy::GetDepreciatedCommands() { } void CmdProxy::WrongNumberOfParameters(size_t expected) { + if (expected == 0) { + throw RuntimeError("Command " + cmd + + " expected no parameter/s but got " + + std::to_string(args.size()) + "\n"); + } throw RuntimeError( - "Command " + cmd + " expected <=" + std::to_string(expected) + + "Command " + cmd + " expected >=" + std::to_string(expected) + " parameter/s but got " + std::to_string(args.size()) + "\n"); } diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index c96c4f2e2..0d18494d7 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -948,7 +948,7 @@ class CmdProxy { {"storagecell_start", &CmdProxy::storagecell_start}, {"storagecell_delay", &CmdProxy::storagecell_delay}, {"gainmode", &CmdProxy::gainmode}, - {"filtercell", &CmdProxy::filtercell}, + {"filtercells", &CmdProxy::filtercells}, /* Gotthard Specific */ {"roi", &CmdProxy::ROI}, @@ -1951,7 +1951,7 @@ class CmdProxy { "Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, " "you can damage the detector!!!"); - INTEGER_COMMAND_VEC_ID(filtercell, getFilterCell, setFilterCell, + INTEGER_COMMAND_VEC_ID(filtercells, getFilterCell, setFilterCell, sls::StringTo, "[0-12]\n\t[Jungfrau] Set Filter Cell. Only for " "chipv1.1. Advanced user Command");