mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
eiger: trimbits changed such that it works for multi modules, ;general: loading multislsdetectr list with y dir first, updating the readframefromreceiver to load all the data interswapped for 16 bit; nthframe works better
This commit is contained in:
@ -1027,7 +1027,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
|
|||||||
for(i=0;i<8;i++){ // column loop i
|
for(i=0;i<8;i++){ // column loop i
|
||||||
//printf("i:%d\t\t",i);
|
//printf("i:%d\t\t",i);
|
||||||
|
|
||||||
if(Module_TopAddressIsValid(&modules[0])){
|
if(Module_TopAddressIsValid(&modules[1])){
|
||||||
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_l+i])<<((7-i)*4);//low
|
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_l+i])<<((7-i)*4);//low
|
||||||
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[row_set*16480+super_column_start_position_l+i])>>3)<<((7-i)*4);//upper
|
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[row_set*16480+super_column_start_position_l+i])>>3)<<((7-i)*4);//upper
|
||||||
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_r+i])<<((7-i)*4);//low
|
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[row_set*16480+super_column_start_position_r+i])<<((7-i)*4);//low
|
||||||
@ -1043,7 +1043,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
|
|||||||
} //end supercolumn loop sc
|
} //end supercolumn loop sc
|
||||||
} //end row loop
|
} //end row loop
|
||||||
|
|
||||||
if(Module_TopAddressIsValid(&modules[0])){
|
if(Module_TopAddressIsValid(&modules[1])){
|
||||||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
|
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
|
||||||
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_l)||
|
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_l)||
|
||||||
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
|
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CC = powerpc-4xx-softfloat-gcc
|
CC = powerpc-4xx-softfloat-gcc
|
||||||
CCX = powerpc-4xx-softfloat-g++
|
CCX = powerpc-4xx-softfloat-g++
|
||||||
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE
|
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT #-DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE
|
||||||
LDLIBS += -lm -lstdc++
|
LDLIBS += -lm -lstdc++
|
||||||
|
|
||||||
PROGS = eigerDetectorServer
|
PROGS = eigerDetectorServer
|
||||||
|
Binary file not shown.
@ -143,10 +143,10 @@ int initDetector(){
|
|||||||
Feb_Control_CheckSetup();
|
Feb_Control_CheckSetup();
|
||||||
|
|
||||||
//top or bottom
|
//top or bottom
|
||||||
bottom = Feb_Control_IsBottomModule();
|
//bottom = Feb_Control_IsBottomModule();
|
||||||
// if(getDetectorNumber()==0xbeb016)
|
if(getDetectorNumber()==0xbeb031)
|
||||||
// bottom = 0;
|
bottom = 0;
|
||||||
//else bottom = 1;
|
else bottom = 1;
|
||||||
|
|
||||||
if(bottom)
|
if(bottom)
|
||||||
printf("BOTTOM ***************\n");
|
printf("BOTTOM ***************\n");
|
||||||
|
@ -376,32 +376,33 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
|
|
||||||
for (int i=1; i<thisMultiDetector->numberOfDetectors; i++) {
|
for (int i=1; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
//incrementing in x direction
|
//incrementing in y direction
|
||||||
if ((maxChanX == -1) || ((maxChanX > 0) && ((offsetX + numX) < maxChanX))){
|
if ((maxChanY == -1) || ((maxChanY > 0) && ((offsetY + numY) < maxChanY))){
|
||||||
offsetX += detectors[i]->getMaxNumberOfChannels(X);
|
offsetY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
numX += detectors[i]->getTotalNumberOfChannels(X);
|
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
||||||
}
|
}
|
||||||
//incrementing in y direction
|
//incrementing in y direction
|
||||||
else{
|
else{
|
||||||
offsetX = 0;
|
offsetY = 0;
|
||||||
numX = 0;
|
numY = 0;
|
||||||
maxX = 0;
|
maxY = 0;
|
||||||
thisMultiDetector->maxNumberOfChannel[X] = 0;
|
thisMultiDetector->maxNumberOfChannel[Y] = 0;
|
||||||
offsetY += detectors[i]->getMaxNumberOfChannels(Y);
|
if ((maxChanX == -1) || ((maxChanX > 0) && (offsetX <= maxChanX))){
|
||||||
if ((maxChanY == -1) || ((maxChanY > 0) && (offsetY <= maxChanY))){
|
offsetX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
numX += detectors[i]->getTotalNumberOfChannels(X);
|
||||||
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
}else{
|
}else{
|
||||||
cout<<"Detector at position " << i << "exceeds maximum channels allowed for complete detector set in y dimension also!" << endl;
|
offsetX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
numX += detectors[i]->getTotalNumberOfChannels(X);
|
||||||
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
|
cout<<"Detector at position " << i << "exceeds maximum channels allowed for complete detector set in X dimension also!" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thisMultiDetector->offsetX[i] = offsetX;
|
thisMultiDetector->offsetX[i] = offsetX;
|
||||||
thisMultiDetector->offsetY[i] = offsetY;
|
thisMultiDetector->offsetY[i] = offsetY;
|
||||||
cout << "Detector at position: " << i << " x offset:" << thisMultiDetector->offsetX[i] << " y offset:" << thisMultiDetector->offsetY[i] << endl;
|
cout << "Detector at position" << i << ": x offset:" << thisMultiDetector->offsetX[i] << " y offset:" << thisMultiDetector->offsetY[i] << endl;
|
||||||
if(numX > thisMultiDetector->numberOfChannel[X])
|
if(numX > thisMultiDetector->numberOfChannel[X])
|
||||||
thisMultiDetector->numberOfChannel[X] = numX;
|
thisMultiDetector->numberOfChannel[X] = numX;
|
||||||
if(numY > thisMultiDetector->numberOfChannel[Y])
|
if(numY > thisMultiDetector->numberOfChannel[Y])
|
||||||
@ -4539,11 +4540,17 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &fIndex){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
|
int i,k,offsetX, offsetY, maxX, maxY;;
|
||||||
int* retval=new int[nel];
|
int* retval=new int[nel];
|
||||||
int *retdet, *p=retval;
|
int *retdet, *p=retval;
|
||||||
string fullFName="";
|
string fullFName="";
|
||||||
string ext="";
|
string ext="";
|
||||||
|
|
||||||
|
if(getDetectorsType() == EIGER){
|
||||||
|
maxX = thisMultiDetector->numberOfChannel[X];
|
||||||
|
maxY = thisMultiDetector->numberOfChannel[Y];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
|
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
|
||||||
if (detectors[id]) {
|
if (detectors[id]) {
|
||||||
@ -4552,9 +4559,20 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &fIndex){
|
|||||||
setErrorMask(getErrorMask()|(1<<id));
|
setErrorMask(getErrorMask()|(1<<id));
|
||||||
if (retdet) {
|
if (retdet) {
|
||||||
n=detectors[id]->getDataBytes();
|
n=detectors[id]->getDataBytes();
|
||||||
memcpy(p,retdet,n);
|
|
||||||
|
if(getDetectorsType() == EIGER){
|
||||||
|
k=detectors[id]->getMaxNumberOfChannels(X)*2;/**bit mode*/
|
||||||
|
offsetY = ((maxY - (thisMultiDetector->offsetY[id] + detectors[id]->getMaxNumberOfChannels(Y))) * maxX)*2;/**bit mode*/
|
||||||
|
offsetX = thisMultiDetector->offsetX[id]*2;
|
||||||
|
for(i=0; i< 256;i++){
|
||||||
|
memcpy((((char*)p) + offsetY + offsetX + (i*maxX*2)/**bit mode*/) ,(((char*)retdet) + (i*k)),k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
memcpy(p,retdet,n);
|
||||||
|
p+=n/sizeof(int);
|
||||||
|
}
|
||||||
delete [] retdet;
|
delete [] retdet;
|
||||||
p+=n/sizeof(int);
|
|
||||||
//concatenate filenames
|
//concatenate filenames
|
||||||
if(!fullFName.length()){
|
if(!fullFName.length()){
|
||||||
fullFName.assign(fileIO::getFileName());
|
fullFName.assign(fileIO::getFileName());
|
||||||
|
@ -472,7 +472,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
|
|
||||||
//if nth frame
|
//if nth frame
|
||||||
if(nthframe){
|
if(nthframe){
|
||||||
newData = true;
|
/*newData = true;//unnecessary to read every data, 09.12.2014**/
|
||||||
//and no gui
|
//and no gui
|
||||||
if(!dataReady){
|
if(!dataReady){
|
||||||
std::cout << "Error: receiver read freq is set to " << nthframe << " but should be > 0 only when using gui." << std::endl;
|
std::cout << "Error: receiver read freq is set to " << nthframe << " but should be > 0 only when using gui." << std::endl;
|
||||||
@ -543,7 +543,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
delete thisData;
|
delete thisData;
|
||||||
fdata = NULL;
|
fdata = NULL;
|
||||||
progress = currentfIndex;
|
progress = currentfIndex;
|
||||||
if(!nthframe)
|
/*if(!nthframe) //unnecessary to read every data, 09.12.2014**/
|
||||||
newData = false;
|
newData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user