moench gui stuff

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@539 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_msdetect
2013-05-06 13:08:24 +00:00
parent 88f3fe3b26
commit ebba783dac

View File

@ -1014,43 +1014,53 @@ int slsReceiverFuncs::moench_read_frame(){
offset = 4; offset = 4;
while (iPacket < numPackets){ while (iPacket < numPackets){printf("iPacketr:%d\n",iPacket);
//read packet index //read packet index
packetIndex = (*((int*)((char*)(origVal+packetOffset)))) & MOENCH_PACKET_INDEX_MASK;cout<<"packet index:"<<packetIndex<<endl; cout << endl;
cout <<"buffer:"<<hex<<(*((int*)(((char*)origVal)+packetOffset)))<<endl;
packetIndex = (*((int*)(((char*)origVal)+packetOffset))) & MOENCH_PACKET_INDEX_MASK;
packetIndex--;
if(packetIndex ==-1) packetIndex = 39;
cout<<"packet index:"<<hex<<packetIndex<<endl<<dec;
cout << "buffer size: " << bufferSize << " packetOffset: " << packetOffset << endl;
//if its valid //if its valid
if ((packetIndex < 40) || (packetIndex >= 0)){ if ((packetIndex < 40) && (packetIndex >= 0)){
// if(packetIndex == 1){
x = packetIndex / 10; x = packetIndex / 10;
y = packetIndex % 10;cout<<"x:"<<x<<"\t y:"<<y<<endl; y = packetIndex % 10;cout<<"x:"<<x<<"\t y:"<<y<<endl;
//copy 16 times 80 bytes //copy 16 times 80 bytes
for (i = 0; i < partsPerFrame; i++) { for (i = 0; i < partsPerFrame; i++) {
memcpy((((char*)retval) + memcpy((((char*)retval) +
y * MOENCH_BYTES_IN_ONE_DIMENSION + y * 16 * MOENCH_BYTES_IN_ONE_DIMENSION +
x * MOENCH_BYTES_PER_ADC), i * MOENCH_BYTES_IN_ONE_DIMENSION +
(((char*) origVal) + x * MOENCH_BYTES_PER_ADC),
offset + // &i,4);
iPacket * onePacketSize + (((char*) origVal) +
i * MOENCH_BYTES_PER_ADC) , offset +
MOENCH_BYTES_PER_ADC); iPacket * onePacketSize +
y++; i * MOENCH_BYTES_PER_ADC) ,
} MOENCH_BYTES_PER_ADC);
//y++;
}
}else }else
cout << "cannot decode packet index:" << packetIndex << endl; cout << "cannot decode packet index:" << packetIndex << endl;
//increment //increment
offset+=6; offset=6;
iPacket++; iPacket++;
packetOffset = packetOffset + offset + onePacketSize; packetOffset = packetOffset + offset + onePacketSize;
cout <<" checking next frame number:"<<(((*((int*)((char*)(origVal+packetOffset)))) & (MOENCH_FRAME_INDEX_MASK)) >> MOENCH_FRAME_INDEX_OFFSET)<<endl; // cout <<" checking next frame number:"<<hex<<(((*((int*)((char*)(origVal+packetOffset)))) & (MOENCH_FRAME_INDEX_MASK)) >> MOENCH_FRAME_INDEX_OFFSET)<<endl;
//check if same frame number //check if same frame number
while ((((*((int*)((char*)(origVal+packetOffset)))) & (MOENCH_FRAME_INDEX_MASK)) >> MOENCH_FRAME_INDEX_OFFSET) != thisFrameNumber){cout<<"did not match"<<endl; /* while ((((*((int*)((char*)(origVal+packetOffset)))) & (MOENCH_FRAME_INDEX_MASK)) >> MOENCH_FRAME_INDEX_OFFSET) != thisFrameNumber){cout<<"did not match"<<endl;
if(iPacket >= numPackets) if(iPacket >= numPackets)
break; break;
//increment //increment
offset+=6; offset+=6;
iPacket++; iPacket++;
packetOffset = packetOffset + offset + onePacketSize; packetOffset = packetOffset + offset + onePacketSize;
} }*/
cout<<"found or exited"<<endl; cout<<"found or exited"<<endl;
} }
cout<<"exited loop"<<endl; cout<<"exited loop"<<endl;