Merge pull request #324 from slsdetectorgroup/jungfraufix

Jungfraufix
This commit is contained in:
Dhanya Thattil 2021-10-21 12:07:36 +02:00 committed by GitHub
commit 2f7a0898d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 111 additions and 95 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

@ -2292,18 +2292,18 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def filtercell(self): def filtercells(self):
""" """
[Jungfrau] Set filter capacitor. [Jungfrau] Set filter capacitor.
Note Note
---- ----
[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()
@filtercell.setter @filtercells.setter
def filtercell(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

@ -452,6 +452,7 @@ Time before end of exposure when comparator is disabled */
#define ASIC_CTRL_DS_TMR_OFST (8) #define ASIC_CTRL_DS_TMR_OFST (8)
#define ASIC_CTRL_DS_TMR_MSK (0x000000FF << ASIC_CTRL_DS_TMR_OFST) #define ASIC_CTRL_DS_TMR_MSK (0x000000FF << ASIC_CTRL_DS_TMR_OFST)
#define ASIC_CTRL_DS_TMR_VAL ((0x1F << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK) #define ASIC_CTRL_DS_TMR_VAL ((0x1F << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK)
#define ASIC_CTRL_DS_TMR_CHIP1_1_VAL ((0xFF << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK)
// tET = (ET + 1) * 25ns (increase timeout range between 2 consecutive storage // tET = (ET + 1) * 25ns (increase timeout range between 2 consecutive storage
// cells) // cells)
#define ASIC_CTRL_EXPSRE_TMR_OFST (16) #define ASIC_CTRL_EXPSRE_TMR_OFST (16)

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);
} }
@ -1829,11 +1829,15 @@ int64_t getComparatorDisableTime() {
} }
void configureASICTimer() { void configureASICTimer() {
LOG(logINFO, ("Configuring ASIC Timer\n"));
bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_PRCHRG_TMR_MSK) | bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_PRCHRG_TMR_MSK) |
ASIC_CTRL_PRCHRG_TMR_VAL); ASIC_CTRL_PRCHRG_TMR_VAL);
bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_DS_TMR_MSK) |
ASIC_CTRL_DS_TMR_VAL); uint32_t val = ASIC_CTRL_DS_TMR_VAL;
if (getChipVersion() == 11) {
val = ASIC_CTRL_DS_TMR_CHIP1_1_VAL;
}
bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_DS_TMR_MSK) | val);
LOG(logINFO, ("Configured ASIC Timer [0x%x]\n", bus_r(ASIC_CTRL_REG)));
} }
int setReadoutSpeed(int val) { int setReadoutSpeed(int val) {
@ -2202,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
@ -2213,12 +2217,13 @@ int getFilterCell() {
// flip all contents of register //TODO FIRMWARE FIX // flip all contents of register //TODO FIRMWARE FIX
regval ^= BIT32_MASK; regval ^= BIT32_MASK;
#endif #endif
uint32_t retval = (regval & CONFIG_V11_FLTR_CLL_MSK) >> CONFIG_V11_FLTR_CLL_OFST; uint32_t retval =
(regval & CONFIG_V11_FLTR_CLL_MSK) >> CONFIG_V11_FLTR_CLL_OFST;
// count number of bits = which icell // count number of bits = which icell
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;
} }
@ -2235,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() {
@ -2336,13 +2341,12 @@ int getFixCurrentSource() {
int getNormalCurrentSource() { int getNormalCurrentSource() {
if (getChipVersion() == 11) { if (getChipVersion() == 11) {
//TODO FIRMWARE FIX TOGGLING // TODO FIRMWARE FIX TOGGLING
int regval = bus_r(CONFIG_V11_STATUS_REG); int regval = bus_r(CONFIG_V11_STATUS_REG);
#ifndef VIRTUAL #ifndef VIRTUAL
regval ^= BIT32_MASK; regval ^= BIT32_MASK;
#endif #endif
int low = ((regval & int low = ((regval & CONFIG_V11_STATUS_CRRNT_SRC_LOW_MSK) >>
CONFIG_V11_STATUS_CRRNT_SRC_LOW_MSK) >>
CONFIG_V11_STATUS_CRRNT_SRC_LOW_OFST); CONFIG_V11_STATUS_CRRNT_SRC_LOW_OFST);
return (low == 0 ? 1 : 0); return (low == 0 ? 1 : 0);
} }

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,
"Could not set number of filter cells. Only available for "
"chip version 1.1\n"); "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

@ -82,9 +82,14 @@ std::map<std::string, std::string> CmdProxy::GetDepreciatedCommands() {
} }
void CmdProxy::WrongNumberOfParameters(size_t expected) { void CmdProxy::WrongNumberOfParameters(size_t expected) {
throw RuntimeError( if (expected == 0) {
"Command " + cmd + " expected <=" + std::to_string(expected) + throw RuntimeError("Command " + cmd +
" parameter/s but got " + std::to_string(args.size()) + "\n"); " expected no parameter/s but got " +
std::to_string(args.size()) + "\n");
}
throw RuntimeError("Command " + cmd + " expected (or >=) " +
std::to_string(expected) + " parameter/s but got " +
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,11 +946,11 @@ 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},
{"filtercell", &CmdProxy::filtercell}, {"filtercells", &CmdProxy::filtercells},
/* Gotthard Specific */ /* Gotthard Specific */
{"roi", &CmdProxy::ROI}, {"roi", &CmdProxy::ROI},
@ -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(filtercell, 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";

View File

@ -12,4 +12,4 @@
#define APIMYTHEN3 0x211019 #define APIMYTHEN3 0x211019
#define APIMOENCH 0x211019 #define APIMOENCH 0x211019
#define APIEIGER 0x211019 #define APIEIGER 0x211019
#define APIJUNGFRAU 0x211020 #define APIJUNGFRAU 0x211021