diff --git a/RELEASE.txt b/RELEASE.txt index 4d51875b4..b606a0420 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -73,7 +73,8 @@ vetoalg vetostream serialnumber (put) dbitpipeline -readnlines->partialread +readnlines->readnrows +serialnumber->moduleid setting number of udp interfaces from 1 to 2, didnt get image in gui diff --git a/slsDetectorServers/eigerDetectorServer/Beb.c b/slsDetectorServers/eigerDetectorServer/Beb.c index caf0ec7b1..34af7b937 100644 --- a/slsDetectorServers/eigerDetectorServer/Beb.c +++ b/slsDetectorServers/eigerDetectorServer/Beb.c @@ -1022,18 +1022,19 @@ int Beb_GetBebFPGATemp() { return temperature; } -void Beb_SetDetectorNumber(uint32_t detid) { +int Beb_SetModuleId(uint32_t detid) { if (!Beb_activated) - return; + return OK; uint32_t swapid = Beb_swap_uint16(detid); // LOG(logINFO, "detector id %d swapped %d\n", detid, swapid)); u_int32_t *csp0base = 0; int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_TEST_BASEADDR); if (fd < 0) { - LOG(logERROR, ("Set Detector ID FAIL\n")); - return; + LOG(logERROR, ("Set module id FAIL\n")); + return FAIL; } else { + // left uint32_t value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST); value &= UDP_HEADER_X_MSK; // to keep previous x value Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, @@ -1042,8 +1043,11 @@ void Beb_SetDetectorNumber(uint32_t detid) { value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST); if ((value & UDP_HEADER_ID_MSK) != ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK)) { - LOG(logERROR, ("Set Detector ID FAIL\n")); + LOG(logERROR, ("Set module id FAIL\n")); + Beb_close(fd, csp0base); + return FAIL; } + // right value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST); value &= UDP_HEADER_X_MSK; // to keep previous x value Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, @@ -1052,11 +1056,13 @@ void Beb_SetDetectorNumber(uint32_t detid) { value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST); if ((value & UDP_HEADER_ID_MSK) != ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK)) { - LOG(logERROR, ("Set Detector ID FAIL\n")); + LOG(logERROR, ("Set module id FAIL\n")); + Beb_close(fd, csp0base); + return FAIL; } Beb_close(fd, csp0base); } - LOG(logINFO, ("Detector id %d set in UDP Header\n\n", detid)); + LOG(logINFO, ("Module id %d set in UDP Header\n\n", detid)); } int Beb_SetQuad(int value) { diff --git a/slsDetectorServers/eigerDetectorServer/Beb.h b/slsDetectorServers/eigerDetectorServer/Beb.h index 152db2dd5..ff2a3de5d 100644 --- a/slsDetectorServers/eigerDetectorServer/Beb.h +++ b/slsDetectorServers/eigerDetectorServer/Beb.h @@ -42,7 +42,7 @@ int Beb_StopAcquisition(); int Beb_RequestNImages(int ten_gig, unsigned int nimages, int test_just_send_out_packets_no_wait); int Beb_GetBebFPGATemp(); -void Beb_SetDetectorNumber(uint32_t detid); +int Beb_SetModuleId(uint32_t detid); int Beb_SetQuad(int value); int Beb_GetQuad(); int *Beb_GetDetectorPosition(); diff --git a/slsDetectorServers/eigerDetectorServer/CMakeLists.txt b/slsDetectorServers/eigerDetectorServer/CMakeLists.txt index e663d4569..a0f660f2e 100644 --- a/slsDetectorServers/eigerDetectorServer/CMakeLists.txt +++ b/slsDetectorServers/eigerDetectorServer/CMakeLists.txt @@ -100,3 +100,4 @@ install(TARGETS eigerDetectorServerSlaveBottom_virtual configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY) +configure_file(detid_eiger.txt ${CMAKE_BINARY_DIR}/bin/detid_eiger.txt COPYONLY) diff --git a/slsDetectorServers/eigerDetectorServer/Makefile b/slsDetectorServers/eigerDetectorServer/Makefile index 04370b148..10b0793ff 100755 --- a/slsDetectorServers/eigerDetectorServer/Makefile +++ b/slsDetectorServers/eigerDetectorServer/Makefile @@ -34,6 +34,7 @@ $(PROGS): $(OBJS) $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) mv $(PROGS) $(DESTDIR) cp config_eiger.txt $(DESTDIR) + cp detid.txt $(DESTDIR) hv9m_blackfin_server:9mhvserial_bf.c diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index 79b7c790f..dede44bfb 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -46,9 +46,6 @@ unsigned int nimages_per_request = 1; int top = 0; int master = 0; int normal = 0; -#ifndef VIRTUAL -uint32_t detid = 0; -#endif int eiger_highvoltage = 0; int eiger_theo_highvoltage = 0; @@ -222,25 +219,8 @@ u_int64_t getFirmwareAPIVersion() { #endif } -void readDetectorNumber() { -#ifndef VIRTUAL - char output[255]; - FILE *sysFile = popen(IDFILECOMMAND, "r"); - fgets(output, sizeof(output), sysFile); - pclose(sysFile); - sscanf(output, "%u", &detid); - if (isControlServer) { - LOG(logINFOBLUE, ("Detector ID: %u\n", detid)); - } -#endif -} - -u_int32_t getDetectorNumber() { -#ifdef VIRTUAL - return 0; -#else - return detid; -#endif +int getModuleId(int *ret, char *mess) { + return getModuleIdInFile(ret, mess, ID_FILE); } u_int64_t getDetectorMAC() { @@ -322,7 +302,14 @@ u_int32_t getDetectorIP() { void initControlServer() { LOG(logINFOBLUE, ("Configuring Control server\n")); if (!updateFlag && initError == OK) { - readDetectorNumber(); +#ifndef VIRTUAL + int detid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE); +#else + getModuleIdInFile(&initError, initErrorMessage, ID_FILE); +#endif + if (initError == FAIL) { + return; + } getModuleConfiguration(); #ifndef VIRTUAL sharedMemory_lockLocalLink(); @@ -355,7 +342,7 @@ void initControlServer() { LOG(logDEBUG1, ("Control server: FEB Initialization done\n")); Beb_SetTopVariable(top); Beb_Beb(); - Beb_SetDetectorNumber(getDetectorNumber()); + Beb_SetModuleId(detid); LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); #endif // also reads config file and deactivates diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h index 9a9d9bdce..c0a27c897 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h @@ -2,7 +2,11 @@ #include "sls/sls_detector_defs.h" #define REQUIRED_FIRMWARE_VERSION (27) -#define IDFILECOMMAND "more /home/root/executables/detid.txt" +#ifdef VIRTUAL +#define ID_FILE "detid_eiger.txt" +#else +#define ID_FILE "detid.txt" +#endif #define CONFIG_FILE ("config_eiger.txt") #define WAIT_STOP_SERVER_START (1 * 1000 * 1000) diff --git a/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt b/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt index 6fbb6a8d1..9cebb9e9f 100644 --- a/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt +++ b/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt @@ -40,3 +40,4 @@ install(TARGETS gotthard2DetectorServer_virtual ) configure_file(config_gotthard2.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard2.txt COPYONLY) +configure_file(detid_gotthard2.txt ${CMAKE_BINARY_DIR}/bin/detid_gotthard2.txt COPYONLY) diff --git a/slsDetectorServers/gotthard2DetectorServer/Makefile b/slsDetectorServers/gotthard2DetectorServer/Makefile index 000d778bb..fef345337 100755 --- a/slsDetectorServers/gotthard2DetectorServer/Makefile +++ b/slsDetectorServers/gotthard2DetectorServer/Makefile @@ -33,6 +33,7 @@ $(PROGS): $(OBJS) $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) mv $(PROGS) $(DESTDIR) cp config_gotthard2.txt $(DESTDIR) + cp detid_gotthard2.txt $s(DESTDIR) rm $(main_src)*.o clean: diff --git a/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h b/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h index 009a8d1eb..4da6dea3f 100644 --- a/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h +++ b/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h @@ -127,7 +127,6 @@ #define MOD_ID_OFST (0) #define MOD_ID_MSK (0x0000FFFF << MOD_ID_OFST) -#define MOD_MAX_VAL (0xFFFF) /* ASIC registers --------------------------------------------------*/ diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index fc09b7763..084a50951 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -287,16 +287,19 @@ u_int32_t getDetectorNumber() { return bus_r(MCB_SERIAL_NO_REG); } -int getModuleId() { return ((bus_r(MOD_ID_REG) & MOD_ID_MSK) >> MOD_ID_OFST); } +int getModuleId(int *ret, char *mess) { + return getModuleIdInFile(ret, mess, ID_FILE); +} -void setModuleId(int arg) { - LOG(logINFOBLUE, ("Setting Module Id to 0x%x\n", arg)); +void setModuleId(int *ret, char *mess, int arg) { + *ret = setModuleIdInFile(mess, arg, ID_FILE); + if (*ret == FAIL) { + return; + } bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) & ~MOD_ID_MSK); bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) | ((arg << MOD_ID_OFST) & MOD_ID_MSK)); } -int getMaxModuleId() { return MOD_MAX_VAL; } - u_int64_t getDetectorMAC() { #ifdef VIRTUAL return 0; @@ -419,7 +422,10 @@ void setupDetector() { sharedMemory_setStatus(IDLE); setupUDPCommParameters(); #endif - + getModuleIdInFile(&initError, initErrorMessage, ID_FILE); + if (initError == FAIL) { + return; + } // pll defines ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL, PLL_RESET_REG, PLL_RESET_READOUT_MSK, diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index 3cba7b4fd..2cc45638f 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -3,6 +3,7 @@ #define REQRD_FRMWRE_VRSN (0x210527) #define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020" +#define ID_FILE "detid_gotthard2.txt" #define CTRL_SRVR_INIT_TIME_US (300 * 1000) diff --git a/slsDetectorServers/mythen3DetectorServer/CMakeLists.txt b/slsDetectorServers/mythen3DetectorServer/CMakeLists.txt index 20476adfb..ea43df079 100644 --- a/slsDetectorServers/mythen3DetectorServer/CMakeLists.txt +++ b/slsDetectorServers/mythen3DetectorServer/CMakeLists.txt @@ -41,4 +41,5 @@ install(TARGETS mythen3DetectorServer_virtual RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -configure_file(DefaultPattern_mythen3.txt ${CMAKE_BINARY_DIR}/bin/DefaultPattern_mythen3.txt COPYONLY) \ No newline at end of file +configure_file(DefaultPattern_mythen3.txt ${CMAKE_BINARY_DIR}/bin/DefaultPattern_mythen3.txt COPYONLY) +configure_file(detid_mythen3.txt ${CMAKE_BINARY_DIR}/bin/detid_mythen3.txt COPYONLY) diff --git a/slsDetectorServers/mythen3DetectorServer/Makefile b/slsDetectorServers/mythen3DetectorServer/Makefile index 254fbd570..9c6c8827b 100755 --- a/slsDetectorServers/mythen3DetectorServer/Makefile +++ b/slsDetectorServers/mythen3DetectorServer/Makefile @@ -34,6 +34,7 @@ $(PROGS): $(OBJS) $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) mv $(PROGS) $(DESTDIR) cp DefaultPattern_mythen3.txt $(DESTDIR) + cp detid_mythen3.txt $(DESTDIR) rm $(main_src)*.o clean: diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 47ea022c4..6d3a22451 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -274,28 +274,17 @@ u_int16_t getHardwareVersionNumber() { MCB_SERIAL_NO_VRSN_OFST); } -void readDetectorNumber() { -#ifndef VIRTUAL - if (initError == FAIL) { - return; - } - FILE *fd = fopen(ID_FILE, "r"); - if (fd == NULL) { - sprintf(initErrorMessage, "No %s file found.\n", ID_FILE); - LOG(logERROR, ("%s\n\n", initErrorMessage)); - initError = FAIL; - return; - } - char output[255]; - fgets(output, sizeof(output), fd); - sscanf(output, "%u", &detID); - if (isControlServer) { - LOG(logINFOBLUE, ("Detector ID: %u\n", detID)); - } +u_int32_t getDetectorNumber() { +#ifdef VIRTUAL + return 0; #endif + return bus_r(MCB_SERIAL_NO_REG); } -u_int32_t getDetectorNumber() { return detID; } + +int getModuleId(int *ret, char *mess) { + return getModuleIdInFile(ret, mess, ID_FILE); +} u_int64_t getDetectorMAC() { #ifdef VIRTUAL @@ -481,7 +470,7 @@ void setupDetector() { #ifdef VIRTUAL enableTenGigabitEthernet(0); #endif - readDetectorNumber(); + getModuleIdInFile(&initError, initErrorMessage, ID_FILE); if (initError == FAIL) { return; } diff --git a/slsDetectorServers/slsDetectorServer/include/common.h b/slsDetectorServers/slsDetectorServer/include/common.h index cc7daf7e5..d0beaca28 100644 --- a/slsDetectorServers/slsDetectorServer/include/common.h +++ b/slsDetectorServers/slsDetectorServer/include/common.h @@ -28,3 +28,6 @@ void validate(int *ret, char *mess, int arg, int retval, char *modename, enum numberMode nummode); void validate64(int *ret, char *mess, int64_t arg, int64_t retval, char *modename, enum numberMode nummode); + +int getModuleIdInFile(int *ret, char *mess, char *fileName); +int setModuleIdInFile(char *mess, int arg, char *fileName); \ No newline at end of file diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h index 9f9baac0d..447d94ca5 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h @@ -89,14 +89,14 @@ u_int16_t getHardwareSerialNumber(); int isHardwareVersion2(); int getChipVersion(); #endif -#if defined(EIGERD) || defined(MYTHEN3D) -void readDetectorNumber(); -#endif +#ifndef EIGERD u_int32_t getDetectorNumber(); +#endif +#if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D) +int getModuleId(int *ret, char *mess); +#endif #ifdef GOTTHARD2D -int getModuleId(); -void setModuleId(int arg); -int getMaxModuleId(); +void setModuleId(int *ret, char *mess, int arg); #endif u_int64_t getDetectorMAC(); u_int32_t getDetectorIP(); diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c index bb5dfbfbc..08a172d06 100644 --- a/slsDetectorServers/slsDetectorServer/src/common.c +++ b/slsDetectorServers/slsDetectorServer/src/common.c @@ -7,9 +7,6 @@ #include #include // readlink -extern int ret; -extern char mess[MAX_STR_LENGTH]; - int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin, int outputMax, int inputValue, int *outputValue) { LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n", @@ -102,4 +99,82 @@ void validate64(int *ret, char *mess, int64_t arg, int64_t retval, (long long unsigned int)retval); LOG(logERROR, (mess)); } -} \ No newline at end of file +} + +int getModuleIdInFile(int *ret, char *mess, char *fileName) { + const int fileNameSize = 128; + char fname[fileNameSize]; + if (getAbsPath(fname, fileNameSize, fileName) == FAIL) { + *ret = FAIL; + strcpy(mess, "Could not find detid file\n"); + LOG(logERROR, ("%s\n\n", mess)); + return -1; + } + + // open id file + FILE *fd = fopen(fname, "r"); + if (fd == NULL) { + *ret = FAIL; + strcpy(mess, "Could not find detid file\n"); + LOG(logERROR, ("%s\n\n", mess)); + return -1; + } + LOG(logDEBUG1, ("Reading det id file %s\n", fileName)); + + // read line + const size_t len = 256; + char line[len]; + memset(line, 0, len); + if (NULL == fgets(line, len, fd)) { + *ret = FAIL; + strcpy(mess, "Could not find detid file\n"); + LOG(logERROR, ("%s\n\n", mess)); + return -1; + } + // read id + int retval = 0; + if (sscanf(line, "%x", &retval) != 1) { + *ret = FAIL; + sprintf(mess, + "Could not scan det id from on-board server " + "id file. Line:[%s].\n", + line); + LOG(logERROR, ("%s\n\n", mess)); + return -1; + } + LOG(logINFOBLUE, ("Module Id: 0x%x (File)\n", retval)); + return retval; +} + +int setModuleIdInFile(char *mess, int arg, char *fileName) { + LOG(logINFOBLUE, ("Setting Module Id: 0x%x (File)\n", arg)); + + const int fileNameSize = 128; + char fname[fileNameSize]; + if (getAbsPath(fname, fileNameSize, fileName) == FAIL) { + strcpy(mess, "Could not find detid file\n"); + LOG(logERROR, (mess)); + return FAIL; + } + + // open id file + FILE *fd = fopen(fname, "r"); + if (fd == NULL) { + strcpy(mess, "Could not find detid file\n"); + LOG(logERROR, (mess)); + return FAIL; + } + LOG(logDEBUG1, ("Writing det id to file %s\n", fileName)); + + // write id + const size_t len = 256; + char line[len]; + memset(line, 0, len); + sprintf(line, "%x", arg); + if (EOF == fputs(line, fd)) { + strcpy(mess, "Could not write to detid file\n"); + LOG(logERROR, (mess)); + return FAIL; + } + return OK; +} diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index f5e513c3a..fdaab4dfb 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -684,8 +684,12 @@ int get_serial_number(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); int64_t retval = -1; +#ifdef EIGERD + functionNotImplemented(); +#else retval = getDetectorNumber(); LOG(logDEBUG1, ("detector number retval: 0x%llx\n", (long long int)retval)); +#endif return Server_SendResult(file_des, INT64, &retval, sizeof(retval)); } @@ -9016,12 +9020,12 @@ int get_module_id(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); int retval = -1; -#ifndef GOTTHARD2D +#if !(defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D)) functionNotImplemented(); #else - retval = getModuleId(); -#endif + retval = getModuleId(&ret, mess); LOG(logDEBUG1, ("module id retval: 0x%x\n", retval)); +#endif return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); } @@ -9037,16 +9041,17 @@ int set_module_id(int file_des) { #ifndef GOTTHARD2D functionNotImplemented(); #else - if (arg > getMaxModuleId()) { + if (arg > 0xFFFF) { ret = FAIL; - sprintf(mess, "Could not set module id. Max value: 0x%x\n", - getMaxModuleId()); + sprintf(mess, "Could not set module id. Max value: 0x%x\n", 0xFFFF); LOG(logERROR, (mess)); } else { - setModuleId(arg); - int retval = getModuleId(); - LOG(logDEBUG1, ("retval module id: %d\n", retval)); - validate(&ret, mess, arg, retval, "set module id", DEC); + setModuleId(&ret, mess, arg); + if (ret != FAIL) { + int retval = getModuleId(&ret, mess); + LOG(logDEBUG1, ("retval module id: %d\n", retval)); + validate(&ret, mess, arg, retval, "set module id", DEC); + } } #endif return Server_SendResult(file_des, INT32, NULL, 0); diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 323d903cf..960c0545d 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -78,13 +78,14 @@ class Detector { Result getDetectorServerVersion(Positions pos = {}) const; + /* [Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench] */ Result getSerialNumber(Positions pos = {}) const; - /** [Gotthard2] */ + /** [Eiger][Gotthard2][Mythen3] */ Result getModuleId(Positions pos = {}) const; /** [Gotthard2] 6 bit value (ideally unique) that is " - "streamed out1 in the UDP header of the detector. Default is 0. */ + "streamed out1 in the UDP header of the detector. */ void setModuleId(const int value, Positions pos = {}); Result getReceiverVersion(Positions pos = {}) const; diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index d87b1ac5e..d1e536f37 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -1200,12 +1200,14 @@ class CmdProxy { "\n\tReceiver version in format [0xYYMMDD]."); GET_COMMAND_HEX(serialnumber, getSerialNumber, - "\n\tSerial number of detector."); + "\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]" + "Serial number of detector."); INTEGER_COMMAND_HEX( moduleid, getModuleId, setModuleId, StringTo, - "[value]\n\t[Gotthard2] 16 bit value (ideally unique) that is " - "streamed out in the UDP header of the detector. Default is 0."); + "[value]\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) " + "that is streamed out in the UDP header of the detector. " + "\n\t[Gotthard2] Can set it too."); GET_COMMAND(type, getDetectorType, "\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, " diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index eec664998..dc3769cae 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -416,14 +416,14 @@ void Module::loadSettingsFile(const std::string &fname) { if (shm()->myDetectorType == EIGER || shm()->myDetectorType == MYTHEN3) { std::ostringstream ostfn; ostfn << fname; - int serialNumberWidth = 3; + int moduleIdWidth = 3; if (shm()->myDetectorType == MYTHEN3) { - serialNumberWidth = 4; + moduleIdWidth = 4; } if ((fname.find(".sn") == std::string::npos) && (fname.find(".trim") == std::string::npos)) { - ostfn << ".sn" << std::setfill('0') << std::setw(serialNumberWidth) - << std::dec << getSerialNumber(); + ostfn << ".sn" << std::setfill('0') << std::setw(moduleIdWidth) + << std::dec << getModuleId(); } auto myMod = readSettingsFile(ostfn.str()); setModule(myMod); @@ -3326,12 +3326,12 @@ std::string Module::getTrimbitFilename(detectorSettings s, int e_eV) { throw RuntimeError( "Settings or trimbit files not defined for this detector."); } - int serialNumberWidth = 3; + int moduleIdWidth = 3; if (shm()->myDetectorType == MYTHEN3) { - serialNumberWidth = 4; + moduleIdWidth = 4; } - ostfn << std::setfill('0') << std::setw(serialNumberWidth) << std::dec - << getSerialNumber() << std::setbase(10); + ostfn << std::setfill('0') << std::setw(moduleIdWidth) << std::dec + << getModuleId() << std::setbase(10); return ostfn.str(); }