diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 646f7711c..c74f6928e 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -1992,6 +1992,20 @@ class Detector(CppDetectorApi): Jungfrau specific """ + @property + @element + def chipversion(self): + """ + [Jungfrau] Chip version of module. Can be 1.0 or 1.1. + + Example + ------- + >>> d.chipversion + '1.0' + """ + return self.getChipVersion() + + @property @element def auto_comp_disable(self): diff --git a/python/src/detector.cpp b/python/src/detector.cpp index f6d2ac615..9e558a235 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -947,6 +947,10 @@ void init_det(py::module &m) { (void (Detector::*)(sls::Positions)) & Detector::resetTemperatureEvent, py::arg() = Positions{}) + .def("getChipVersion", + (Result(Detector::*)(sls::Positions) const) & + Detector::getChipVersion, + py::arg() = Positions{}) .def("getAutoCompDisable", (Result(Detector::*)(sls::Positions) const) & Detector::getAutoCompDisable, diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index 258e18f7e..ccdfaae73 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index 7ddd6823e..e75a1a2fc 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -1106,7 +1106,7 @@ int Feb_Control_SendSoftwareTrigger() { LOG(logERROR, ("Could not give software trigger\n")); return 0; } - LOG(logINFO, ("Software Internal Trigger Sent!\n")); + LOG(logDEBUG1, ("Software Internal Trigger Sent!\n")); return 1; } @@ -1129,7 +1129,7 @@ int Feb_Control_SoftwareTrigger(int block) { // wait for next trigger ready if (block) { - LOG(logINFO, ("Blocking Software Trigger\n")); + LOG(logDEBUG1, ("Blocking Software Trigger\n")); int readyForTrigger = 0; if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) { LOG(logERROR, ("Could not read FEB_REG_STATUS reg after giving " @@ -1138,6 +1138,15 @@ int Feb_Control_SoftwareTrigger(int block) { } while (!readyForTrigger) { + // end of acquisition (cannot monitor readyForTrigger) + int status = Feb_Control_AcquisitionInProgress(); + if (status == STATUS_ERROR) { + LOG(logERROR, ("Status: ERROR reading DAQ status register\n")); + return 0; + } else if (status == STATUS_IDLE) { + break; + } + usleep(5000); if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) { LOG(logERROR, ("Could not read FEB_REG_STATUS reg after " @@ -1145,8 +1154,10 @@ int Feb_Control_SoftwareTrigger(int block) { return 0; } } - LOG(logINFO, ("Done waiting (wait for trigger)!\n")); + LOG(logDEBUG2, ("Done waiting (wait for trigger)!\n")); } + LOG(logINFO, ("%s Software Trigger %s\n", (block ? "Blocking" : "Non blocking"), (block ? "Acquired" : "Sent"))); + fflush(stdout); } return 1; diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer index fde66559a..3006b0969 100755 Binary files a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer differ diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index 73b337ada..3b395f52e 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -434,8 +434,9 @@ int readConfigFile() { master = -1; top = -1; - char fname[128]; - if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) { + const int fileNameSize = 128; + char fname[fileNameSize]; + if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) { return FAIL; } diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index 2b6632367..dabd39758 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index c7a9814fe..3dbb46900 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -530,8 +530,9 @@ int readConfigFile() { usleep(INITIAL_STARTUP_WAIT); - char fname[128]; - if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) { + const int fileNameSize = 128; + char fname[fileNameSize]; + if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) { return FAIL; } @@ -1833,15 +1834,23 @@ int checkDetectorType() { int type = atoi(buffer); if (type > TYPE_NO_MODULE_STARTING_VAL) { LOG(logERROR, - ("No Module attached! Expected %d for Gotthard2, got %d\n", - TYPE_GOTTHARD2_MODULE_VAL, type)); + ("No Module attached! Expected %d, %d or %d for Gotthard2, got %d\n", + TYPE_GOTTHARD2_MODULE_VAL, + TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL, + TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL, + type)); return -2; } - if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) { + if ((abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) && + (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) > TYPE_TOLERANCE) && + (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) { LOG(logERROR, - ("Wrong Module attached! Expected %d for Gotthard2, got %d\n", - TYPE_GOTTHARD2_MODULE_VAL, type)); + ("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got %d\n", + TYPE_GOTTHARD2_MODULE_VAL, + TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL, + TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL, + type)); return FAIL; } return OK; diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index 46db18153..91293d7e3 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -26,7 +26,10 @@ #define ADU_MAX_BITS (12) #define MAX_FRAMES_IN_BURST_MODE (2720) #define TYPE_GOTTHARD2_MODULE_VAL (536) -#define TYPE_TOLERANCE (10) +#define TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL (683) +#define TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL (704) +#define TYPE_GOTTHARD2_MODULE_VAL (536) +#define TYPE_TOLERANCE (5) #define TYPE_NO_MODULE_STARTING_VAL (800) #define INITIAL_STARTUP_WAIT (1 * 1000 * 1000) diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer index 689a040a4..90989277d 100755 Binary files a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer and b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer differ diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c index db55c29e1..eae7a7722 100644 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c @@ -588,8 +588,9 @@ void setGbitReadout() { } int readConfigFile() { - char fname[128]; - if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) { + const int fileNameSize = 128; + char fname[fileNameSize]; + if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) { return FAIL; } diff --git a/slsDetectorServers/jungfrauDetectorServer/CMakeLists.txt b/slsDetectorServers/jungfrauDetectorServer/CMakeLists.txt index ded49a47c..2d1a6fd12 100644 --- a/slsDetectorServers/jungfrauDetectorServer/CMakeLists.txt +++ b/slsDetectorServers/jungfrauDetectorServer/CMakeLists.txt @@ -36,4 +36,6 @@ set_target_properties(jungfrauDetectorServer_virtual PROPERTIES install(TARGETS jungfrauDetectorServer_virtual EXPORT "${TARGETS_EXPORT_NAME}" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) \ No newline at end of file +) + +configure_file(config_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/config_jungfrau.txt COPYONLY) diff --git a/slsDetectorServers/jungfrauDetectorServer/Makefile b/slsDetectorServers/jungfrauDetectorServer/Makefile index 1a225159c..551b9137c 100755 --- a/slsDetectorServers/jungfrauDetectorServer/Makefile +++ b/slsDetectorServers/jungfrauDetectorServer/Makefile @@ -32,6 +32,7 @@ $(PROGS): $(OBJS) mkdir -p $(DESTDIR) $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) mv $(PROGS) $(DESTDIR) + cp config_jungfrau.txt $(DESTDIR) rm *.gdb rm $(main_src)*.o diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index 2219036ea..8628212f5 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/config_jungfrau.txt b/slsDetectorServers/jungfrauDetectorServer/config_jungfrau.txt new file mode 100755 index 000000000..48fea871e --- /dev/null +++ b/slsDetectorServers/jungfrauDetectorServer/config_jungfrau.txt @@ -0,0 +1,4 @@ + + +#chip version version (multiplied by 10) +chipversion 11 diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index f9ac4032e..57f96cc18 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -45,6 +45,7 @@ int highvoltage = 0; int dacValues[NDAC] = {}; int32_t clkPhase[NUM_CLOCKS] = {}; int detPos[4] = {}; +int chipVersion = 10; // (1.0) int isInitCheckDone() { return initCheckDone; } @@ -101,6 +102,7 @@ void basictests() { if (fwversion >= MIN_REQRD_VRSN_T_RD_API) sw_fw_apiversion = getFirmwareAPIVersion(); + LOG(logINFOBLUE, ("************ Jungfrau Server *********************\n" "Hardware Version:\t\t 0x%x\n" @@ -283,12 +285,17 @@ u_int16_t getHardwareSerialNumber() { // is board 1.0?, with value 2 (resistor network) int isHardwareVersion2() { +#ifdef VIRTUAL + return 0; +#endif return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) == HARDWARE_VERSION_2_VAL) ? 1 : 0); } +int getChipVersion() { return chipVersion; } + u_int32_t getDetectorNumber() { #ifdef VIRTUAL return 0; @@ -383,6 +390,11 @@ void setupDetector() { sharedMemory_setStatus(IDLE); #endif + // get chip version + if (readConfigFile() == FAIL) { + return; + } + ALTERA_PLL_ResetPLL(); resetCore(); resetPeripheral(); @@ -468,6 +480,127 @@ int setDefaultDacs() { return ret; } +int readConfigFile() { + + if (initError == FAIL) { + return initError; + } + + const int fileNameSize = 128; + char fname[fileNameSize]; + if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) { + return FAIL; + } + + // open config file + FILE *fd = fopen(fname, "r"); + if (fd == NULL) { + sprintf(initErrorMessage, + "Could not open on-board detector server config file [%s].\n", + CONFIG_FILE); + initError = FAIL; + LOG(logERROR, ("%s\n\n", initErrorMessage)); + return FAIL; + } + + LOG(logINFOBLUE, ("Reading config file %s\n", CONFIG_FILE)); + + // Initialization + const size_t LZ = 256; + char line[LZ]; + memset(line, 0, LZ); + char command[LZ]; + + // keep reading a line + while (fgets(line, LZ, fd)) { + + // ignore comments + if (line[0] == '#') { + LOG(logDEBUG1, ("Ignoring Comment\n")); + continue; + } + + // ignore empty lines + if (strlen(line) <= 1) { + LOG(logDEBUG1, ("Ignoring Empty line\n")); + continue; + } + + // removing leading spaces + if (line[0] == ' ' || line[0] == '\t') { + int len = strlen(line); + // find first valid character + int i = 0; + for (i = 0; i < len; ++i) { + if (line[i] != ' ' && line[i] != '\t') { + break; + } + } + // ignore the line full of spaces (last char \n) + if (i >= len - 1) { + LOG(logDEBUG1, ("Ignoring line full of spaces\n")); + continue; + } + // copying only valid char + char temp[LZ]; + memset(temp, 0, LZ); + memcpy(temp, line + i, strlen(line) - i); + memset(line, 0, LZ); + memcpy(line, temp, strlen(temp)); + LOG(logDEBUG1, ("Removing leading spaces.\n")); + } + + LOG(logDEBUG1, ("Command to process: (size:%d) %.*s\n", strlen(line), + strlen(line) - 1, line)); + memset(command, 0, LZ); + + // chipversion command + if (!strncmp(line, "chipversion", strlen("chipversion"))) { + int version = 0; + + // cannot scan values + if (sscanf(line, "%s %d", command, &version) != 2) { + sprintf( + initErrorMessage, + "Could not scan chipversion commands from on-board server " + "config file. Line:[%s].\n", + line); + break; + } + // validations + if (version != 10 && version != 11) { + sprintf(initErrorMessage, + "Could not set chip version from on-board server " + "config file. Invalid chip version %d. Line:[%s].\n", + version, line); + break; + } + + // validations + chipVersion = version; + LOG(logINFOBLUE, ("Chip Version: v%.01f\n", chipVersion / 10.0)); + + // version 1.1 and HW 1.0 (version reg value = 2) is incompatible + if (chipVersion == 11 && isHardwareVersion2()) { + strcpy(initErrorMessage, + "Chip version 1.1 (from on-board config file) is incompatible with old board (v1.0). Please update board or correct on-board config file.\n"); + break; + } + } + + memset(line, 0, LZ); + } + fclose(fd); + + if (strlen(initErrorMessage)) { + initError = FAIL; + LOG(logERROR, ("%s\n\n", initErrorMessage)); + } else { + LOG(logINFOBLUE, ("Successfully read config file\n")); + } + return initError; +} + /* firmware functions (resets) */ void cleanFifos() { diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h index 9877917c6..9f347f047 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h @@ -3,8 +3,8 @@ #include "sls/sls_detector_defs.h" #define MIN_REQRD_VRSN_T_RD_API 0x171220 -#define REQRD_FRMWRE_VRSN_BOARD2 0x210218 // 1.0 pcb -#define REQRD_FRMWRE_VRSN 0x200721 // 2.0 pcb +#define REQRD_FRMWRE_VRSN_BOARD2 0x210621 // 1.0 pcb +#define REQRD_FRMWRE_VRSN 0x210622 // 2.0 pcb #define CTRL_SRVR_INIT_TIME_US (300 * 1000) @@ -77,6 +77,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS }; #define CLK_SYNC (20) // MHz #define ADC_CLK_INDEX (1) #define DBIT_CLK_INDEX (0) +#define CONFIG_FILE ("config_jungfrau.txt") /** Default Parameters */ #define DEFAULT_NUM_FRAMES (100 * 1000 * 1000) diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index 65acee737..215b4752f 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer index c6a8752f1..fd9b15709 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h index ef4354f82..35f53caef 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h @@ -21,7 +21,7 @@ #define TYPE_FILE_NAME ("/etc/devlinks/type") #define DAC_MAX_MV (2048) #define TYPE_MYTHEN3_MODULE_VAL (93) -#define TYPE_TOLERANCE (10) +#define TYPE_TOLERANCE (5) #define TYPE_NO_MODULE_STARTING_VAL (800) #define MAX_EXT_SIGNALS (8) diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h index fea7c5cfc..c886b8865 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h @@ -87,6 +87,7 @@ u_int16_t getHardwareSerialNumber(); #endif #ifdef JUNGFRAUD int isHardwareVersion2(); +int getChipVersion(); #endif #if defined(EIGERD) || defined(MYTHEN3D) void readDetectorNumber(); @@ -122,7 +123,7 @@ int setDefaultDacs(); void setASICDefaults(); void setADIFDefaults(); #endif -#if defined(GOTTHARD2D) || defined(EIGERD) +#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD) int readConfigFile(); #endif #ifdef EIGERD diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h index f9c86e9c1..05414d4e7 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h @@ -253,3 +253,4 @@ int get_veto_stream(int); int set_veto_stream(int); int get_veto_algorithm(int); int set_veto_algorithm(int); +int get_chip_version(int); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 6637c78f3..c7f05ed21 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -379,6 +379,7 @@ void function_table() { flist[F_SET_VETO_STREAM] = &set_veto_stream; flist[F_GET_VETO_ALGORITHM] = &get_veto_algorithm; flist[F_SET_VETO_ALGORITHM] = &set_veto_algorithm; + flist[F_GET_CHIP_VERSION] = &get_chip_version; // check if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) { @@ -8432,4 +8433,17 @@ int set_veto_algorithm(int file_des) { } #endif return Server_SendResult(file_des, INT32, NULL, 0); +} + +int get_chip_version(int file_des) { + ret = OK; + memset(mess, 0, sizeof(mess)); + int retval = -1; +#ifndef JUNGFRAUD + functionNotImplemented(); +#else + retval = getChipVersion(); +#endif + LOG(logDEBUG1, ("chip version retval: %d\n", retval)); + return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); } \ No newline at end of file diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 69d6102c9..58b8ac9c6 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -1081,6 +1081,9 @@ class Detector { * * * ************************************************/ + /** [Jungfrau] */ + Result getChipVersion(Positions pos = {}) const; + /** [Jungfrau] */ Result getThresholdTemperature(Positions pos = {}) const; diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index d41420f07..cb4319518 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -918,6 +918,7 @@ class CmdProxy { {"datastream", &CmdProxy::DataStream}, /* Jungfrau Specific */ + {"chipversion", &CmdProxy::chipversion}, {"temp_threshold", &CmdProxy::temp_threshold}, {"temp_control", &CmdProxy::temp_control}, {"temp_event", &CmdProxy::TemperatureEvent}, @@ -1812,6 +1813,9 @@ class CmdProxy { /* Jungfrau Specific */ + GET_COMMAND(chipversion, getChipVersion, + "\n\t[Jungfrau] Returns chip version. Can be 1.0 or 1.1"); + INTEGER_COMMAND_VEC_ID( temp_threshold, getThresholdTemperature, setThresholdTemperature, StringTo, diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index a8ba03d68..02abbad9f 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -1398,6 +1398,9 @@ void Detector::setDataStream(const defs::portPosition port, const bool enable, } // Jungfrau Specific +Result Detector::getChipVersion(Positions pos) const { + return pimpl->Parallel(&Module::getChipVersion, pos); +} Result Detector::getThresholdTemperature(Positions pos) const { return pimpl->Parallel(&Module::getThresholdTemperature, pos); diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 9d6f1e316..03d67f030 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -1522,6 +1522,9 @@ void Module::setDataStream(const portPosition port, const bool enable) { } // Jungfrau Specific +double Module::getChipVersion() const { + return (sendToDetector(F_GET_CHIP_VERSION)) / 10.00; +} int Module::getThresholdTemperature() const { auto retval = sendToDetectorStop(F_THRESHOLD_TEMP, GET_FLAG); diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 07fc117db..e9a5663a9 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -351,6 +351,7 @@ class Module : public virtual slsDetectorDefs { * Jungfrau Specific * * * * ************************************************/ + double getChipVersion() const; int getThresholdTemperature() const; void setThresholdTemperature(int val); bool getTemperatureControl() const; diff --git a/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp b/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp index 9508daeee..069410689 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp @@ -190,6 +190,18 @@ TEST_CASE("temp_threshold", "[.cmd]") { } } +TEST_CASE("chipversion", "[.cmd]") { + Detector det; + CmdProxy proxy(&det); + auto det_type = det.getDetectorType().squash(); + if (det_type == defs::JUNGFRAU) { + REQUIRE_NOTHROW(proxy.Call("chipversion", {}, -1, GET)); + } else { + REQUIRE_THROWS(proxy.Call("chipversion", {}, -1, GET)); + } + REQUIRE_THROWS(proxy.Call("chipversion", {"0"}, -1, PUT)); +} + TEST_CASE("temp_control", "[.cmd]") { Detector det; CmdProxy proxy(&det); diff --git a/slsSupportLib/include/sls/sls_detector_funcs.h b/slsSupportLib/include/sls/sls_detector_funcs.h index a81e69d7b..f517fd26a 100755 --- a/slsSupportLib/include/sls/sls_detector_funcs.h +++ b/slsSupportLib/include/sls/sls_detector_funcs.h @@ -230,6 +230,7 @@ enum detFuncs { F_SET_VETO_STREAM, F_GET_VETO_ALGORITHM, F_SET_VETO_ALGORITHM, + F_GET_CHIP_VERSION, NUM_DET_FUNCTIONS, RECEIVER_ENUM_START = 256, /**< detector function should not exceed this @@ -566,6 +567,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_SET_VETO_STREAM: return "F_SET_VETO_STREAM"; case F_GET_VETO_ALGORITHM: return "F_GET_VETO_ALGORITHM"; case F_SET_VETO_ALGORITHM: return "F_SET_VETO_ALGORITHM"; + case F_GET_CHIP_VERSION: return "F_GET_CHIP_VERSION"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START"; diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index fef718cf1..00187dfe0 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -3,10 +3,10 @@ #define APILIB 0x210225 #define APIRECEIVER 0x210225 #define APIGUI 0x210225 -#define APICTB 0x210722 -#define APIGOTTHARD 0x210722 -#define APIGOTTHARD2 0x210722 -#define APIJUNGFRAU 0x210722 -#define APIMYTHEN3 0x210722 -#define APIMOENCH 0x210722 -#define APIEIGER 0x210722 +#define APICTB 0x210727 +#define APIGOTTHARD 0x210727 +#define APIGOTTHARD2 0x210727 +#define APIMYTHEN3 0x210727 +#define APIMOENCH 0x210727 +#define APIEIGER 0x210727 +#define APIJUNGFRAU 0x210727