M3readout (#209)

* m3: readout command
This commit is contained in:
Dhanya Thattil
2020-10-26 16:13:48 +01:00
committed by GitHub
parent 91ad7b0594
commit 47018b61cd
14 changed files with 106 additions and 7 deletions

View File

@@ -456,6 +456,11 @@ class Detector {
* WAITING and automatically returns to idle at the end of acquisition. */
void startDetector();
/** [Mythen3] Non blocking: start detector readout of counters in chip.
* Status changes to TRANSMITTING and automatically returns to idle at the
* end of readout. */
void startDetectorReadout();
/** Non blocking: Abort detector acquisition. Status changes to IDLE or
* STOPPED. Goes to stop server. */
void stopDetector();

View File

@@ -835,6 +835,7 @@ class CmdProxy {
{"rx_start", &CmdProxy::rx_start},
{"rx_stop", &CmdProxy::rx_stop},
{"start", &CmdProxy::start},
{"readout", &CmdProxy::readout},
{"stop", &CmdProxy::stop},
{"rx_status", &CmdProxy::ReceiverStatus},
{"status", &CmdProxy::DetectorStatus},
@@ -1429,7 +1430,14 @@ class CmdProxy {
EXECUTE_SET_COMMAND_NOID(
start, startDetector,
"\n\tStarts detector acquisition. Status changes to RUNNING or WAITING "
"and automatically returns to idle at the end of acquisition.");
"and automatically returns to idle at the end of acquisition. If the "
"acquisition was abruptly stopped, some detectors come back to "
"STOPPED.");
EXECUTE_SET_COMMAND_NOID(
readout, startDetectorReadout,
"\n\t[Mythen3] Starts detector readout. Status changes to TRANSMITTING "
"and automatically returns to idle at the end of readout.");
EXECUTE_SET_COMMAND_NOID(stop, stopDetector,
"\n\tAbort detector acquisition. Status changes "

View File

@@ -593,6 +593,10 @@ void Detector::startDetector() {
pimpl->Parallel(&Module::startAcquisition, {});
}
void Detector::startDetectorReadout() {
pimpl->Parallel(&Module::startReadout, {});
}
void Detector::stopDetector() { pimpl->Parallel(&Module::stopAcquisition, {}); }
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {

View File

@@ -407,6 +407,11 @@ void Module::startAcquisition() {
sendToDetector(F_START_ACQUISITION);
}
void Module::startReadout() {
shm()->stoppedFlag = false;
sendToDetector(F_START_READOUT);
}
void Module::stopAcquisition() {
// get status before stopping acquisition
runStatus s = ERROR, r = ERROR;

View File

@@ -160,6 +160,7 @@ class Module : public virtual slsDetectorDefs {
void startReceiver();
void stopReceiver();
void startAcquisition();
void startReadout();
void stopAcquisition();
void restreamStopFromReceiver();
void startAndReadAll();

View File

@@ -115,6 +115,23 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs][.new]") {
}
}
/* acquisition */
TEST_CASE("readout", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
// PUT only command
REQUIRE_THROWS(proxy.Call("readout", {}, -1, GET));
auto det_type = det.getDetectorType().squash();
if (det_type != defs::MYTHEN3) {
REQUIRE_THROWS(proxy.Call("readout", {}, -1, GET));
} else {
std::ostringstream oss;
proxy.Call("readout", {}, -1, PUT, oss);
REQUIRE(oss.str() == "readout successful\n");
}
}
/* Mythen3 Specific */
TEST_CASE("counters", "[.cmd][.new]") {