This commit is contained in:
2020-06-29 17:40:41 +02:00
parent 902366fede
commit 0c045f0faa
11 changed files with 318 additions and 346 deletions

View File

@ -997,8 +997,10 @@ std::string CmdProxy::Scan(int action) {
if (action == defs::HELP_ACTION) {
os << "[dac_name|0|trimbit_scan] [start_val] [stop_val] "
"[step_size]\n\tConfigures to scan "
"dac. Must acquire after this. To cancel the scan configuration "
"set dac to '0' without further arguments."
"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."
<< '\n';
} else if (action == defs::GET_ACTION) {
@ -1014,12 +1016,12 @@ std::string CmdProxy::Scan(int action) {
} else if (args.size() != 4) {
WrongNumberOfParameters(4);
} else {
auto t = det->enableScan(
StringTo<defs::dacIndex>(args[0]), StringTo<int>(args[1]),
StringTo<int>(args[2]), StringTo<int>(args[3]));
auto nsteps = det->getNumScanSteps().tsquash(
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';
os << "scan enabled for " << nsteps << " steps" << '\n';
}
} else {
throw sls::RuntimeError("Unknown action");

View File

@ -562,25 +562,26 @@ void Detector::sendSoftwareTrigger(Positions pos) {
pimpl->Parallel(&Module::sendSoftwareTrigger, pos);
}
Result<bool> getScan(Positions pos = {}) const {
Result<bool> Detector::getScan(Positions pos) const {
return pimpl->Parallel(&Module::getScan, pos);
}
Result<int> getNumberOfScanSteps(Positions pos = {}) const {
Result<int> Detector::getNumberOfScanSteps(Positions pos) const {
return pimpl->Parallel(&Module::getNumberOfScanSteps, pos);
}
void 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::scan, start_offset, end_offset, step_size, {-1});
pimpl->Parallel(&Module::enableScan, {}, dac, start_offset, end_offset,
step_size);
auto t =
getNumberOfScanSteps().tsquash("inconsistent number of scan steps");
setNumberOfFrames(nsteps);
setNumberOfFrames(t);
}
// Network Configuration (Detector<->Receiver)

View File

@ -451,11 +451,11 @@ void Module::setStartingFrameNumber(uint64_t value) {
void Module::sendSoftwareTrigger() { sendToDetectorStop(F_SOFTWARE_TRIGGER); }
bool Module::getScan() const {
bool Module::getScan() {
return static_cast<bool>(sendToDetector<int>(F_GET_SCAN));
}
int Module::getNumberOfScanSteps() const {
int Module::getNumberOfScanSteps() {
return sendToDetector<int>(F_GET_NUM_SCAN_STEPS);
}

View File

@ -167,8 +167,8 @@ class Module : public virtual slsDetectorDefs {
uint64_t getStartingFrameNumber();
void setStartingFrameNumber(uint64_t value);
void sendSoftwareTrigger();
bool getScan() const;
int getNumberOfScanSteps() const;
bool getScan();
int getNumberOfScanSteps();
void disableScan();
void enableScan(const defs::dacIndex dac, const int start_offset,
const int end_offset, const int step_size);