mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
ctb: validate asampes and dsamples > 0 for romode; client: exception caught in acquire to stop receiver and clear busy flag
This commit is contained in:
parent
5cf1502287
commit
504fc2d095
Binary file not shown.
@ -1743,6 +1743,22 @@ int start_acquisition(int file_des) {
|
||||
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
int mode = getReadoutMode();
|
||||
int asamples = getNumAnalogSamples();
|
||||
int dsamples = getNumDigitalSamples();
|
||||
if ((mode == ANALOG_AND_DIGITAL || mode == ANALOG_ONLY) && (asamples <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", asamples);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else if ((mode == ANALOG_AND_DIGITAL || mode == DIGITAL_ONLY) && (dsamples <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not start acquisition. Invalid number of digital samples: %d.\n", dsamples);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
// check for hardware mac and hardware ip
|
||||
if (udpDetails.srcmac != getDetectorMAC()) {
|
||||
@ -1861,6 +1877,22 @@ int start_and_read_all(int file_des) {
|
||||
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
int mode = getReadoutMode();
|
||||
int asamples = getNumAnalogSamples();
|
||||
int dsamples = getNumDigitalSamples();
|
||||
if ((mode == ANALOG_AND_DIGITAL || mode == ANALOG_ONLY) && (asamples <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", asamples);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else if ((mode == ANALOG_AND_DIGITAL || mode == DIGITAL_ONLY) && (dsamples <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not start acquisition. Invalid number of digital samples: %d.\n", dsamples);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
// check for hardware mac and hardware ip
|
||||
if (udpDetails.srcmac != getDetectorMAC()) {
|
||||
|
@ -1008,6 +1008,7 @@ int multiSlsDetector::acquire() {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
try {
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
|
||||
@ -1041,10 +1042,15 @@ int multiSlsDetector::acquire() {
|
||||
}
|
||||
|
||||
// start and read all
|
||||
try {
|
||||
if (multi_shm()->multiDetectorType == EIGER) {
|
||||
Parallel(&slsDetector::prepareAcquisition, {});
|
||||
}
|
||||
Parallel(&slsDetector::startAndReadAll, {});
|
||||
} catch (...) {
|
||||
Parallel(&slsDetector::stopReceiver, {});
|
||||
throw;
|
||||
}
|
||||
|
||||
// stop receiver
|
||||
if (receiver) {
|
||||
@ -1081,9 +1087,11 @@ int multiSlsDetector::acquire() {
|
||||
<< ((end.tv_sec - begin.tv_sec) +
|
||||
(end.tv_nsec - begin.tv_nsec) / 1000000000.0)
|
||||
<< " seconds";
|
||||
|
||||
} catch (...) {
|
||||
setAcquiringFlag(false);
|
||||
throw;
|
||||
}
|
||||
setAcquiringFlag(false);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,4 @@
|
||||
#define APIGOTTHARD 0x191127
|
||||
#define APIJUNGFRAU 0x191127
|
||||
#define APIEIGER 0x191129
|
||||
#define APICTB 0x191209
|
||||
#define APICTB 0x191210
|
||||
|
Loading…
x
Reference in New Issue
Block a user