This commit is contained in:
maliakal_d 2020-07-01 20:00:36 +02:00
parent 3156e6f50e
commit a656668d73
13 changed files with 120 additions and 110 deletions

View File

@ -2,7 +2,6 @@
#include <semaphore.h> #include <semaphore.h>
char *sharedMemory_getError();
void sharedMemory_print(); void sharedMemory_print();
int sharedMemory_create(int port); int sharedMemory_create(int port);
void sharedMemory_initialize(); void sharedMemory_initialize();

View File

@ -224,6 +224,5 @@ int get_veto(int);
int set_veto(int); int set_veto(int);
int set_pattern(int); int set_pattern(int);
int get_scan(int); int get_scan(int);
int get_num_scan_steps(int);
int disable_scan(int); int disable_scan(int);
int enable_scan(int); int enable_scan(int);

View File

@ -24,13 +24,10 @@ typedef struct Memory {
} sharedMem; } sharedMem;
sharedMem *shm = NULL; sharedMem *shm = NULL;
char shmMess[MAX_STR_LENGTH];
int shmFd = -1; int shmFd = -1;
extern int isControlServer; extern int isControlServer;
char *sharedMemory_getError() { return shmMess; }
void sharedMemory_print() { void sharedMemory_print() {
LOG(logINFO, ("%s Shared Memory:\n", isControlServer ? "c" : "s")); LOG(logINFO, ("%s Shared Memory:\n", isControlServer ? "c" : "s"));
LOG(logINFO, LOG(logINFO,
@ -42,8 +39,6 @@ void sharedMemory_print() {
} }
int sharedMemory_create(int port) { int sharedMemory_create(int port) {
memset(shmMess, 0, MAX_STR_LENGTH);
// if sham existed, delete old shm and create again // if sham existed, delete old shm and create again
shmFd = shmFd =
shmget(SHM_KEY + port, sizeof(sharedMem), IPC_CREAT | IPC_EXCL | 0666); shmget(SHM_KEY + port, sizeof(sharedMem), IPC_CREAT | IPC_EXCL | 0666);
@ -58,8 +53,7 @@ int sharedMemory_create(int port) {
IPC_CREAT | IPC_EXCL | 0666); IPC_CREAT | IPC_EXCL | 0666);
} }
if (shmFd == -1) { if (shmFd == -1) {
sprintf(shmMess, "Create shared memory failed: %s\n", strerror(errno)); LOG(logERROR, ("Create shared memory failed: %s\n", strerror(errno)));
LOG(logERROR, (shmMess));
return FAIL; return FAIL;
} }
LOG(logINFO, ("Shared memory created\n")); LOG(logINFO, ("Shared memory created\n"));
@ -81,21 +75,18 @@ void sharedMemory_initialize() {
} }
int sharedMemory_open(int port) { int sharedMemory_open(int port) {
memset(shmMess, 0, MAX_STR_LENGTH);
shmFd = shmget(SHM_KEY + port, sizeof(sharedMem), 0666); shmFd = shmget(SHM_KEY + port, sizeof(sharedMem), 0666);
if (shmFd == -1) { if (shmFd == -1) {
sprintf(shmMess, "Open shared memory failed: %s\n", strerror(errno)); LOG(logERROR, ("Open shared memory failed: %s\n", strerror(errno)));
LOG(logERROR, (shmMess));
return FAIL; return FAIL;
} }
if (sharedMemory_attach() == FAIL) { if (sharedMemory_attach() == FAIL) {
return FAIL; return FAIL;
} }
if (shm->version != SHM_VERSION) { if (shm->version != SHM_VERSION) {
sprintf(shmMess, LOG(logERROR,
"Shared memory version 0x%x does not match! (expected: 0x%x)\n", ("Shared memory version 0x%x does not match! (expected: 0x%x)\n",
shm->version, SHM_VERSION); shm->version, SHM_VERSION));
LOG(logERROR, (shmMess));
} }
LOG(logINFO, ("Shared memory opened\n")); LOG(logINFO, ("Shared memory opened\n"));
return OK; return OK;
@ -104,8 +95,7 @@ int sharedMemory_open(int port) {
int sharedMemory_attach() { int sharedMemory_attach() {
shm = (sharedMem *)shmat(shmFd, NULL, 0); shm = (sharedMem *)shmat(shmFd, NULL, 0);
if (shm == (void *)-1) { if (shm == (void *)-1) {
sprintf(shmMess, "could not attach: %s\n", strerror(errno)); LOG(logERROR, ("could not attach: %s\n", strerror(errno)));
LOG(logERROR, (shmMess));
return FAIL; return FAIL;
} }
LOG(logINFO, ("Shared memory attached\n")); LOG(logINFO, ("Shared memory attached\n"));
@ -113,10 +103,8 @@ int sharedMemory_attach() {
} }
int sharedMemory_detach() { int sharedMemory_detach() {
memset(shmMess, 0, MAX_STR_LENGTH);
if (shmdt(shm) == -1) { if (shmdt(shm) == -1) {
sprintf(shmMess, "could not detach: %s\n", strerror(errno)); LOG(logERROR, ("could not detach: %s\n", strerror(errno)));
LOG(logERROR, (shmMess));
return FAIL; return FAIL;
} }
LOG(logINFO, ("Shared memory detached\n")); LOG(logINFO, ("Shared memory detached\n"));
@ -124,10 +112,8 @@ int sharedMemory_detach() {
} }
int sharedMemory_remove() { int sharedMemory_remove() {
memset(shmMess, 0, MAX_STR_LENGTH);
if (shmctl(shmFd, IPC_RMID, NULL) == -1) { if (shmctl(shmFd, IPC_RMID, NULL) == -1) {
sprintf(shmMess, "could not remove: %s\n", strerror(errno)); LOG(logERROR, ("could not remove: %s\n", strerror(errno)));
LOG(logERROR, (shmMess));
return FAIL; return FAIL;
} }
LOG(logINFO, ("Shared memory removed\n")); LOG(logINFO, ("Shared memory removed\n"));

View File

@ -55,6 +55,7 @@ int (*flist[NUM_DET_FUNCTIONS])(int);
int scan = 0; int scan = 0;
int numScanSteps = 0; int numScanSteps = 0;
int *scanSteps = NULL; int *scanSteps = NULL;
int64_t scanDacSettleTime_us = 0;
enum DACINDEX scanDac = 0; enum DACINDEX scanDac = 0;
int scanTrimbits = 0; int scanTrimbits = 0;
@ -340,7 +341,6 @@ void function_table() {
flist[F_SET_VETO] = &set_veto; flist[F_SET_VETO] = &set_veto;
flist[F_SET_PATTERN] = &set_pattern; flist[F_SET_PATTERN] = &set_pattern;
flist[F_GET_SCAN] = get_scan; flist[F_GET_SCAN] = get_scan;
flist[F_GET_NUM_SCAN_STEPS] = get_num_scan_steps;
flist[F_DISABLE_SCAN] = disable_scan; flist[F_DISABLE_SCAN] = disable_scan;
flist[F_ENABLE_SCAN] = enable_scan; flist[F_ENABLE_SCAN] = enable_scan;
// check // check
@ -1772,6 +1772,7 @@ int start_state_machine(int blocking, int file_des) {
sharedMemory_setScanStatus(0); sharedMemory_setScanStatus(0);
break; break;
} }
usleep(scanDacSettleTime_us);
#ifdef EIGERD #ifdef EIGERD
prepareAcquisition(); prepareAcquisition();
#endif #endif
@ -2968,7 +2969,8 @@ int set_pattern_loop_addresses(int file_des) {
startAddr, stopAddr)); startAddr, stopAddr));
retvals[0] = startAddr; retvals[0] = startAddr;
retvals[1] = stopAddr; retvals[1] = stopAddr;
validate(args[1], startAddr, "set Pattern loops' start address", HEX); validate(args[1], startAddr, "set Pattern loops' start address",
HEX);
validate(args[2], stopAddr, "set Pattern loops' stop address", HEX); validate(args[2], stopAddr, "set Pattern loops' stop address", HEX);
} }
} }
@ -3007,7 +3009,8 @@ int set_pattern_loop_cycles(int file_des) {
retval = numLoops; retval = numLoops;
LOG(logDEBUG1, LOG(logDEBUG1,
("Pattern loop cycles retval: (ncycles:%d)\n", retval)); ("Pattern loop cycles retval: (ncycles:%d)\n", retval));
validate(args[1], retval, "set Pattern loops' number of cycles", DEC); validate(args[1], retval, "set Pattern loops' number of cycles",
DEC);
} }
} }
#endif #endif
@ -7384,39 +7387,51 @@ int set_pattern(int file_des) {
retval1 = patloop[1]; retval1 = patloop[1];
numLoops = patnloop[0]; numLoops = patnloop[0];
setPatternLoop(0, &patloop[0], &patloop[1], &numLoops); setPatternLoop(0, &patloop[0], &patloop[1], &numLoops);
validate(patloop[0], retval0, "set pattern Loop 0 start address", HEX); validate(patloop[0], retval0, "set pattern Loop 0 start address",
validate(patloop[1], retval1, "set pattern Loop 0 stop address", HEX); HEX);
validate(patnloop[0], numLoops, "set pattern Loop 0 num loops", HEX); validate(patloop[1], retval1, "set pattern Loop 0 stop address",
HEX);
validate(patnloop[0], numLoops, "set pattern Loop 0 num loops",
HEX);
} }
if (ret == OK) { if (ret == OK) {
retval0 = patloop[2]; retval0 = patloop[2];
retval1 = patloop[3]; retval1 = patloop[3];
numLoops = patnloop[1]; numLoops = patnloop[1];
setPatternLoop(1, &patloop[2], &patloop[3], &numLoops); setPatternLoop(1, &patloop[2], &patloop[3], &numLoops);
validate(patloop[2], retval0, "set pattern Loop 1 start address", HEX); validate(patloop[2], retval0, "set pattern Loop 1 start address",
validate(patloop[3], retval1, "set pattern Loop 1 stop address", HEX); HEX);
validate(patnloop[1], numLoops, "set pattern Loop 1 num loops", HEX); validate(patloop[3], retval1, "set pattern Loop 1 stop address",
HEX);
validate(patnloop[1], numLoops, "set pattern Loop 1 num loops",
HEX);
} }
if (ret == OK) { if (ret == OK) {
retval0 = patloop[4]; retval0 = patloop[4];
retval1 = patloop[5]; retval1 = patloop[5];
numLoops = patnloop[2]; numLoops = patnloop[2];
setPatternLoop(2, &patloop[4], &patloop[5], &numLoops); setPatternLoop(2, &patloop[4], &patloop[5], &numLoops);
validate(patloop[4], retval0, "set pattern Loop 2 start address", HEX); validate(patloop[4], retval0, "set pattern Loop 2 start address",
validate(patloop[5], retval1, "set pattern Loop 2 stop address", HEX); HEX);
validate(patnloop[2], numLoops, "set pattern Loop 2 num loops", HEX); validate(patloop[5], retval1, "set pattern Loop 2 stop address",
HEX);
validate(patnloop[2], numLoops, "set pattern Loop 2 num loops",
HEX);
} }
if (ret == OK) { if (ret == OK) {
retval0 = setPatternWaitAddress(0, patwait[0]); retval0 = setPatternWaitAddress(0, patwait[0]);
validate(patwait[0], retval0, "set pattern Loop 0 wait address", HEX); validate(patwait[0], retval0, "set pattern Loop 0 wait address",
HEX);
} }
if (ret == OK) { if (ret == OK) {
retval0 = setPatternWaitAddress(1, patwait[1]); retval0 = setPatternWaitAddress(1, patwait[1]);
validate(patwait[1], retval0, "set pattern Loop 1 wait address", HEX); validate(patwait[1], retval0, "set pattern Loop 1 wait address",
HEX);
} }
if (ret == OK) { if (ret == OK) {
retval0 = setPatternWaitAddress(2, patwait[2]); retval0 = setPatternWaitAddress(2, patwait[2]);
validate(patwait[2], retval0, "set pattern Loop 2 wait address", HEX); validate(patwait[2], retval0, "set pattern Loop 2 wait address",
HEX);
} }
if (ret == OK) { if (ret == OK) {
uint64_t retval64 = setPatternWaitTime(0, patwaittime[0]); uint64_t retval64 = setPatternWaitTime(0, patwaittime[0]);
@ -7441,31 +7456,18 @@ int set_pattern(int file_des) {
int get_scan(int file_des) { int get_scan(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int retval = -1; int retval[4] = {-1, -1, -1, -1};
int64_t retval_time = -1;
LOG(logDEBUG1, ("Getting scan\n")); LOG(logDEBUG1, ("Getting scan\n"));
// get only // get only
retval = scan; retval[0] = scan;
LOG(logDEBUG1, ("scan mode retval: %u\n", retval)); LOG(logDEBUG1, ("scan mode retval: %u\n", retval));
return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
} }
int get_num_scan_steps(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting num scan steps\n"));
// get only
retval = numScanSteps;
LOG(logDEBUG1, ("num scan steps retval: %u\n", retval));
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int disable_scan(int file_des) { int disable_scan(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
@ -7493,15 +7495,19 @@ int enable_scan(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int args[4] = {-1, -1, -1, -1}; int args[4] = {-1, -1, -1, -1};
int64_t args_time = -1;
if (receiveData(file_des, args, sizeof(args), INT32) < 0) if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
if (receiveData(file_des, args_time, sizeof(args_time), INT64) < 0)
return printSocketReadError();
// only set // only set
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
int startOffset = args[1]; int startOffset = args[1];
int endOffset = args[2]; int endOffset = args[2];
int stepSize = args[3]; int stepSize = args[3];
scanDacSettleTime_us = args[4] / 1000;
scanTrimbits = 0; scanTrimbits = 0;
if ((startOffset < endOffset && stepSize <= 0) || if ((startOffset < endOffset && stepSize <= 0) ||

View File

@ -394,19 +394,14 @@ class Detector {
/** [Eiger] Sends an internal software trigger to the detector */ /** [Eiger] Sends an internal software trigger to the detector */
void sendSoftwareTrigger(Positions pos = {}); void sendSoftwareTrigger(Positions pos = {});
Result<bool> getScan(Positions pos = {}) const; Result<defs::scanParameters> getScan(Positions pos = {}) const;
Result<int> getNumberOfScanSteps(Positions pos = {}) const;
/** also sets number of frames to 1 */ /** also sets number of frames to 1 */
void disableScan(); void disableScan();
/** scan dac, [Eiger] use TRIMBIT_SCAN for scanning trimbits, also sets /** scan dac, trimbits scan only for [Eiger/ Mythen3] TRIMBIT_SCAN, also
* number of frames to number of steps in receiver */ * sets number of frames to number of steps in receiver */
void enableScan(const defs::dacIndex dac, const int start_offset, void enableScan(const defs::scanParameters t);
const int end_offset, const int step_size);
// TODO: remove resetframescaught in receiver
/************************************************** /**************************************************
* * * *

View File

@ -996,9 +996,9 @@ std::string CmdProxy::Scan(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[dac_name|0|trimbit_scan] [start_val] [stop_val] " os << "[dac_name|0|trimbit_scan] [start_val] [stop_val] "
"[step_size]\n\tConfigures to scan " "[step_size] [dac settling time ns|us|ms|s]\n\tConfigures to "
"dac and sets number of frames to number of steps. Must acquire " "scan dac and sets number of frames to number of steps. Must "
"after this. To cancel the scan configuration " "acquire after this. To cancel the scan configuration "
"set dac to '0' without further arguments. This also sets number " "set dac to '0' without further arguments. This also sets number "
"of frames back to 1." "of frames back to 1."
"\n\t[Eiger]Use trimbit_scan as dac name for a trimbit scan." "\n\t[Eiger]Use trimbit_scan as dac name for a trimbit scan."
@ -1008,7 +1008,7 @@ std::string CmdProxy::Scan(int action) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getScan(); auto t = det->getScan();
os << OutString(t) << '\n'; os << ToString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
if (StringTo<int>(args[0]) != 0) { if (StringTo<int>(args[0]) != 0) {
@ -1016,21 +1016,26 @@ std::string CmdProxy::Scan(int action) {
} }
det->disableScan(); det->disableScan();
os << "scan disabled" << '\n'; os << "scan disabled" << '\n';
} else if (args.size() != 4) { } else if (args.size() == 4) {
WrongNumberOfParameters(4); det->enableScan(defs::scanParameters(
StringTo<defs::dacIndex>(args[0]), StringTo<int>(args[1]),
StringTo<int>(args[2]), StringTo<int>(args[3])));
} else if (args.size() == 5) {
std::string time_str(args[4]);
std::string unit = RemoveUnit(time_str);
auto t = StringTo<time::ns>(time_str, unit);
det->enableScan(defs::scanParameters(
StringTo<defs::dacIndex>(args[0]), StringTo<int>(args[1]),
StringTo<int>(args[2]), StringTo<int>(args[3]), t));
} else { } else {
det->enableScan(StringTo<defs::dacIndex>(args[0]), WrongNumberOfParameters(4);
StringTo<int>(args[1]), StringTo<int>(args[2]),
StringTo<int>(args[3]));
auto nsteps = det->getNumberOfScanSteps().tsquash(
"inconsistent number of scan steps");
os << "scan enabled for " << nsteps << " steps" << '\n';
} }
os << ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
} }
return os.str(); return os.str();
} } // namespace sls
/* Network Configuration (Detector<->Receiver) */ /* Network Configuration (Detector<->Receiver) */
std::string CmdProxy::UDPDestinationIP(int action) { std::string CmdProxy::UDPDestinationIP(int action) {

View File

@ -559,26 +559,14 @@ void Detector::sendSoftwareTrigger(Positions pos) {
pimpl->Parallel(&Module::sendSoftwareTrigger, pos); pimpl->Parallel(&Module::sendSoftwareTrigger, pos);
} }
Result<bool> Detector::getScan(Positions pos) const { Result<defs::scanParameters> Detector::getScan(Positions pos) const {
return pimpl->Parallel(&Module::getScan, pos); return pimpl->Parallel(&Module::getScan, pos);
} }
Result<int> Detector::getNumberOfScanSteps(Positions pos) const { void Detector::disableScan() { pimpl->Parallel(&Module::disableScan, {}); }
return pimpl->Parallel(&Module::getNumberOfScanSteps, pos);
}
void Detector::disableScan() { void Detector::enableScan(const defs::scanParameters t) {
pimpl->Parallel(&Module::disableScan, {}); pimpl->Parallel(&Module::enableScan, {}, t);
setNumberOfFrames(1);
}
void Detector::enableScan(const defs::dacIndex dac, const int start_offset,
const int end_offset, const int step_size) {
pimpl->Parallel(&Module::enableScan, {}, dac, start_offset, end_offset,
step_size);
auto t =
getNumberOfScanSteps().tsquash("inconsistent number of scan steps");
setNumberOfFrames(t);
} }
// Network Configuration (Detector<->Receiver) // Network Configuration (Detector<->Receiver)

View File

@ -449,20 +449,18 @@ void Module::setStartingFrameNumber(uint64_t value) {
void Module::sendSoftwareTrigger() { sendToDetectorStop(F_SOFTWARE_TRIGGER); } void Module::sendSoftwareTrigger() { sendToDetectorStop(F_SOFTWARE_TRIGGER); }
bool Module::getScan() { defs::scanParameters Module::getScan() {
return static_cast<bool>(sendToDetector<int>(F_GET_SCAN)); return sendToDetector<defs::scanParameters>(F_GET_SCAN);
} }
int Module::getNumberOfScanSteps() { void Module::disableScan() {
return sendToDetector<int>(F_GET_NUM_SCAN_STEPS); sendToDetector(F_DISABLE_SCAN);
setNumberOfFrames(1);
} }
void Module::disableScan() { sendToDetector(F_DISABLE_SCAN); } void Module::enableScan(const defs::scanParameters t) {
auto retval = sendToDetector<int64_t>(F_ENABLE_SCAN, t);
void Module::enableScan(const defs::dacIndex dac, const int start_offset, setNumberOfFrames(retval);
const int end_offset, const int step_size) {
int args[]{static_cast<int>(dac), start_offset, end_offset, step_size};
sendToDetector(F_ENABLE_SCAN, args, nullptr);
} }
// Network Configuration (Detector<->Receiver) // Network Configuration (Detector<->Receiver)

View File

@ -166,11 +166,9 @@ class Module : public virtual slsDetectorDefs {
uint64_t getStartingFrameNumber(); uint64_t getStartingFrameNumber();
void setStartingFrameNumber(uint64_t value); void setStartingFrameNumber(uint64_t value);
void sendSoftwareTrigger(); void sendSoftwareTrigger();
bool getScan(); defs::scanParameters getScan();
int getNumberOfScanSteps();
void disableScan(); void disableScan();
void enableScan(const defs::dacIndex dac, const int start_offset, void enableScan(const defs::scanParameters t);
const int end_offset, const int step_size);
/************************************************** /**************************************************
* * * *

View File

@ -47,8 +47,10 @@ std::ostream &operator<<(std::ostream &os,
std::string ToString(const slsDetectorDefs::patternParameters &r); std::string ToString(const slsDetectorDefs::patternParameters &r);
std::ostream &operator<<(std::ostream &os, std::ostream &operator<<(std::ostream &os,
const slsDetectorDefs::patternParameters &r); const slsDetectorDefs::patternParameters &r);
std::string ToString(const slsDetectorDefs::scanParameters &r);
std::ostream &operator<<(std::ostream &os,
const slsDetectorDefs::scanParameters &r);
const std::string &ToString(const std::string &s); const std::string &ToString(const std::string &s);
/** Convert std::chrono::duration with specified output unit */ /** Convert std::chrono::duration with specified output unit */
template <typename T, typename Rep = double> template <typename T, typename Rep = double>
typename std::enable_if<is_duration<T>::value, std::string>::type typename std::enable_if<is_duration<T>::value, std::string>::type

View File

@ -19,6 +19,7 @@
#include "sls_detector_exceptions.h" #include "sls_detector_exceptions.h"
#include <algorithm> #include <algorithm>
#include <bitset> #include <bitset>
#include <chrono>
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#else #else
@ -451,6 +452,24 @@ typedef struct {
uint32_t patwait[3]{}; uint32_t patwait[3]{};
uint64_t patwaittime[3]{}; uint64_t patwaittime[3]{};
} __attribute__((packed)); } __attribute__((packed));
/** scan structure */
struct scanParameters {
dacIndex dacInd{DAC_0};
int startOffset{0};
int stopOffset{0};
int stepSize{0};
int64_t dacSettleTime_ns{100 * 1000};
scanParameters() = default;
scanParameters(
dacIndex dac, int start, int stop, int step,
std::chrono::nanoseconds t = std::chrono::nanoseconds{10000})
: dacInd(dac), startOffset(start), stopOffset(stop),
stepSize(step) {
dacSettleTime_ns = t.count();
}
} __attribute__((packed));
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -201,7 +201,6 @@ enum detFuncs {
F_SET_VETO, F_SET_VETO,
F_SET_PATTERN, F_SET_PATTERN,
F_GET_SCAN, F_GET_SCAN,
F_GET_NUM_SCAN_STEPS,
F_DISABLE_SCAN, F_DISABLE_SCAN,
F_ENABLE_SCAN, F_ENABLE_SCAN,
@ -503,7 +502,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_VETO: return "F_SET_VETO"; case F_SET_VETO: return "F_SET_VETO";
case F_SET_PATTERN: return "F_SET_PATTERN"; case F_SET_PATTERN: return "F_SET_PATTERN";
case F_GET_SCAN: return "F_GET_SCAN"; case F_GET_SCAN: return "F_GET_SCAN";
case F_GET_NUM_SCAN_STEPS: return "F_GET_NUM_SCAN_STEPS";
case F_DISABLE_SCAN: return "F_DISABLE_SCAN"; case F_DISABLE_SCAN: return "F_DISABLE_SCAN";
case F_ENABLE_SCAN: return "F_ENABLE_SCAN"; case F_ENABLE_SCAN: return "F_ENABLE_SCAN";

View File

@ -102,6 +102,23 @@ std::ostream &operator<<(std::ostream &os,
return os << ToString(r); return os << ToString(r);
} }
std::string ToString(const slsDetectorDefs::scanParameters &r) {
std::ostringstream oss;
oss << '[' << "dac " << r.dacInd << std::endl
<< "start " << r.startOffset << std::endl
<< "stop " << r.stopOffset << std::endl
<< "step " << r.stepSize << std::endl
<< "settleTime "
<< ToString(std::chrono::nanoseconds{r.dacSettleTime_ns}) << std::endl
<< ']';
return oss.str();
}
std::ostream &operator<<(std::ostream &os,
const slsDetectorDefs::scanParameters &r) {
return os << ToString(r);
}
std::string ToString(const defs::runStatus s) { std::string ToString(const defs::runStatus s) {
switch (s) { switch (s) {
case defs::ERROR: case defs::ERROR: