gotthard2: changed order of burst mode enums, added a 4th burst mode cw internal burst mode

This commit is contained in:
2020-09-07 16:13:33 +02:00
parent fb8842e048
commit b20720686e
12 changed files with 144 additions and 76 deletions

View File

@ -1087,7 +1087,8 @@ class Detector {
/** [Gotthard2] */
Result<defs::burstMode> getBurstMode(Positions pos = {});
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
/** [Gotthard2] BURST_INTERNAL (default), BURST_EXTERNAL,
* CONTINUOUS_INTERNAL, CONTINUOUS_EXTERNAL */
void setBurstMode(defs::burstMode value, Positions pos = {});
/** [Gotthard2] */

View File

@ -1687,8 +1687,8 @@ std::string CmdProxy::BurstMode(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[off or 0, internal or 1, external or 2]\n\t[Gotthard2] Default "
"is burst internal type"
os << "[burst_internal or 0, burst_external or 1, cw_internal or 2, "
"cw_external or 3]\n\t[Gotthard2] Default is burst_internal type"
<< '\n';
} else {
if (action == defs::GET_ACTION) {
@ -1706,14 +1706,17 @@ std::string CmdProxy::BurstMode(int action) {
int ival = StringTo<int>(args[0]);
switch (ival) {
case 0:
t = defs::BURST_OFF;
break;
case 1:
t = defs::BURST_INTERNAL;
break;
case 2:
case 1:
t = defs::BURST_EXTERNAL;
break;
case 2:
t = defs::CONTINUOUS_INTERNAL;
break;
case 3:
t = defs::CONTINUOUS_EXTERNAL;
break;
default:
throw sls::RuntimeError("Unknown burst mode " + args[0]);
}

View File

@ -230,7 +230,7 @@ TEST_CASE("bursts", "[.cmd][.new]") {
}
// continuous mode: reg set to #frames,
// but bursts should return same value
det.setBurstMode(defs::BURST_OFF);
det.setBurstMode(defs::CONTINUOUS_INTERNAL);
det.setNumberOfFrames(2);
{
std::ostringstream oss;
@ -370,18 +370,18 @@ TEST_CASE("burstmode", "[.cmd][.new]") {
auto burststr = sls::ToString(burst);
{
std::ostringstream oss;
proxy.Call("burstmode", {"internal"}, -1, PUT, oss);
REQUIRE(oss.str() == "burstmode internal\n");
proxy.Call("burstmode", {"burst_internal"}, -1, PUT, oss);
REQUIRE(oss.str() == "burstmode burst_internal\n");
}
{
std::ostringstream oss;
proxy.Call("burstmode", {"off"}, -1, PUT, oss);
REQUIRE(oss.str() == "burstmode off\n");
proxy.Call("burstmode", {"cw_internal"}, -1, PUT, oss);
REQUIRE(oss.str() == "burstmode cw_internal\n");
}
{
std::ostringstream oss;
proxy.Call("burstmode", {}, -1, GET, oss);
REQUIRE(oss.str() == "burstmode off\n");
REQUIRE(oss.str() == "burstmode cw_internal\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setBurstMode(burst[i], {i});