filter resistor in

This commit is contained in:
2021-08-05 16:56:53 +02:00
parent 9312ef0d65
commit 86126c7e27
16 changed files with 156 additions and 100 deletions

View File

@ -699,6 +699,14 @@ void Detector::setParallelMode(bool value, Positions pos) {
pimpl->Parallel(&Module::setParallelMode, pos, value);
}
Result<int> Detector::getFilterResistor(Positions pos) const {
return pimpl->Parallel(&Module::getFilterResistor, pos);
}
void Detector::setFilterResistor(int value, Positions pos) {
pimpl->Parallel(&Module::setFilterResistor, pos, value);
}
// Acquisition
void Detector::acquire() { pimpl->acquire(); }
@ -1604,14 +1612,6 @@ void Detector::setCDSGain(bool value, Positions pos) {
pimpl->Parallel(&Module::setCDSGain, pos, value);
}
Result<int> Detector::getFilter(Positions pos) const {
return pimpl->Parallel(&Module::getFilter, pos);
}
void Detector::setFilter(int value, Positions pos) {
pimpl->Parallel(&Module::setFilter, pos, value);
}
Result<bool> Detector::getCurrentSource(Positions pos) const {
return pimpl->Parallel(&Module::getCurrentSource, pos);
}

View File

@ -704,6 +704,14 @@ void Module::setParallelMode(const bool enable) {
sendToDetector(F_SET_PARALLEL_MODE, static_cast<int>(enable), nullptr);
}
int Module::getFilterResistor() const {
return sendToDetector<int>(F_GET_FILTER_RESISTOR);
}
void Module::setFilterResistor(int value) {
sendToDetector(F_SET_FILTER_RESISTOR, value, nullptr);
}
// Acquisition
void Module::startReceiver() {
@ -1898,12 +1906,6 @@ void Module::setCDSGain(bool value) {
sendToDetector(F_SET_CDS_GAIN, static_cast<int>(value), nullptr);
}
int Module::getFilter() const { return sendToDetector<int>(F_GET_FILTER); }
void Module::setFilter(int value) {
sendToDetector(F_SET_FILTER, value, nullptr);
}
bool Module::getCurrentSource() const {
return sendToDetector<int>(F_GET_CURRENT_SOURCE);
}

View File

@ -170,6 +170,8 @@ class Module : public virtual slsDetectorDefs {
void setExternalSignalFlags(int signalIndex, externalSignalFlag type);
bool getParallelMode() const;
void setParallelMode(const bool enable);
int getFilterResistor() const;
void setFilterResistor(int value);
/**************************************************
* *
@ -408,8 +410,6 @@ class Module : public virtual slsDetectorDefs {
void setBurstMode(burstMode value);
bool getCDSGain() const;
void setCDSGain(bool value);
int getFilter() const;
void setFilter(int value);
bool getCurrentSource() const;
void setCurrentSource(bool value);
slsDetectorDefs::timingSourceType getTimingSource() const;

View File

@ -519,36 +519,6 @@ TEST_CASE("cdsgain", "[.cmd]") {
}
}
TEST_CASE("filter", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
auto prev_val = det.getFilter();
{
std::ostringstream oss;
proxy.Call("filter", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "filter 1\n");
}
{
std::ostringstream oss;
proxy.Call("filter", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "filter 0\n");
}
{
std::ostringstream oss;
proxy.Call("filter", {}, -1, GET, oss);
REQUIRE(oss.str() == "filter 0\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setFilter(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("filter", {}, -1, GET));
}
}
TEST_CASE("currentsource", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);

View File

@ -1379,6 +1379,43 @@ TEST_CASE("parallel", "[.cmd]") {
}
}
TEST_CASE("filterresistor", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2 || det_type == defs::JUNGFRAU) {
auto prev_val = det.getFilterResistor();
{
std::ostringstream oss;
proxy.Call("filterresistor", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "filterresistor 1\n");
}
{
std::ostringstream oss;
proxy.Call("filterresistor", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "filterresistor 0\n");
}
{
std::ostringstream oss;
proxy.Call("filterresistor", {}, -1, GET, oss);
REQUIRE(oss.str() == "filterresistor 0\n");
}
if (det_type == defs::GOTTHARD2) {
REQUIRE_NOTHROW(proxy.Call("filterresistor", {"2"}, -1, PUT));
REQUIRE_NOTHROW(proxy.Call("filterresistor", {"3"}, -1, PUT));
} else {
REQUIRE_THROWS(proxy.Call("filterresistor", {"2"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("filterresistor", {"3"}, -1, PUT));
}
for (int i = 0; i != det.size(); ++i) {
det.setFilterResistor(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("filterresistor", {}, -1, GET));
}
}
/** temperature */
TEST_CASE("templist", "[.cmd]") {