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

View File

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

View File

@ -559,26 +559,14 @@ void Detector::sendSoftwareTrigger(Positions 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);
}
Result<int> Detector::getNumberOfScanSteps(Positions pos) const {
return pimpl->Parallel(&Module::getNumberOfScanSteps, pos);
}
void Detector::disableScan() { pimpl->Parallel(&Module::disableScan, {}); }
void Detector::disableScan() {
pimpl->Parallel(&Module::disableScan, {});
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);
void Detector::enableScan(const defs::scanParameters t) {
pimpl->Parallel(&Module::enableScan, {}, t);
}
// Network Configuration (Detector<->Receiver)

View File

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

View File

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