Merge pull request #407 from slsdetectorgroup/stopfnum

Stopfnum
This commit is contained in:
Dhanya Thattil
2022-03-17 11:28:32 +01:00
committed by GitHub
6 changed files with 62 additions and 7 deletions

View File

@ -47,6 +47,8 @@ This document describes the differences between v7.0.0 and v6.x.x
- stop servers also check for errors at startup( in case it was running with an older version)
- hostname cmd failed when connecting to servers in update mode (ctb, moench, jungfrau, eiger)
- missingpackets signed (negative => extra packets)
- 10g eiger nextframenumber get fixed.
- stop, able to set nextframenumber to a consistent (max + 1) for all modules if different (eiger/ctb/jungfrau/moench)
2. Resolved Issues

View File

@ -1259,20 +1259,20 @@ int Beb_GetNextFrameNumber(uint64_t *retval, int tengigaEnable) {
else {
uint64_t left10g =
Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_1G_LEFT_MSB_OFST);
temp = Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_1G_LEFT_LSB_OFST);
Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_10G_LEFT_MSB_OFST);
temp = Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_10G_LEFT_LSB_OFST);
left10g = ((left10g << 32) | temp) >> 16;
++left10g; // increment for firmware
uint64_t right10g =
Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_1G_LEFT_MSB_OFST);
temp = Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_1G_LEFT_LSB_OFST);
Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_10G_LEFT_MSB_OFST);
temp = Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_10G_LEFT_LSB_OFST);
right10g = ((right10g << 32) | temp) >> 16;
Beb_close(fd, csp0base);
++right10g; // increment for firmware
if (left10g != right10g) {
LOG(logERROR, ("Retrieved inconsistent frame numbers from `0g left "
LOG(logERROR, ("Retrieved inconsistent frame numbers from 10g left "
"%llu and right %llu\n",
(long long int)left10g, (long long int)right10g));
*retval = (left10g > right10g)

View File

@ -800,6 +800,25 @@ void Detector::startDetectorReadout() {
void Detector::stopDetector(Positions pos) {
pimpl->Parallel(&Module::stopAcquisition, pos);
// validate consistent frame numbers
switch (getDetectorType().squash()) {
case defs::EIGER:
case defs::JUNGFRAU:
case defs::MOENCH:
case defs::CHIPTESTBOARD: {
auto res = getNextFrameNumber(pos);
if (!res.equal()) {
uint64_t maxVal = 0;
for (auto it : res) {
maxVal = std::max(maxVal, it);
}
setNextFrameNumber(maxVal + 1);
}
} break;
default:
break;
}
}
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
@ -1588,7 +1607,6 @@ std::vector<defs::gainMode> Detector::getGainModeList() const {
return std::vector<defs::gainMode>{
defs::DYNAMIC, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
defs::FIX_G1, defs::FIX_G2, defs::FIX_G0};
break;
default:
throw RuntimeError("Gain mode is not implemented for this detector.");
}

View File

@ -2166,6 +2166,41 @@ TEST_CASE("nextframenumber", "[.cmd]") {
proxy.Call("nextframenumber", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "nextframenumber 1\n");
}
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(1);
det.setExptime(std::chrono::microseconds(200));
det.setPeriod(std::chrono::milliseconds(1));
det.startDetector();
std::this_thread::sleep_for(std::chrono::seconds(2));
auto currentfnum =
det.getNextFrameNumber().tsquash("inconsistent frame nr in test");
REQUIRE(currentfnum == 2);
if (det_type == defs::EIGER) {
auto prev_tengiga =
det.getTenGiga().tsquash("inconsistent ten giga enable");
det.setTenGiga(true);
det.setNextFrameNumber(1);
det.startDetector();
std::this_thread::sleep_for(std::chrono::seconds(2));
auto currentfnum = det.getNextFrameNumber().tsquash(
"inconsistent frame nr in test");
REQUIRE(currentfnum == 2);
det.setTenGiga(prev_tengiga);
}
det.setTimingMode(prev_timing);
det.setNumberOfFrames(prev_frames);
det.setExptime(prev_exptime);
det.setPeriod(prev_period);
for (int i = 0; i != det.size(); ++i) {
det.setNextFrameNumber(prev_sfnum[i], {i});
}

View File

@ -5,11 +5,11 @@
#define APILIB 0x211125
#define APIRECEIVER 0x211124
#define APIGUI 0x211124
#define APICTB 0x220317
#define APIGOTTHARD 0x220317
#define APIGOTTHARD2 0x220317
#define APIJUNGFRAU 0x220317
#define APIMYTHEN3 0x220317
#define APIMOENCH 0x220317
#define APIEIGER 0x220317