the memcpy wasnt incremementing in receiver.

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@519 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-04-18 13:38:21 +00:00
parent 0efaaa5520
commit 5ab6d9076d
3 changed files with 29 additions and 6 deletions

View File

@ -11,13 +11,12 @@
#define FIFO_SIZE 25000
#define GOTTHARD_ALIGNED_FRAME_SIZE 4096
#define GOTTHARD_ALIGNED_FRAME_SIZE 4096
#define GOTTHARD_PACKETS_PER_FRAME 2
#define GOTTHARD_BUFFER_SIZE 1286*GOTTHARD_PACKETS_PER_FRAME
#define GOTTHARD_DATA_BYTES 1280*GOTTHARD_PACKETS_PER_FRAME
#define GOTTHARD_SHORT_PACKETS_PER_FRAME 1
#define GOTTHARD_SHORT_BUFFER_SIZE 518
#define GOTTHARD_SHORT_DATABYTES 512
@ -25,12 +24,15 @@
#define MOENCH_ALIGNED_FRAME_SIZE 65536
#define MOENCH_PACKETS_PER_FRAME 40
#define MOENCH_BUFFER_SIZE 1286*MOENCH_PACKETS_PER_FRAME
#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

View File

@ -344,6 +344,8 @@ 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){
@ -507,7 +509,7 @@ int slsReceiverFunctionList::startWriting(){
//default writing to file
else {
if(sfilefd)
memcpy(address,wbuf, bufferSize);
memcpy((((char*)address)+bufferSize*framesInFile),wbuf, bufferSize);
else{
cout << "You do not have permissions to overwrite: " << savefilename << endl;
usleep(50000);

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;
int arg = -1,i,j,y;
int bufferSize = MOENCH_BUFFER_SIZE;
@ -894,6 +894,7 @@ int slsReceiverFuncs::moench_read_frame(){
int index=-1;//,index2=-1;
int startIndex=-1;
int count=0;
int offset=0;
strcpy(mess,"Could not read frame\n");
@ -921,10 +922,28 @@ int slsReceiverFuncs::moench_read_frame(){
index = startIndex;
cout << "didnt get data. Gui will try again" << endl;
/*
//copy data 80 bytes, then in y direction
offset = 4;y=0;
for(i=0;i<MOENCH_PACKETS_PER_FRAME;i++){
for(j=0;j<onedatasize/MOENCH_BYTES_PER_ADC;j++){
memcpy((((char*)retval) + y*MOENCH_BYTES_PER_X_DIMENSION + j*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++;
}
}
*/
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);
}
}else{
//upto 40 indices, look at just index1 and index2 for now
index=(int)(*(int*)raw);