Fixed big problem with CPU readout

This commit is contained in:
bergamaschi 2018-12-06 12:58:54 +01:00
parent 2815458652
commit dceea92f1a
7 changed files with 35 additions and 31 deletions

View File

@ -335,7 +335,7 @@ int sendDataOnly(int file_des, void* buf,int length) {
int rc = write(file_des, (char*)((char*)buf + bytesSent), bytesToSend); int rc = write(file_des, (char*)((char*)buf + bytesSent), bytesToSend);
// error // error
if (rc < 0) { if (rc < 0) {
cprintf(BG_RED, "Error writing to socket. Possible socket crash\n"); cprintf(BG_RED, "Error writing to socket. Possible socket crash: left=%d rc=%d length=%d sent=%d\n", bytesToSend, rc, length, bytesSent);
return bytesSent; return bytesSent;
} }
// also error, wrote nothing, buffer blocked up, too fast sending for client // also error, wrote nothing, buffer blocked up, too fast sending for client

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/jctbDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/jctbDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 40dedb8b07886171334c85a6f0035f02f868ac6d Repsitory UUID: 2815458652a93d861e8bd082e537ac63d945f3fb
Revision: 28 Revision: 31
Branch: developer Branch: developer
Last Changed Author: Gemma_Tinti Last Changed Author: Anna_Bergamaschi
Last Changed Rev: 4052 Last Changed Rev: 4057
Last Changed Date: 2018-11-21 11:31:54.000000002 +0100 ./server_funcs.c Last Changed Date: 2018-12-06 10:55:32.000000002 +0100 ./server_funcs.c

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git" #define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "40dedb8b07886171334c85a6f0035f02f868ac6d" #define GITREPUUID "2815458652a93d861e8bd082e537ac63d945f3fb"
#define GITAUTH "Gemma_Tinti" #define GITAUTH "Anna_Bergamaschi"
#define GITREV 0x4052 #define GITREV 0x4057
#define GITDATE 0x20181121 #define GITDATE 0x20181206
#define GITBRANCH "developer" #define GITBRANCH "developer"

View File

@ -2380,7 +2380,7 @@ int* multiSlsDetector::startAndReadAll() {
while ((retval = getDataFromDetector())) { while ((retval = getDataFromDetector())) {
++i; ++i;
#ifdef VERBOSE #ifdef VERBOSE
std::cout << i << std::endl; std::cout << i << " " retval << std::endl;
#endif #endif
dataQueue.push(retval); dataQueue.push(retval);
} }
@ -2458,7 +2458,7 @@ int* multiSlsDetector::getDataFromDetector() {
int nodatadet = -1; int nodatadet = -1;
int nodatadetectortype = false; int nodatadetectortype = false;
detectorType types = getDetectorsType(); detectorType types = getDetectorsType();
if (types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX) { if (types == EIGER || types == JUNGFRAU || types == GOTTHARD || types == PROPIX) {
nodatadetectortype = true; nodatadetectortype = true;
} }

View File

@ -145,7 +145,7 @@ double* slsDetector::decodeData(int *datain, int &nn, double *fdata) {
dataout[ichan]=*((u_int16_t*)ptr); dataout[ichan]=*((u_int16_t*)ptr);
ptr+=2; ptr+=2;
} }
std::cout<< "decoded "<< ichan << " channels" << std::endl; //std::cout<< "decoded "<< ichan << " channels" << std::endl;
} else { } else {
switch (nbits) { switch (nbits) {
case 1: case 1:
@ -3821,8 +3821,8 @@ int* slsDetector::startAndReadAll() {
//#ifdef VERBOSE //#ifdef VERBOSE
#ifdef VERBOSE #ifdef VERBOSE
int i=0; int i=0;
#endif
//#endif //#endif
#endif
if(thisDetector->myDetectorType == EIGER) { if(thisDetector->myDetectorType == EIGER) {
if (prepareAcquisition() == FAIL) if (prepareAcquisition() == FAIL)
return NULL; return NULL;
@ -3832,15 +3832,15 @@ int* slsDetector::startAndReadAll() {
// std::cout<< "started" << std::endl; // std::cout<< "started" << std::endl;
//#endif //#endif
while ((retval=getDataFromDetector())){ while ((retval=getDataFromDetector())){
#ifdef VERBOSE #ifdef VERBOSE
++i; ++i;
std::cout<< i << std::endl; // std::cout<< i << std::endl;
//#else //#else
//std::cout<< "-" << flush; //std::cout<< "-" << flush;
#endif #endif
dataQueue.push(retval); dataQueue.push(retval);
//std::cout<< "pushed" << std::endl; // std::cout<< "pushed" << retval << std::endl;
} }
disconnectControl(); disconnectControl();
@ -3848,7 +3848,7 @@ int* slsDetector::startAndReadAll() {
std::cout<< "received "<< i<< " frames" << std::endl; std::cout<< "received "<< i<< " frames" << std::endl;
//#else //#else
// std::cout << std::endl; // std::cout << std::endl;
#endif #endif
return dataQueue.front(); // check what we return! return dataQueue.front(); // check what we return!
/* while ((retval=getDataFromDetectorNoWait())) /* while ((retval=getDataFromDetectorNoWait()))
++i; ++i;
@ -3892,10 +3892,13 @@ int* slsDetector::getDataFromDetector(int *retval) {
int nodatadetectortype = false; int nodatadetectortype = false;
detectorType types = getDetectorsType(); detectorType types = getDetectorsType();
if(types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX){ // cout << types << endl;
if(types == EIGER || types == JUNGFRAU || types == GOTTHARD || types == PROPIX){
nodatadetectortype = true; nodatadetectortype = true;
} }
//cout << "nodata det" << nodatadetectortype << endl;
if (!nodatadetectortype && retval==NULL) if (!nodatadetectortype && retval==NULL)
retval=new int[nel]; retval=new int[nel];
@ -3917,22 +3920,22 @@ int* slsDetector::getDataFromDetector(int *retval) {
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::cout<< "Detector successfully returned: " << mess << " " << n
<< std::endl; << std::endl;
#endif #endif
} }
if ((!nodatadetectortype) && (r==NULL)){ if ((!nodatadetectortype) && (r==NULL)){
delete [] retval; delete [] retval;
} }
return NULL; return NULL;
} else if (!nodatadetectortype){ } else if (!nodatadetectortype){
// cout <<"??" << endl;
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 from detector: received " << std::cout<< "wrong data size received from detector: received " <<
n << " but expected " << thisDetector->dataBytes << std::endl; n << " but expected " << thisDetector->dataBytes << std::endl;
@ -3948,7 +3951,8 @@ int* slsDetector::getDataFromDetector(int *retval) {
} }
// cout << "get data returning " << endl;
// cout << "get data returning " << retval << endl;
// cout << endl; // cout << endl;
return retval; return retval;

View File

@ -125,7 +125,7 @@ int fileIO::writeDataFile(void *data, int iframe) {
int fileIO::closeDataFile() { int fileIO::closeDataFile() {
cout << "close file...." << endl; // cout << "close file...." << endl;
if (filefd) if (filefd)
fclose(filefd); fclose(filefd);
filefd=NULL; filefd=NULL;

View File

@ -666,9 +666,9 @@ public:
if (tcpfd<0) return -1; if (tcpfd<0) return -1;
while(length>0){ while(length>0){
nsending = (length>packet_size) ? packet_size:length; nsending = (length>packet_size) ? packet_size:length;
std::cout << "*"<<nsending << std::endl; // std::cout << "*"<<nsending << std::endl;
nsent = read(tcpfd,(char*)buf+total_sent,nsending); nsent = read(tcpfd,(char*)buf+total_sent,nsending);
std::cout << "+"<<nsent << std::endl; // std::cout << "+"<<nsent << std::endl;
if(!nsent) { if(!nsent) {
if(!total_sent) { if(!total_sent) {
return -1; //to handle it return -1; //to handle it
@ -677,7 +677,7 @@ public:
} }
length-=nsent; length-=nsent;
total_sent+=nsent; total_sent+=nsent;
std::cout << "+"<< length << " " << total_sent << std::endl; // std::cout << "+"<< length << " " << total_sent << std::endl;
} }
if (total_sent>0) if (total_sent>0)