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);
// error
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;
}
// also error, wrote nothing, buffer blocked up, too fast sending for client

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/jctbDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 40dedb8b07886171334c85a6f0035f02f868ac6d
Revision: 28
Repsitory UUID: 2815458652a93d861e8bd082e537ac63d945f3fb
Revision: 31
Branch: developer
Last Changed Author: Gemma_Tinti
Last Changed Rev: 4052
Last Changed Date: 2018-11-21 11:31:54.000000002 +0100 ./server_funcs.c
Last Changed Author: Anna_Bergamaschi
Last Changed Rev: 4057
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 GITREPUUID "40dedb8b07886171334c85a6f0035f02f868ac6d"
#define GITAUTH "Gemma_Tinti"
#define GITREV 0x4052
#define GITDATE 0x20181121
#define GITREPUUID "2815458652a93d861e8bd082e537ac63d945f3fb"
#define GITAUTH "Anna_Bergamaschi"
#define GITREV 0x4057
#define GITDATE 0x20181206
#define GITBRANCH "developer"

View File

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

View File

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

View File

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

View File

@ -666,9 +666,9 @@ public:
if (tcpfd<0) return -1;
while(length>0){
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);
std::cout << "+"<<nsent << std::endl;
// std::cout << "+"<<nsent << std::endl;
if(!nsent) {
if(!total_sent) {
return -1; //to handle it
@ -677,7 +677,7 @@ public:
}
length-=nsent;
total_sent+=nsent;
std::cout << "+"<< length << " " << total_sent << std::endl;
// std::cout << "+"<< length << " " << total_sent << std::endl;
}
if (total_sent>0)