mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-09 11:30:43 +02:00
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:
parent
5ab6d9076d
commit
82ce92e990
@ -450,7 +450,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
cout<<"****Detector returned mismatched indices/garbage. Trying again.***"<<endl;
|
;//cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
#define MOENCH_DATA_BYTES 1280*MOENCH_PACKETS_PER_FRAME
|
#define MOENCH_DATA_BYTES 1280*MOENCH_PACKETS_PER_FRAME
|
||||||
|
|
||||||
#define MOENCH_BYTES_PER_ADC 40*2
|
#define MOENCH_BYTES_PER_ADC 40*2
|
||||||
#define MOENCH_PIXELS_IN_X_DIMENSION 160
|
#define MOENCH_PIXELS_IN_ONE_DIMENSION 160
|
||||||
#define MOENCH_BYTES_PER_X_DIMENSION 160*MOENCH_PIXELS_IN_X_DIMENSION
|
#define MOENCH_BYTES_IN_ONE_DIMENSION MOENCH_PIXELS_IN_ONE_DIMENSION*2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -344,8 +344,6 @@ int slsReceiverFunctionList::startListening(){
|
|||||||
rc = udpSocket->ReceiveDataOnly(buffer,bufferSize);
|
rc = udpSocket->ReceiveDataOnly(buffer,bufferSize);
|
||||||
if( rc < 0)
|
if( rc < 0)
|
||||||
cerr << "recvfrom() failed" << endl;
|
cerr << "recvfrom() failed" << endl;
|
||||||
if(rc<bufferSize)
|
|
||||||
cerr << "LESS than buffersize received" << rc << endl;
|
|
||||||
|
|
||||||
//start for each scan
|
//start for each scan
|
||||||
if(startFrameIndex==-1){
|
if(startFrameIndex==-1){
|
||||||
|
@ -875,7 +875,7 @@ int slsReceiverFuncs::read_frame(){
|
|||||||
int slsReceiverFuncs::moench_read_frame(){
|
int slsReceiverFuncs::moench_read_frame(){
|
||||||
ret=OK;
|
ret=OK;
|
||||||
char fName[MAX_STR_LENGTH]="";
|
char fName[MAX_STR_LENGTH]="";
|
||||||
int arg = -1,i,j,y;
|
int arg = -1,i,j,x,y;
|
||||||
|
|
||||||
|
|
||||||
int bufferSize = MOENCH_BUFFER_SIZE;
|
int bufferSize = MOENCH_BUFFER_SIZE;
|
||||||
@ -894,7 +894,9 @@ int slsReceiverFuncs::moench_read_frame(){
|
|||||||
int index=-1;//,index2=-1;
|
int index=-1;//,index2=-1;
|
||||||
int startIndex=-1;
|
int startIndex=-1;
|
||||||
int count=0;
|
int count=0;
|
||||||
|
|
||||||
int offset=0;
|
int offset=0;
|
||||||
|
int partsPerFrame;
|
||||||
|
|
||||||
strcpy(mess,"Could not read frame\n");
|
strcpy(mess,"Could not read frame\n");
|
||||||
|
|
||||||
@ -921,40 +923,35 @@ int slsReceiverFuncs::moench_read_frame(){
|
|||||||
if (raw == NULL){
|
if (raw == NULL){
|
||||||
index = startIndex;
|
index = startIndex;
|
||||||
cout << "didnt get data. Gui will try again" << endl;
|
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;j=0;
|
||||||
offset = 4;y=0;
|
partsPerFrame = onedatasize/MOENCH_BYTES_PER_ADC;
|
||||||
for(i=0;i<MOENCH_PACKETS_PER_FRAME;i++){
|
//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_IN_ONE_DIMENSION + x*MOENCH_BYTES_PER_ADC),
|
||||||
memcpy((((char*)retval) + y*MOENCH_BYTES_PER_X_DIMENSION + j*MOENCH_BYTES_PER_ADC),
|
|
||||||
(((char*) origVal) + offset + j*MOENCH_BYTES_PER_ADC) ,
|
(((char*) origVal) + offset + j*MOENCH_BYTES_PER_ADC) ,
|
||||||
MOENCH_BYTES_PER_ADC);
|
MOENCH_BYTES_PER_ADC);
|
||||||
if (offset == 4) offset = 10;
|
|
||||||
else offset = 4;
|
j++;
|
||||||
if (y == MOENCH_PIXELS_IN_X_DIMENSION-1) y=0;
|
//after 1280 bytes(16 parts of 80 bytes), add 6 bytes to offset
|
||||||
else y++;
|
if (!(j%partsPerFrame))
|
||||||
|
offset+=6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(i=0;i<MOENCH_PACKETS_PER_FRAME;i=i+2){
|
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), (((char*) origVal)+4+ onebuffersize*i) , onedatasize);
|
||||||
memcpy((((char*)retval)+ onedatasize*(i+1)), (((char*) origVal)+10+onedatasize+ onebuffersize*i),onedatasize);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user