mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40: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"));
|
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
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
|
#ifdef EIGERD
|
||||||
// check for hardware mac and hardware ip
|
// check for hardware mac and hardware ip
|
||||||
if (udpDetails.srcmac != getDetectorMAC()) {
|
if (udpDetails.srcmac != getDetectorMAC()) {
|
||||||
@ -1861,6 +1877,22 @@ int start_and_read_all(int file_des) {
|
|||||||
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
|
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
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
|
#ifdef EIGERD
|
||||||
// check for hardware mac and hardware ip
|
// check for hardware mac and hardware ip
|
||||||
if (udpDetails.srcmac != getDetectorMAC()) {
|
if (udpDetails.srcmac != getDetectorMAC()) {
|
||||||
|
@ -1008,6 +1008,7 @@ int multiSlsDetector::acquire() {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
struct timespec begin, end;
|
struct timespec begin, end;
|
||||||
clock_gettime(CLOCK_REALTIME, &begin);
|
clock_gettime(CLOCK_REALTIME, &begin);
|
||||||
|
|
||||||
@ -1041,10 +1042,15 @@ int multiSlsDetector::acquire() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// start and read all
|
// start and read all
|
||||||
|
try {
|
||||||
if (multi_shm()->multiDetectorType == EIGER) {
|
if (multi_shm()->multiDetectorType == EIGER) {
|
||||||
Parallel(&slsDetector::prepareAcquisition, {});
|
Parallel(&slsDetector::prepareAcquisition, {});
|
||||||
}
|
}
|
||||||
Parallel(&slsDetector::startAndReadAll, {});
|
Parallel(&slsDetector::startAndReadAll, {});
|
||||||
|
} catch (...) {
|
||||||
|
Parallel(&slsDetector::stopReceiver, {});
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
// stop receiver
|
// stop receiver
|
||||||
if (receiver) {
|
if (receiver) {
|
||||||
@ -1081,9 +1087,11 @@ int multiSlsDetector::acquire() {
|
|||||||
<< ((end.tv_sec - begin.tv_sec) +
|
<< ((end.tv_sec - begin.tv_sec) +
|
||||||
(end.tv_nsec - begin.tv_nsec) / 1000000000.0)
|
(end.tv_nsec - begin.tv_nsec) / 1000000000.0)
|
||||||
<< " seconds";
|
<< " seconds";
|
||||||
|
} catch (...) {
|
||||||
|
setAcquiringFlag(false);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
setAcquiringFlag(false);
|
setAcquiringFlag(false);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
#define APIGOTTHARD 0x191127
|
#define APIGOTTHARD 0x191127
|
||||||
#define APIJUNGFRAU 0x191127
|
#define APIJUNGFRAU 0x191127
|
||||||
#define APIEIGER 0x191129
|
#define APIEIGER 0x191129
|
||||||
#define APICTB 0x191209
|
#define APICTB 0x191210
|
||||||
|
Loading…
x
Reference in New Issue
Block a user