mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 11:50:03 +02:00
edited getdatafromdetector to not stop detector for eiger
This commit is contained in:
parent
66db11421f
commit
bc55f9d1e4
Binary file not shown.
@ -622,10 +622,10 @@ int startStateMachine(){
|
||||
|
||||
|
||||
int stopStateMachine(){
|
||||
printf("Going to stop acquisition\n");
|
||||
cprintf(BG_RED,"Going to stop acquisition\n");
|
||||
if(Feb_Control_StopAcquisition() & Beb_StopAcquisition())
|
||||
return OK;
|
||||
printf("failed to stop acquisition\n");
|
||||
cprintf(BG_RED,"failed to stop acquisition\n");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
@ -1293,66 +1293,72 @@ int multiSlsDetector::startReadOut(){
|
||||
|
||||
int* multiSlsDetector::getDataFromDetector() {
|
||||
|
||||
int nel=thisMultiDetector->dataBytes/sizeof(int);
|
||||
int n;
|
||||
int* retval=new int[nel];
|
||||
int *retdet, *p=retval;
|
||||
int nodata=1, nodatadet=-1;;
|
||||
|
||||
int nel=thisMultiDetector->dataBytes/sizeof(int);
|
||||
int n;
|
||||
int* retval=new int[nel];
|
||||
int *retdet, *p=retval;
|
||||
int nodata=1, nodatadet=-1;;
|
||||
|
||||
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
|
||||
if (detectors[id]) {
|
||||
retdet=detectors[id]->getDataFromDetector(p);
|
||||
n=detectors[id]->getDataBytes();
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
|
||||
if (retdet) {
|
||||
nodata=0;
|
||||
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
|
||||
if (detectors[id]) {
|
||||
retdet=detectors[id]->getDataFromDetector(p);
|
||||
n=detectors[id]->getDataBytes();
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
|
||||
if (retdet) {
|
||||
nodata=0;
|
||||
#ifdef VERBOSE
|
||||
cout << "Detector " << id << " returned " << n << " bytes " << endl;
|
||||
cout << "Detector " << id << " returned " << n << " bytes " << endl;
|
||||
#endif
|
||||
} else {
|
||||
nodatadet=id;
|
||||
} else {
|
||||
nodatadet=id;
|
||||
#ifdef VERBOSE
|
||||
cout << "Detector " << id << " does not have data left " << endl;
|
||||
cout << "Detector " << id << " does not have data left " << endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
p+=n/sizeof(int);
|
||||
}
|
||||
}
|
||||
if (nodatadet>=0) {
|
||||
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
|
||||
if (id!=nodatadet) {
|
||||
if (detectors[id]) {
|
||||
#ifdef VERBOSE
|
||||
cout << "Stopping detector "<< id << endl;
|
||||
#endif
|
||||
detectors[id]->stopAcquisition();
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
|
||||
while ((retdet=detectors[id]->getDataFromDetector())) {
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Detector "<< id << " still sent data " << endl;
|
||||
#endif
|
||||
delete [] retdet;
|
||||
}
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
|
||||
if(detectors[id]->getDetectorsType() != EIGER)
|
||||
break;
|
||||
}
|
||||
p+=n/sizeof(int);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete [] retval;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return retval;
|
||||
//eiger returns only null
|
||||
if(getDetectorsType() == EIGER)
|
||||
return NULL;
|
||||
|
||||
if (nodatadet>=0) {
|
||||
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
|
||||
if (id!=nodatadet) {
|
||||
if (detectors[id]) {
|
||||
#ifdef VERBOSE
|
||||
cout << "Stopping detector "<< id << endl;
|
||||
#endif
|
||||
detectors[id]->stopAcquisition();
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
|
||||
while ((retdet=detectors[id]->getDataFromDetector())) {
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Detector "<< id << " still sent data " << endl;
|
||||
#endif
|
||||
delete [] retdet;
|
||||
}
|
||||
if(detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<id));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
delete [] retval;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
|
||||
|
@ -3546,62 +3546,62 @@ int* slsDetector::readFrame(){
|
||||
|
||||
|
||||
int* slsDetector::getDataFromDetector(int *retval){
|
||||
int nel=thisDetector->dataBytes/sizeof(int);
|
||||
int n;
|
||||
int nel=thisDetector->dataBytes/sizeof(int);
|
||||
int n;
|
||||
|
||||
int *r=retval;
|
||||
int *r=retval;
|
||||
|
||||
|
||||
// int* retval=new int[nel];
|
||||
// int* retval=new int[nel];
|
||||
|
||||
if (retval==NULL)
|
||||
retval=new int[nel];
|
||||
if (retval==NULL)
|
||||
retval=new int[nel];
|
||||
|
||||
int ret=FAIL;
|
||||
char mess[100]="Nothing";
|
||||
int ret=FAIL;
|
||||
char mess[100]="Nothing";
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "getting data "<< thisDetector->dataBytes << " " << nel<< std::endl;
|
||||
std::cout<< "getting data "<< thisDetector->dataBytes << " " << nel<< std::endl;
|
||||
#endif
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
#ifdef VERBOSE
|
||||
cout << "ret=" << ret << endl;
|
||||
cout << "ret=" << ret << endl;
|
||||
#endif
|
||||
|
||||
if (ret!=OK) {
|
||||
n= controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
// if(thisDetector->receiverOnlineFlag == OFFLINE_FLAG)
|
||||
if (ret==FAIL) {
|
||||
thisDetector->stoppedFlag=1;
|
||||
std::cout<< "Detector returned: " << mess << " " << n << std::endl;
|
||||
} else {
|
||||
;
|
||||
if (ret!=OK) {
|
||||
n= controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
// if(thisDetector->receiverOnlineFlag == OFFLINE_FLAG)
|
||||
if (ret==FAIL) {
|
||||
thisDetector->stoppedFlag=1;
|
||||
std::cout<< "Detector returned: " << mess << " " << n << std::endl;
|
||||
} else {
|
||||
;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Detector successfully returned: " << mess << " " << n << std::endl;
|
||||
std::cout<< "Detector successfully returned: " << mess << " " << n << std::endl;
|
||||
#endif
|
||||
}
|
||||
if (r==NULL) {
|
||||
delete [] retval;
|
||||
}
|
||||
return NULL;
|
||||
} else {
|
||||
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
|
||||
}
|
||||
if (r==NULL) {
|
||||
delete [] retval;
|
||||
}
|
||||
return NULL;
|
||||
} else {
|
||||
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
|
||||
|
||||
// #ifdef VERBOSE
|
||||
std::cout<< "Received "<< n << " data bytes" << std::endl;
|
||||
// #endif
|
||||
if (n!=thisDetector->dataBytes) {
|
||||
std::cout<< "wrong data size received: received " << n << " but expected " << thisDetector->dataBytes << std::endl;
|
||||
thisDetector->stoppedFlag=1;
|
||||
ret=FAIL;
|
||||
if (r==NULL) {
|
||||
delete [] retval;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// cout << "get data returning " << endl;
|
||||
return retval;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Received "<< n << " data bytes" << std::endl;
|
||||
#endif
|
||||
if (n!=thisDetector->dataBytes) {
|
||||
std::cout<< "wrong data size received: received " << n << " but expected " << thisDetector->dataBytes << std::endl;
|
||||
thisDetector->stoppedFlag=1;
|
||||
ret=FAIL;
|
||||
if (r==NULL) {
|
||||
delete [] retval;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// cout << "get data returning " << endl;
|
||||
return retval;
|
||||
|
||||
};
|
||||
|
||||
@ -5207,8 +5207,10 @@ char* slsDetector::setDetectorIP(string detectorIP){
|
||||
|
||||
|
||||
char* slsDetector::setReceiver(string receiverIP){
|
||||
if(getRunStatus()==RUNNING)
|
||||
if(getRunStatus()==RUNNING){
|
||||
cprintf(RED,"Acquisition already running, Stopping it.\n");
|
||||
stopAcquisition();
|
||||
}
|
||||
|
||||
strcpy(thisDetector->receiver_hostname,receiverIP.c_str());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user