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