From 4107938921c738e92e381eedcde5cd4e9f284c50 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 16 Feb 2022 15:03:25 +0100 Subject: [PATCH] adding 12 bit mode for eiger, WIP --- python/slsdet/detector.py | 2 +- slsDetectorServers/eigerDetectorServer/Beb.c | 14 ++++++++++---- .../eigerDetectorServer/FebControl.c | 17 ++++++++--------- .../eigerDetectorServer/FebControl.h | 2 +- .../src/slsDetectorServer_funcs.c | 3 +++ slsDetectorSoftware/include/sls/Detector.h | 2 +- slsDetectorSoftware/src/CmdProxy.h | 3 +-- slsDetectorSoftware/src/Detector.cpp | 2 +- 8 files changed, 26 insertions(+), 19 deletions(-) diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index c4618760a..3ba65126a 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -287,7 +287,7 @@ class Detector(CppDetectorApi): Note ----- - [Eiger] Options: 4, 8, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n + [Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n [Mythen3] Options: 8, 16, 32 \n [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16 """ diff --git a/slsDetectorServers/eigerDetectorServer/Beb.c b/slsDetectorServers/eigerDetectorServer/Beb.c index 90512c7b1..e9f1ad42c 100644 --- a/slsDetectorServers/eigerDetectorServer/Beb.c +++ b/slsDetectorServers/eigerDetectorServer/Beb.c @@ -862,11 +862,17 @@ void Beb_ResetFrameNumber() { } int Beb_SetUpTransferParameters(short the_bit_mode) { - if (the_bit_mode != 4 && the_bit_mode != 8 && the_bit_mode != 16 && - the_bit_mode != 32) + switch (the_bit_mode) { + case 4: + case 8: + case 12: + case 16: + case 32: + Beb_bit_mode = the_bit_mode; + return 1; + default: return 0; - Beb_bit_mode = the_bit_mode; - return 1; + } } int Beb_StopAcquisition() { diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index 27d98a30a..8d3661a52 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -1169,37 +1169,36 @@ int Feb_Control_SoftwareTrigger(int block) { } // parameters -int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo) { +int Feb_Control_SetDynamicRange(unsigned int dr) { static unsigned int everything_but_bit_mode = DAQ_STATIC_BIT_PROGRAM | DAQ_STATIC_BIT_CHIP_TEST | DAQ_STATIC_BIT_ROTEST; - if (four_eight_sixteen_or_thirtytwo == 4) { + if (dr == 4) { Feb_Control_staticBits = DAQ_STATIC_BIT_M4 | (Feb_Control_staticBits & everything_but_bit_mode); // leave test bits in currernt state Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; - } else if (four_eight_sixteen_or_thirtytwo == 8) { + } else if (dr == 8) { Feb_Control_staticBits = DAQ_STATIC_BIT_M8 | (Feb_Control_staticBits & everything_but_bit_mode); Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; - } else if (four_eight_sixteen_or_thirtytwo == 16) { + } else if (dr == 16 || dr == 12) { Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits & everything_but_bit_mode); Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; - } else if (four_eight_sixteen_or_thirtytwo == 32) { + } else if (dr == 32) { Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits & everything_but_bit_mode); Feb_Control_subFrameMode |= DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; } else { - LOG(logERROR, ("dynamic range (%d) not valid, not setting bit mode.\n", - four_eight_sixteen_or_thirtytwo)); + LOG(logERROR, + ("dynamic range (%d) not valid, not setting bit mode.\n", dr)); LOG(logINFO, ("Set dynamic range int must equal 4,8 16, or 32.\n")); return 0; } - LOG(logINFO, - ("Dynamic range set to %d\n", four_eight_sixteen_or_thirtytwo)); + LOG(logINFO, ("Dynamic range set to %d\n", dr)); return 1; } diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.h b/slsDetectorServers/eigerDetectorServer/FebControl.h index 7ede407ad..3787000ec 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.h +++ b/slsDetectorServers/eigerDetectorServer/FebControl.h @@ -63,7 +63,7 @@ int Feb_Control_SendSoftwareTrigger(); int Feb_Control_SoftwareTrigger(int block); // parameters -int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo); +int Feb_Control_SetDynamicRange(unsigned int dr); unsigned int Feb_Control_GetDynamicRange(); int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); int Feb_Control_SetReadoutMode(unsigned int readout_mode); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 80c7e003c..1d03f9f87 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -2811,6 +2811,9 @@ int set_dynamic_range(int file_des) { #endif #if defined(EIGERD) || defined(MYTHEN3D) case 8: +#ifdef EIGERD + case 12: +#endif case 16: case 32: #endif diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 91f420716..dc0b97f6b 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -284,7 +284,7 @@ class Detector { Result getDynamicRange(Positions pos = {}) const; /** - * [Eiger] Options: 4, 8, 16, 32. If i is 32, also sets clkdivider to 2, + * [Eiger] Options: 4, 8, 12, 16, 32. If i is 32, also sets clkdivider to 2, * else sets clkdivider to 1 \n [Mythen3] Options: 8, 16, 32 \n * [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16 */ diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index ac1afb4ad..ea821f997 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -1109,7 +1109,6 @@ class CmdProxy { /* acquisition parameters */ std::string Acquire(int action); std::string Exptime(int action); - std::string DynamicRange(int action); std::string ReadoutSpeed(int action); std::string Adcphase(int action); std::string Dbitphase(int action); @@ -1328,7 +1327,7 @@ class CmdProxy { dr, getDynamicRange, setDynamicRange, StringTo, "[value]\n\tDynamic Range or number of bits per " "pixel in detector.\n\t" - "[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets " + "[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets " "clkdivider to 2, else to 0.\n\t" "[Mythen3] Options: 8, 16, 32\n\t" "[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16"); diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 801193e78..5fcd7f655 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -387,7 +387,7 @@ void Detector::setDynamicRange(int value) { std::vector Detector::getDynamicRangeList() const { switch (getDetectorType().squash()) { case defs::EIGER: - return std::vector{4, 8, 16, 32}; + return std::vector{4, 8, 12, 16, 32}; case defs::MYTHEN3: return std::vector{8, 16, 32}; default: