From d3bbb50fc8eca1c2f9cd9e6de7e9a0b03e32b102 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 5 Aug 2021 17:41:21 +0200 Subject: [PATCH] wip --- slsDetectorSoftware/src/CmdProxy.h | 8 +++- .../tests/test-CmdProxy-jungfrau.cpp | 44 +++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index 0bde34e55..1e08df708 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -934,6 +934,7 @@ class CmdProxy { {"storagecell_start", &CmdProxy::storagecell_start}, {"storagecell_delay", &CmdProxy::storagecell_delay}, {"gainmode", &CmdProxy::gainmode}, + {"filtercell", &CmdProxy::filtercell}, /* Gotthard Specific */ {"roi", &CmdProxy::ROI}, @@ -1888,8 +1889,11 @@ class CmdProxy { sls::StringTo, "[dynamicgain|forceswitchg1|forceswitchg2|fixg1|fixg2|fixg0]\n\t[" "Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, " - "you can " - "damage the detector!!!"); + "you can damage the detector!!!"); + + INTEGER_COMMAND_VEC_ID( + filtercell, getFilterCell, setFilterCell, sls::StringTo, + "[0-12]\n\t[Jungfrau] Set Filter Cell. Advanced user Command"); /* Gotthard Specific */ TIME_GET_COMMAND(exptimel, getExptimeLeft, diff --git a/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp b/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp index 3fddd6f26..fbf2421fb 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp @@ -488,3 +488,47 @@ TEST_CASE("gainmode", "[.cmd]") { REQUIRE_THROWS(proxy.Call("gainmode", {}, -1, GET)); } } + +TEST_CASE("filtercell", "[.cmd]") { + Detector det; + CmdProxy proxy(&det); + auto det_type = det.getDetectorType().squash(); + if (det_type == defs::JUNGFRAU) { + // chip version 1.1 + if (det.getChipVersion().squash() * 10 == 11) { + auto prev_val = det.getFilterCell().tsquash( + "inconsistent #additional storage cells to test"); + { + std::ostringstream oss; + proxy.Call("filtercell", {"1"}, -1, PUT, oss); + REQUIRE(oss.str() == "filtercell 1\n"); + } + { + std::ostringstream oss; + proxy.Call("filtercell", {"15"}, -1, PUT, oss); + REQUIRE(oss.str() == "filtercell 15\n"); + } + { + std::ostringstream oss; + proxy.Call("filtercell", {"0"}, -1, PUT, oss); + REQUIRE(oss.str() == "filtercell 0\n"); + } + { + std::ostringstream oss; + proxy.Call("filtercell", {}, -1, GET, oss); + REQUIRE(oss.str() == "filtercell 0\n"); + } + REQUIRE_THROWS(proxy.Call("filtercell", {"16"}, -1, PUT)); + det.setFilterCell(prev_val); + } + // chip version 1.0 + else { + // cannot set/get filter cell + REQUIRE_THROWS(proxy.Call("filtercell", {"1"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET)); + } + } else { + REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET)); + REQUIRE_THROWS(proxy.Call("filtercell", {"0"}, -1, PUT)); + } +} \ No newline at end of file