mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 11:20:04 +02:00
jungfrau: currentsource
This commit is contained in:
parent
fce35e35a1
commit
a0784d23bb
@ -964,11 +964,11 @@ std::string CmdProxy::CurrentSource(int action) {
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0|1]\n\t[Gotthard2] Enable or disable current source. Default "
|
||||
"is disabled.\n[0|1] [fix|nofix] [select source] "
|
||||
"[normal|low]\n\t[Jungfrau] Disable or enable current source "
|
||||
"with some parameters. The select source is 0-63 for chipv1.0 "
|
||||
"and a 64 bit mask for chipv1.1. To disable, one needs only one "
|
||||
"argument '0'."
|
||||
"is disabled.\n[0|1] [fix|nofix] [select source] [(only for "
|
||||
"chipv1.1)normal|low]\n\t[Jungfrau] Disable or enable current "
|
||||
"source with some parameters. The select source is 0-63 for "
|
||||
"chipv1.0 and a 64 bit mask for chipv1.1. To disable, one needs "
|
||||
"only one argument '0'."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
@ -978,7 +978,7 @@ std::string CmdProxy::CurrentSource(int action) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setCurrentsource(
|
||||
det->setCurrentSource(
|
||||
defs::currentSrcParameters(StringTo<bool>(args[0])));
|
||||
} else if (args.size() >= 3) {
|
||||
// scan fix
|
||||
@ -992,8 +992,8 @@ std::string CmdProxy::CurrentSource(int action) {
|
||||
". Did you mean fix or nofix?");
|
||||
}
|
||||
if (args.size() == 3) {
|
||||
det->setCurrentsource(defs::currentSrcParameters(
|
||||
StringTo<bool>(args[0]), fix, StringTo<int64_t>(args[2])));
|
||||
det->setCurrentSource(defs::currentSrcParameters(
|
||||
fix, StringTo<int64_t>(args[2])));
|
||||
} else if (args.size() == 4) {
|
||||
bool normalCurrent = false;
|
||||
if (args[3] == "normal") {
|
||||
@ -1004,9 +1004,8 @@ std::string CmdProxy::CurrentSource(int action) {
|
||||
throw sls::RuntimeError("Invalid argument: " + args[3] +
|
||||
". Did you mean normal or low?");
|
||||
}
|
||||
det->setCurrentsource(defs::currentSrcParameters(
|
||||
StringTo<bool>(args[0]), fix, StringTo<int64_t>(args[2]),
|
||||
normalCurrent));
|
||||
det->setCurrentSource(defs::currentSrcParameters(
|
||||
fix, StringTo<int64_t>(args[2]), normalCurrent));
|
||||
} else {
|
||||
throw sls::RuntimeError(
|
||||
"Invalid number of parareters for this command.");
|
||||
|
@ -1428,7 +1428,7 @@ TEST_CASE("currentsource", "[.cmd]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2 || detType == defs::Jungfrau) {
|
||||
if (det_type == defs::GOTTHARD2 || det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getCurrentSource();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
@ -1461,11 +1461,11 @@ TEST_CASE("currentsource", "[.cmd]") {
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("currentsource", {"1", "fix"}, -1, PUT));
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("currentsource", {"1", "fix", 64}, -1, PUT));
|
||||
proxy.Call("currentsource", {"1", "fix", "64"}, -1, PUT));
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("currentsource", {"1", "dfg", 64}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("currentsource",
|
||||
{"1", "fix", 63, "normal"}, -1, PUT));
|
||||
proxy.Call("currentsource", {"1", "dfg", "64"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call(
|
||||
"currentsource", {"1", "fix", "63", "normal"}, -1, PUT));
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("currentsource", {"1", "fix", "63"}, -1, PUT,
|
||||
@ -1501,9 +1501,9 @@ TEST_CASE("currentsource", "[.cmd]") {
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("currentsource", {"1", "fix"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("currentsource",
|
||||
{"1", "ffgdfgix", 65}, -1, PUT));
|
||||
{"1", "ffgdfgix", "65"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call(
|
||||
"currentsource", {"1", "fix", 65, "normaldgf"}, -1, PUT));
|
||||
"currentsource", {"1", "fix", "65", "normaldgf"}, -1, PUT));
|
||||
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
@ -465,7 +465,7 @@ typedef struct {
|
||||
/** [Gotthard2][Jungfrau] disable */
|
||||
currentSrcParameters() : enable(0), fix(-1), normal(-1), select(0) {}
|
||||
|
||||
/** [Gotthard2] enable */
|
||||
/** [Gotthard2] enable or disable */
|
||||
currentSrcParameters(bool ena)
|
||||
: enable(static_cast<int>(ena)), fix(-1), normal(-1), select(0) {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user