mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 12:27:14 +02:00
8.0.0.rc: fix server logic in checking detector idle (#860)
* fix buggy logic in checking detector idle and an argument check
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -4772,7 +4772,8 @@ int set_read_n_rows(int file_des) {
|
|||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if ((Server_VerifyLock() == OK) &&
|
||||||
|
(check_detector_idle("set number of rows") == OK)) {
|
||||||
if (arg < MIN_ROWS_PER_READOUT || arg > MAX_ROWS_PER_READOUT) {
|
if (arg < MIN_ROWS_PER_READOUT || arg > MAX_ROWS_PER_READOUT) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
@ -4804,8 +4805,7 @@ int set_read_n_rows(int file_des) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
} else
|
||||||
#elif defined(JUNGFRAUD) || defined(MOENCHD)
|
#elif defined(JUNGFRAUD) || defined(MOENCHD)
|
||||||
if ((check_detector_idle("set number of rows") == OK) &&
|
if (arg % READ_N_ROWS_MULTIPLE != 0) {
|
||||||
(arg % READ_N_ROWS_MULTIPLE != 0)) {
|
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set number of rows. %d must be a multiple "
|
"Could not set number of rows. %d must be a multiple "
|
||||||
@ -8472,9 +8472,9 @@ int set_master(int file_des) {
|
|||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if ((Server_VerifyLock() == OK) &&
|
||||||
if ((check_detector_idle("set master") == OK) &&
|
(check_detector_idle("set master") == OK)) {
|
||||||
(arg != 0 && arg != 1)) {
|
if (arg != 0 && arg != 1) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not set master. Invalid argument %d.\n", arg);
|
sprintf(mess, "Could not set master. Invalid argument %d.\n", arg);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
@ -9028,9 +9028,9 @@ int set_flip_rows(int file_des) {
|
|||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if ((Server_VerifyLock() == OK) &&
|
||||||
if ((check_detector_idle("set flip rows") == OK) &&
|
(check_detector_idle("set flip rows") == OK)) {
|
||||||
(arg != 0 && arg != 1)) {
|
if (arg != 0 && arg != 1) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not set flip rows. Invalid argument %d.\n",
|
sprintf(mess, "Could not set flip rows. Invalid argument %d.\n",
|
||||||
arg);
|
arg);
|
||||||
@ -10365,9 +10365,9 @@ int set_synchronization(int file_des) {
|
|||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if ((Server_VerifyLock() == OK) &&
|
||||||
if ((check_detector_idle("set synchronization") == OK) &&
|
(check_detector_idle("set synchronization") == OK)) {
|
||||||
(arg != 0 && arg != 1)) {
|
if (arg != 0 && arg != 1) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set synchronization. Invalid argument %d.\n",
|
"Could not set synchronization. Invalid argument %d.\n",
|
||||||
|
@ -705,6 +705,34 @@ TEST_CASE("sync", "[.cmd]") {
|
|||||||
proxy.Call("sync", {}, -1, GET, oss);
|
proxy.Call("sync", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "sync 1\n");
|
REQUIRE(oss.str() == "sync 1\n");
|
||||||
}
|
}
|
||||||
|
// setting sync when running
|
||||||
|
{
|
||||||
|
auto prev_timing =
|
||||||
|
det.getTimingMode().tsquash("inconsistent timing mode in test");
|
||||||
|
auto prev_frames =
|
||||||
|
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
|
||||||
|
auto prev_exptime =
|
||||||
|
det.getExptime().tsquash("inconsistent exptime in test");
|
||||||
|
auto prev_period =
|
||||||
|
det.getPeriod().tsquash("inconsistent period in test");
|
||||||
|
det.setTimingMode(defs::AUTO_TIMING);
|
||||||
|
det.setNumberOfFrames(10000);
|
||||||
|
det.setExptime(std::chrono::microseconds(200));
|
||||||
|
det.setPeriod(std::chrono::milliseconds(1000));
|
||||||
|
det.setSynchronization(1);
|
||||||
|
det.startDetector();
|
||||||
|
REQUIRE_THROWS(proxy.Call("sync", {"0"}, -1, PUT));
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("sync", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "sync 1\n");
|
||||||
|
}
|
||||||
|
det.stopDetector();
|
||||||
|
det.setTimingMode(prev_timing);
|
||||||
|
det.setNumberOfFrames(prev_frames);
|
||||||
|
det.setExptime(prev_exptime);
|
||||||
|
det.setPeriod(prev_period);
|
||||||
|
}
|
||||||
det.setSynchronization(prev_val);
|
det.setSynchronization(prev_val);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("sync", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("sync", {}, -1, GET));
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
/** API versions */
|
/** API versions */
|
||||||
#define RELEASE "8.0.0"
|
#define RELEASE "8.0.0"
|
||||||
#define APICTB "8.0.0 0x231108"
|
|
||||||
#define APIGOTTHARD "8.0.0 0x231108"
|
|
||||||
#define APIGOTTHARD2 "8.0.0 0x231108"
|
|
||||||
#define APIJUNGFRAU "8.0.0 0x231108"
|
|
||||||
#define APIMYTHEN3 "8.0.0 0x231108"
|
|
||||||
#define APIMOENCH "8.0.0 0x231108"
|
|
||||||
#define APIEIGER "8.0.0 0x231108"
|
|
||||||
#define APILIB "8.0.0 0x231108"
|
#define APILIB "8.0.0 0x231108"
|
||||||
#define APIRECEIVER "8.0.0 0x231108"
|
#define APIRECEIVER "8.0.0 0x231108"
|
||||||
|
#define APICTB "8.0.0 0x231109"
|
||||||
|
#define APIGOTTHARD "8.0.0 0x231109"
|
||||||
|
#define APIGOTTHARD2 "8.0.0 0x231109"
|
||||||
|
#define APIJUNGFRAU "8.0.0 0x231109"
|
||||||
|
#define APIMYTHEN3 "8.0.0 0x231109"
|
||||||
|
#define APIMOENCH "8.0.0 0x231109"
|
||||||
|
#define APIEIGER "8.0.0 0x231109"
|
||||||
|
Reference in New Issue
Block a user