edited moench receiver

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@520 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-04-19 14:42:33 +00:00
parent 5ab6d9076d
commit 82ce92e990
4 changed files with 27 additions and 32 deletions

View File

@ -450,7 +450,7 @@ void* postProcessing::processData(int delflag) {
}
}
else{
cout<<"****Detector returned mismatched indices/garbage. Trying again.***"<<endl;
;//cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
}
}
}

View File

@ -29,8 +29,8 @@
#define MOENCH_DATA_BYTES 1280*MOENCH_PACKETS_PER_FRAME
#define MOENCH_BYTES_PER_ADC 40*2
#define MOENCH_PIXELS_IN_X_DIMENSION 160
#define MOENCH_BYTES_PER_X_DIMENSION 160*MOENCH_PIXELS_IN_X_DIMENSION
#define MOENCH_PIXELS_IN_ONE_DIMENSION 160
#define MOENCH_BYTES_IN_ONE_DIMENSION MOENCH_PIXELS_IN_ONE_DIMENSION*2

View File

@ -344,8 +344,6 @@ int slsReceiverFunctionList::startListening(){
rc = udpSocket->ReceiveDataOnly(buffer,bufferSize);
if( rc < 0)
cerr << "recvfrom() failed" << endl;
if(rc<bufferSize)
cerr << "LESS than buffersize received" << rc << endl;
//start for each scan
if(startFrameIndex==-1){

View File

@ -875,7 +875,7 @@ int slsReceiverFuncs::read_frame(){
int slsReceiverFuncs::moench_read_frame(){
ret=OK;
char fName[MAX_STR_LENGTH]="";
int arg = -1,i,j,y;
int arg = -1,i,j,x,y;
int bufferSize = MOENCH_BUFFER_SIZE;
@ -894,7 +894,9 @@ int slsReceiverFuncs::moench_read_frame(){
int index=-1;//,index2=-1;
int startIndex=-1;
int count=0;
int offset=0;
int partsPerFrame;
strcpy(mess,"Could not read frame\n");
@ -921,20 +923,28 @@ int slsReceiverFuncs::moench_read_frame(){
if (raw == NULL){
index = startIndex;
cout << "didnt get data. Gui will try again" << endl;
}else{
//upto 40 indices, look at just index1 and index2 for now
index=(int)(*(int*)raw);
memcpy(origVal,raw,bufferSize);
raw=NULL;
}
/*
//copy data 80 bytes, then in y direction
offset = 4;y=0;
for(i=0;i<MOENCH_PACKETS_PER_FRAME;i++){
offset = 4;j=0;
partsPerFrame = onedatasize/MOENCH_BYTES_PER_ADC;
//filling up in y direction and then in x direcction
for(x=0;x<MOENCH_BYTES_IN_ONE_DIMENSION/MOENCH_BYTES_PER_ADC;x++){
for(y=0;j<MOENCH_PIXELS_IN_ONE_DIMENSION;j++){
for(j=0;j<onedatasize/MOENCH_BYTES_PER_ADC;j++){
memcpy((((char*)retval) + y*MOENCH_BYTES_PER_X_DIMENSION + j*MOENCH_BYTES_PER_ADC),
memcpy((((char*)retval) + y*MOENCH_BYTES_IN_ONE_DIMENSION + x*MOENCH_BYTES_PER_ADC),
(((char*) origVal) + offset + j*MOENCH_BYTES_PER_ADC) ,
MOENCH_BYTES_PER_ADC);
if (offset == 4) offset = 10;
else offset = 4;
if (y == MOENCH_PIXELS_IN_X_DIMENSION-1) y=0;
else y++;
j++;
//after 1280 bytes(16 parts of 80 bytes), add 6 bytes to offset
if (!(j%partsPerFrame))
offset+=6;
}
}
*/
@ -944,19 +954,6 @@ int slsReceiverFuncs::moench_read_frame(){
memcpy((((char*)retval)+ onedatasize*(i+1)), (((char*) origVal)+10+onedatasize+ onebuffersize*i),onedatasize);
}
}else{
//upto 40 indices, look at just index1 and index2 for now
index=(int)(*(int*)raw);
//index2= (int)(*((int*)((char*)(raw+onebuffersize))));
memcpy(origVal,raw,bufferSize);
raw=NULL;
for(i=0;i<MOENCH_PACKETS_PER_FRAME;i=i+2){
memcpy((((char*)retval)+ onedatasize*i), (((char*) origVal)+4+ onebuffersize*i) , onedatasize);
memcpy((((char*)retval)+ onedatasize*(i+1)), (((char*) origVal)+10+onedatasize+ onebuffersize*i),onedatasize);
}
}
arg=((index - startIndex)/MOENCH_PACKETS_PER_FRAME)-1;
#ifdef VERBOSE