From 69356cf232af3863a12f52cc936aefc805a76084 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 5 Aug 2021 17:50:46 +0200 Subject: [PATCH] filterresitsitor only in chipv1.1 --- .../src/slsDetectorServer_funcs.c | 25 ++++++++++++++++--- slsDetectorSoftware/tests/test-CmdProxy.cpp | 9 ++++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 506602d64..5027f3fe3 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -7782,8 +7782,18 @@ int get_filter_resistor(int file_des) { functionNotImplemented(); #else // get only - retval = getFilterResistor(); - LOG(logDEBUG1, ("filter resistor retval: %u\n", retval)); +#ifdef JUNGFRAUD + if (getChipVersion() == 10) { + ret = FAIL; + strcpy(mess, "Could not get filter cell. Not available for this chip " + "version 1.0.\n"); + LOG(logERROR, (mess)); + } +#endif + if (ret == OK) { + retval = getFilterResistor(); + LOG(logDEBUG1, ("filter resistor retval: %u\n", retval)); + } #endif return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); } @@ -7809,7 +7819,16 @@ int set_filter_resistor(int file_des) { "Options [0-%d]\n", arg, ASIC_FILTER_MAX_RES_VALUE); LOG(logERROR, (mess)); - } else { + } +#ifdef JUNGFRAUD + else if (getChipVersion() == 10) { + ret = FAIL; + strcpy(mess, "Could not set filter cell. Not available for this " + "chip version 1.0.\n"); + LOG(logERROR, (mess)); + } +#endif + else { ret = setFilterResistor(arg); if (ret == FAIL) { ret = FAIL; diff --git a/slsDetectorSoftware/tests/test-CmdProxy.cpp b/slsDetectorSoftware/tests/test-CmdProxy.cpp index 962a480ec..6e2d89855 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy.cpp @@ -1384,7 +1384,14 @@ TEST_CASE("filterresistor", "[.cmd]") { CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); - if (det_type == defs::GOTTHARD2 || det_type == defs::JUNGFRAU) { + // only for chipv1.1 + bool chip11 = false; + if (det_type == defs::JUNGFRAU && + det.getChipVersion().squash() * 10 == 11) { + chip11 = true; + } + + if (det_type == defs::GOTTHARD2 || chip11) { auto prev_val = det.getFilterResistor(); { std::ostringstream oss;