jungfrau: api changed from set/getFilterCell to set/getNumberOfFilterCells, storagecells command line changed to extrastoragecells, fixed wrong numberof arguments parsing message

This commit is contained in:
maliakal_d 2021-10-21 11:59:10 +02:00
parent 9b321d2ee1
commit 76dc6db5c0
16 changed files with 89 additions and 83 deletions

View File

@ -46,6 +46,8 @@ This document describes the differences between v6.0.0 and v5.1.0.
Additional number of storage cells not applicable for chipv1.1. Additional number of storage cells not applicable for chipv1.1.
Storage cell start is only allowed from 0 - 3 for chipv1.1 Storage cell start is only allowed from 0 - 3 for chipv1.1
(0 - 15 for chipv1.0). (0 - 15 for chipv1.0).
Command line: extrastoragecells, Previous Command line: storagecells
API: remains the same.
6. [Gotthard2][Jungfrau] Filter Resistor 6. [Gotthard2][Jungfrau] Filter Resistor
Command line: filterresistor, API: getFilterResistor/ setFilterResistor Command line: filterresistor, API: getFilterResistor/ setFilterResistor
@ -55,7 +57,7 @@ This document describes the differences between v6.0.0 and v5.1.0.
[Gotthard2] Options: [0|1|2|3]. Default is 0. [Gotthard2] Options: [0|1|2|3]. Default is 0.
7. [Jungfrau] Filter cell (only chipv1.1) 7. [Jungfrau] Filter cell (only chipv1.1)
Command line: filtercell, API: getFilterCell/ setFilterCell Command line: filtercells, API: getNumberOfFilterCells/ setNumberOfFilterCells
Set filter cell. Options: [0-12]. Advanced user command. Set filter cell. Options: [0-12]. Advanced user command.
8. [Jungfrau] Comparator disable time (only chipv1.1) 8. [Jungfrau] Comparator disable time (only chipv1.1)

View File

@ -2299,11 +2299,11 @@ class Detector(CppDetectorApi):
---- ----
[Jungfrau] Options: 0-12. Default: 0. Advanced user command. Only for chipv1.1. [Jungfrau] Options: 0-12. Default: 0. Advanced user command. Only for chipv1.1.
""" """
return self.getFilterCell() return self.getNumberOfFilterCells()
@filtercells.setter @filtercells.setter
def filtercells(self, value): def filtercells(self, value):
ut.set_using_dict(self.setFilterCell, value) ut.set_using_dict(self.setNumberOfFilterCells, value)
@property @property
def maxclkphaseshift(self): def maxclkphaseshift(self):

View File

@ -1072,13 +1072,13 @@ void init_det(py::module &m) {
(void (Detector::*)(const defs::gainMode, sls::Positions)) & (void (Detector::*)(const defs::gainMode, sls::Positions)) &
Detector::setGainMode, Detector::setGainMode,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getFilterCell", .def("getNumberOfFilterCells",
(Result<int>(Detector::*)(sls::Positions) const) & (Result<int>(Detector::*)(sls::Positions) const) &
Detector::getFilterCell, Detector::getNumberOfFilterCells,
py::arg() = Positions{}) py::arg() = Positions{})
.def("setFilterCell", .def("setNumberOfFilterCells",
(void (Detector::*)(int, sls::Positions)) & (void (Detector::*)(int, sls::Positions)) &
Detector::setFilterCell, Detector::setNumberOfFilterCells,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getROI", .def("getROI",
(Result<defs::ROI>(Detector::*)(sls::Positions) const) & (Result<defs::ROI>(Detector::*)(sls::Positions) const) &

View File

@ -1201,7 +1201,7 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt;#&lt;span style=&quot; font-family:'Droid Sans Mono,monospace,monospace,Droid Sans Fallback'; font-size:14px; color:#ce9178;&quot;&gt;extrastoragecells#&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Number of Storage cells:</string> <string>Number of Storage cells:</string>
@ -1402,7 +1402,7 @@ Default value is 0. A value less than the required minimum is ignored.
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt;#&lt;span style=&quot; font-family:'Droid Sans Mono,monospace,monospace,Droid Sans Fallback'; font-size:14px; color:#ce9178;&quot;&gt;extrastoragecells&lt;/span&gt;#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="statusTip"> <property name="statusTip">
<string/> <string/>

View File

@ -498,7 +498,7 @@ void setupDetector() {
setFlipRows(DEFAULT_FLIP_ROWS); setFlipRows(DEFAULT_FLIP_ROWS);
if (getChipVersion() == 11) { if (getChipVersion() == 11) {
setFilterResistor(DEFAULT_FILTER_RESISTOR); setFilterResistor(DEFAULT_FILTER_RESISTOR);
setFilterCell(DEFAULT_FILTER_CELL); setNumberOfFilterCells(DEFAULT_FILTER_CELL);
} }
setReadNRows(MAX_ROWS_PER_READOUT); setReadNRows(MAX_ROWS_PER_READOUT);
} }
@ -2206,7 +2206,7 @@ int setFilterResistor(int value) {
return FAIL; return FAIL;
} }
int getFilterCell() { int getNumberOfFilterCells() {
#ifdef VIRTUAL #ifdef VIRTUAL
uint32_t addr = CONFIG_V11_REG; uint32_t addr = CONFIG_V11_REG;
#else #else
@ -2223,7 +2223,7 @@ int getFilterCell() {
return (__builtin_popcount(retval)); return (__builtin_popcount(retval));
} }
void setFilterCell(int iCell) { void setNumberOfFilterCells(int iCell) {
if (iCell > MAX_FILTER_CELL_VAL) { if (iCell > MAX_FILTER_CELL_VAL) {
return; return;
} }
@ -2240,8 +2240,8 @@ void setFilterCell(int iCell) {
bus_w(addr, bus_r(addr) | ((value << CONFIG_V11_FLTR_CLL_OFST) & bus_w(addr, bus_r(addr) | ((value << CONFIG_V11_FLTR_CLL_OFST) &
CONFIG_V11_FLTR_CLL_MSK)); CONFIG_V11_FLTR_CLL_MSK));
} }
LOG(logINFO, LOG(logINFO, ("Setting Number of Filter Cells to %d [Reg:0x%x]\n", iCell,
("Setting Filter Cell to %d [Reg:0x%x]\n", iCell, bus_r(addr))); bus_r(addr)));
} }
void disableCurrentSource() { void disableCurrentSource() {

View File

@ -486,8 +486,8 @@ int getFlipRows();
void setFlipRows(int arg); void setFlipRows(int arg);
int setFilterResistor(int value); int setFilterResistor(int value);
int getFilterResistor(); int getFilterResistor();
int getFilterCell(); int getNumberOfFilterCells();
void setFilterCell(int iCell); void setNumberOfFilterCells(int iCell);
void disableCurrentSource(); void disableCurrentSource();
void enableCurrentSource(int fix, uint64_t select, int normal); void enableCurrentSource(int fix, uint64_t select, int normal);
int getCurrentSource(); int getCurrentSource();

View File

@ -262,8 +262,8 @@ int get_comp_disable_time(int);
int set_comp_disable_time(int); int set_comp_disable_time(int);
int get_flip_rows(int); int get_flip_rows(int);
int set_flip_rows(int); int set_flip_rows(int);
int get_filter_cell(int); int get_num_filter_cells(int);
int set_filter_cell(int); int set_num_filter_cells(int);
int set_adc_pipeline(int); int set_adc_pipeline(int);
int get_adc_pipeline(int); int get_adc_pipeline(int);
int set_dbit_pipeline(int); int set_dbit_pipeline(int);

View File

@ -399,8 +399,8 @@ void function_table() {
flist[F_SET_COMP_DISABLE_TIME] = &set_comp_disable_time; flist[F_SET_COMP_DISABLE_TIME] = &set_comp_disable_time;
flist[F_GET_FLIP_ROWS] = &get_flip_rows; flist[F_GET_FLIP_ROWS] = &get_flip_rows;
flist[F_SET_FLIP_ROWS] = &set_flip_rows; flist[F_SET_FLIP_ROWS] = &set_flip_rows;
flist[F_GET_FILTER_CELL] = &get_filter_cell; flist[F_GET_NUM_FILTER_CELLS] = &get_num_filter_cells;
flist[F_SET_FILTER_CELL] = &set_filter_cell; flist[F_SET_NUM_FILTER_CELLS] = &set_num_filter_cells;
flist[F_SET_ADC_PIPELINE] = &set_adc_pipeline; flist[F_SET_ADC_PIPELINE] = &set_adc_pipeline;
flist[F_GET_ADC_PIPELINE] = &get_adc_pipeline; flist[F_GET_ADC_PIPELINE] = &get_adc_pipeline;
flist[F_SET_DBIT_PIPELINE] = &set_dbit_pipeline; flist[F_SET_DBIT_PIPELINE] = &set_dbit_pipeline;
@ -8886,31 +8886,31 @@ int set_flip_rows(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }
int get_filter_cell(int file_des) { int get_num_filter_cells(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int retval = -1; int retval = -1;
LOG(logDEBUG1, ("Getting filter cell\n")); LOG(logDEBUG1, ("Getting number of filter cellsn"));
#ifndef JUNGFRAUD #ifndef JUNGFRAUD
functionNotImplemented(); functionNotImplemented();
#else #else
// get only // get only
retval = getFilterCell(); retval = getNumberOfFilterCells();
LOG(logDEBUG1, ("filter cell retval: %u\n", retval)); LOG(logDEBUG1, ("num filter cells retval: %u\n", retval));
#endif #endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
} }
int set_filter_cell(int file_des) { int set_num_filter_cells(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int arg = -1; int arg = -1;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
LOG(logDEBUG1, ("Setting filter cell: %u\n", (int)arg)); LOG(logDEBUG1, ("Setting number of filter cells: %u\n", (int)arg));
#ifndef JUNGFRAUD #ifndef JUNGFRAUD
functionNotImplemented(); functionNotImplemented();
@ -8921,7 +8921,8 @@ int set_filter_cell(int file_des) {
if (arg < 0 || arg > MAX_FILTER_CELL_VAL) { if (arg < 0 || arg > MAX_FILTER_CELL_VAL) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set filter cell. Invalid argument %d. Options: " "Could not set number of filter cells. Invalid argument "
"%d. Options: "
"0 - %d\n", "0 - %d\n",
arg, MAX_FILTER_CELL_VAL); arg, MAX_FILTER_CELL_VAL);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
@ -8929,11 +8930,12 @@ int set_filter_cell(int file_des) {
// only for chipv1.1 // only for chipv1.1
else if (getChipVersion() == 10) { else if (getChipVersion() == 10) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Could not set filter cell. Only available for " strcpy(mess,
"chip version 1.1\n"); "Could not set number of filter cells. Only available for "
"chip version 1.1\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
setFilterCell(arg); setNumberOfFilterCells(arg);
// no validation as it might take time to update status register if // no validation as it might take time to update status register if
// acquiring // acquiring
} }

View File

@ -1240,11 +1240,11 @@ class Detector {
void setGainMode(const defs::gainMode mode, Positions pos = {}); void setGainMode(const defs::gainMode mode, Positions pos = {});
/** [Jungfrau] Advanced */ /** [Jungfrau] Advanced */
Result<int> getFilterCell(Positions pos = {}) const; Result<int> getNumberOfFilterCells(Positions pos = {}) const;
/** [Jungfrau] Advanced Options[0-12], only for chip v1.1 /** [Jungfrau] Advanced Options[0-12], only for chip v1.1
*/ */
void setFilterCell(int cell, Positions pos = {}); void setNumberOfFilterCells(int cell, Positions pos = {});
///@{ ///@{

View File

@ -87,9 +87,9 @@ void CmdProxy::WrongNumberOfParameters(size_t expected) {
" expected no parameter/s but got " + " expected no parameter/s but got " +
std::to_string(args.size()) + "\n"); std::to_string(args.size()) + "\n");
} }
throw RuntimeError( throw RuntimeError("Command " + cmd + " expected (or >=) " +
"Command " + cmd + " expected >=" + std::to_string(expected) + std::to_string(expected) + " parameter/s but got " +
" parameter/s but got " + std::to_string(args.size()) + "\n"); std::to_string(args.size()) + "\n");
} }
/************************************************ /************************************************

View File

@ -725,6 +725,8 @@ class CmdProxy {
{"resmat", "partialreset"}, {"resmat", "partialreset"},
/* Jungfrau Specific */ /* Jungfrau Specific */
{"storagecells", "extrastoragecells"},
/* Gotthard Specific */ /* Gotthard Specific */
/* Gotthard2 Specific */ /* Gotthard2 Specific */
/* Mythen3 Specific */ /* Mythen3 Specific */
@ -944,7 +946,7 @@ class CmdProxy {
{"temp_event", &CmdProxy::TemperatureEvent}, {"temp_event", &CmdProxy::TemperatureEvent},
{"auto_comp_disable", &CmdProxy::auto_comp_disable}, {"auto_comp_disable", &CmdProxy::auto_comp_disable},
{"comp_disable_time", &CmdProxy::comp_disable_time}, {"comp_disable_time", &CmdProxy::comp_disable_time},
{"storagecells", &CmdProxy::storagecells}, {"extrastoragecells", &CmdProxy::extrastoragecells},
{"storagecell_start", &CmdProxy::storagecell_start}, {"storagecell_start", &CmdProxy::storagecell_start},
{"storagecell_delay", &CmdProxy::storagecell_delay}, {"storagecell_delay", &CmdProxy::storagecell_delay},
{"gainmode", &CmdProxy::gainmode}, {"gainmode", &CmdProxy::gainmode},
@ -1923,12 +1925,12 @@ class CmdProxy {
"only possible for chipv1.1."); "only possible for chipv1.1.");
INTEGER_COMMAND_SET_NOID_GET_ID( INTEGER_COMMAND_SET_NOID_GET_ID(
storagecells, getNumberOfAdditionalStorageCells, extrastoragecells, getNumberOfAdditionalStorageCells,
setNumberOfAdditionalStorageCells, StringTo<int>, setNumberOfAdditionalStorageCells, StringTo<int>,
"[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage " "[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage "
"cells. Default is " "cells. Default is "
"0. For advanced users only. \n\tThe #images = #frames x #triggers x " "0. For advanced users only. \n\tThe #images = #frames x #triggers x "
"(#storagecells + 1)."); "(#extrastoragecells + 1).");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
storagecell_start, getStorageCellStart, setStorageCellStart, storagecell_start, getStorageCellStart, setStorageCellStart,
@ -1951,8 +1953,8 @@ class CmdProxy {
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, " "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(filtercells, getFilterCell, setFilterCell, INTEGER_COMMAND_VEC_ID(filtercells, getNumberOfFilterCells,
sls::StringTo<int>, setNumberOfFilterCells, sls::StringTo<int>,
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for " "[0-12]\n\t[Jungfrau] Set Filter Cell. Only for "
"chipv1.1. Advanced user Command"); "chipv1.1. Advanced user Command");

View File

@ -1562,12 +1562,12 @@ void Detector::setGainMode(const defs::gainMode mode, Positions pos) {
pimpl->Parallel(&Module::setGainMode, pos, mode); pimpl->Parallel(&Module::setGainMode, pos, mode);
} }
Result<int> Detector::getFilterCell(Positions pos) const { Result<int> Detector::getNumberOfFilterCells(Positions pos) const {
return pimpl->Parallel(&Module::getFilterCell, pos); return pimpl->Parallel(&Module::getNumberOfFilterCells, pos);
} }
void Detector::setFilterCell(int cell, Positions pos) { void Detector::setNumberOfFilterCells(int cell, Positions pos) {
pimpl->Parallel(&Module::setFilterCell, pos, cell); pimpl->Parallel(&Module::setNumberOfFilterCells, pos, cell);
} }
// Gotthard Specific // Gotthard Specific

View File

@ -1692,12 +1692,12 @@ void Module::setGainMode(const slsDetectorDefs::gainMode mode) {
sendToDetector(F_SET_GAIN_MODE, mode, nullptr); sendToDetector(F_SET_GAIN_MODE, mode, nullptr);
} }
int Module::getFilterCell() const { int Module::getNumberOfFilterCells() const {
return sendToDetector<int>(F_GET_FILTER_CELL); return sendToDetector<int>(F_GET_NUM_FILTER_CELLS);
} }
void Module::setFilterCell(int value) { void Module::setNumberOfFilterCells(int value) {
sendToDetector(F_SET_FILTER_CELL, value, nullptr); sendToDetector(F_SET_NUM_FILTER_CELLS, value, nullptr);
} }
// Gotthard Specific // Gotthard Specific

View File

@ -387,8 +387,8 @@ class Module : public virtual slsDetectorDefs {
void setStorageCellDelay(int64_t value); void setStorageCellDelay(int64_t value);
gainMode getGainMode() const; gainMode getGainMode() const;
void setGainMode(const gainMode mode); void setGainMode(const gainMode mode);
int getFilterCell() const; int getNumberOfFilterCells() const;
void setFilterCell(int value); void setNumberOfFilterCells(int value);
/************************************************** /**************************************************
* * * *

View File

@ -316,7 +316,7 @@ TEST_CASE("comp_disable_time", "[.cmd]") {
} }
} }
TEST_CASE("storagecells", "[.cmd]") { TEST_CASE("extrastoragecells", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
@ -327,35 +327,35 @@ TEST_CASE("storagecells", "[.cmd]") {
"inconsistent #additional storage cells to test"); "inconsistent #additional storage cells to test");
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("storagecells", {"1"}, -1, PUT, oss); proxy.Call("extrastoragecells", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 1\n"); REQUIRE(oss.str() == "extrastoragecells 1\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("storagecells", {"15"}, -1, PUT, oss); proxy.Call("extrastoragecells", {"15"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 15\n"); REQUIRE(oss.str() == "extrastoragecells 15\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("storagecells", {"0"}, -1, PUT, oss); proxy.Call("extrastoragecells", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "storagecells 0\n"); REQUIRE(oss.str() == "extrastoragecells 0\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("storagecells", {}, -1, GET, oss); proxy.Call("extrastoragecells", {}, -1, GET, oss);
REQUIRE(oss.str() == "storagecells 0\n"); REQUIRE(oss.str() == "extrastoragecells 0\n");
} }
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("extrastoragecells", {"16"}, -1, PUT));
det.setNumberOfAdditionalStorageCells(prev_val); det.setNumberOfAdditionalStorageCells(prev_val);
} }
// chip version 1.1 // chip version 1.1
else { else {
// cannot set number of addl. storage cells // cannot set number of addl. storage cells
REQUIRE_THROWS(proxy.Call("storagecells", {"1"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("extrastoragecells", {"1"}, -1, PUT));
} }
} else { } else {
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("extrastoragecells", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("storagecells", {"0"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("extrastoragecells", {"0"}, -1, PUT));
} }
} }
@ -494,47 +494,47 @@ TEST_CASE("gainmode", "[.cmd]") {
} }
} }
TEST_CASE("filtercell", "[.cmd]") { TEST_CASE("filtercells", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU) { if (det_type == defs::JUNGFRAU) {
// chip version 1.1 // chip version 1.1
if (det.getChipVersion().squash() * 10 == 11) { if (det.getChipVersion().squash() * 10 == 11) {
auto prev_val = det.getFilterCell(); auto prev_val = det.getNumberOfFilterCells();
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("filtercell", {"1"}, -1, PUT, oss); proxy.Call("filtercells", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "filtercell 1\n"); REQUIRE(oss.str() == "filtercells 1\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("filtercell", {"12"}, -1, PUT, oss); proxy.Call("filtercells", {"12"}, -1, PUT, oss);
REQUIRE(oss.str() == "filtercell 12\n"); REQUIRE(oss.str() == "filtercells 12\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("filtercell", {"0"}, -1, PUT, oss); proxy.Call("filtercells", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "filtercell 0\n"); REQUIRE(oss.str() == "filtercells 0\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("filtercell", {}, -1, GET, oss); proxy.Call("filtercells", {}, -1, GET, oss);
REQUIRE(oss.str() == "filtercell 0\n"); REQUIRE(oss.str() == "filtercells 0\n");
} }
REQUIRE_THROWS(proxy.Call("filtercell", {"13"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("filtercells", {"13"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFilterCell(prev_val[i], {i}); det.setNumberOfFilterCells(prev_val[i], {i});
} }
} }
// chip version 1.0 // chip version 1.0
else { else {
// cannot set/get filter cell // cannot set/get filter cell
REQUIRE_THROWS(proxy.Call("filtercell", {"1"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("filtercells", {"1"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("filtercells", {}, -1, GET));
} }
} else { } else {
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("filtercells", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("filtercell", {"0"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("filtercells", {"0"}, -1, PUT));
} }
} }

View File

@ -238,8 +238,8 @@ enum detFuncs {
F_SET_COMP_DISABLE_TIME, F_SET_COMP_DISABLE_TIME,
F_GET_FLIP_ROWS, F_GET_FLIP_ROWS,
F_SET_FLIP_ROWS, F_SET_FLIP_ROWS,
F_GET_FILTER_CELL, F_GET_NUM_FILTER_CELLS,
F_SET_FILTER_CELL, F_SET_NUM_FILTER_CELLS,
F_SET_ADC_PIPELINE, F_SET_ADC_PIPELINE,
F_GET_ADC_PIPELINE, F_GET_ADC_PIPELINE,
F_SET_DBIT_PIPELINE, F_SET_DBIT_PIPELINE,
@ -593,8 +593,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_COMP_DISABLE_TIME: return "F_SET_COMP_DISABLE_TIME"; case F_SET_COMP_DISABLE_TIME: return "F_SET_COMP_DISABLE_TIME";
case F_GET_FLIP_ROWS: return "F_GET_FLIP_ROWS"; case F_GET_FLIP_ROWS: return "F_GET_FLIP_ROWS";
case F_SET_FLIP_ROWS: return "F_SET_FLIP_ROWS"; case F_SET_FLIP_ROWS: return "F_SET_FLIP_ROWS";
case F_GET_FILTER_CELL: return "F_GET_FILTER_CELL"; case F_GET_NUM_FILTER_CELLS: return "F_GET_NUM_FILTER_CELLS";
case F_SET_FILTER_CELL: return "F_SET_FILTER_CELL"; case F_SET_NUM_FILTER_CELLS: return "F_SET_NUM_FILTER_CELLS";
case F_SET_ADC_PIPELINE: return "F_SET_ADC_PIPELINE"; case F_SET_ADC_PIPELINE: return "F_SET_ADC_PIPELINE";
case F_GET_ADC_PIPELINE: return "F_GET_ADC_PIPELINE"; case F_GET_ADC_PIPELINE: return "F_GET_ADC_PIPELINE";
case F_SET_DBIT_PIPELINE: return "F_SET_DBIT_PIPELINE"; case F_SET_DBIT_PIPELINE: return "F_SET_DBIT_PIPELINE";