This commit is contained in:
Dhanya Maliakal
2016-10-31 16:43:45 +01:00
parent 5cc17a77c7
commit 58228ed00f
2 changed files with 65 additions and 58 deletions

View File

@ -3978,7 +3978,6 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
int fnum=F_SET_TIMER,fnum2=F_SET_RECEIVER_TIMER; int fnum=F_SET_TIMER,fnum2=F_SET_RECEIVER_TIMER;
int64_t retval = -1; int64_t retval = -1;
int64_t ut = -2;
char mess[MAX_STR_LENGTH]=""; char mess[MAX_STR_LENGTH]="";
int ret=OK; int ret=OK;
int n=0; int n=0;
@ -4015,91 +4014,99 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
} else { } else {
//std::cout<< "offline " << std::endl; //std::cout<< "offline " << std::endl;
if (t>=0) if (t>=0)
thisDetector->timerValue[index]=t; thisDetector->timerValue[index]=t;
if((thisDetector->myDetectorType==GOTTHARD)|| if((thisDetector->myDetectorType==GOTTHARD)||
(thisDetector->myDetectorType==PROPIX)|| (thisDetector->myDetectorType==PROPIX)||
(thisDetector->myDetectorType==JUNGFRAU)|| (thisDetector->myDetectorType==JUNGFRAU)||
(thisDetector->myDetectorType==MOENCH)) (thisDetector->myDetectorType==MOENCH))
thisDetector->timerValue[PROBES_NUMBER]=0; thisDetector->timerValue[PROBES_NUMBER]=0;
} }
} else { } else {
if (t>=0) if (t>=0)
thisDetector->timerValue[index]=t; thisDetector->timerValue[index]=t;
} }
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl; std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl;
#endif #endif
if ((thisDetector->myDetectorType==MYTHEN)&&(index==PROBES_NUMBER)) { if ((thisDetector->myDetectorType==MYTHEN)&&(index==PROBES_NUMBER)) {
setDynamicRange(); setDynamicRange();
//cout << "Changing probes: data size = " << thisDetector->dataBytes <<endl; //cout << "Changing probes: data size = " << thisDetector->dataBytes <<endl;
} }
/* set progress */ /* set progress */
if ((index==FRAME_NUMBER) || (index==CYCLES_NUMBER)) { if ((index==FRAME_NUMBER) || (index==CYCLES_NUMBER)) {
setTotalProgress(); setTotalProgress();
} }
//if eiger, rate corr on, a put statement, dr=32 &setting subexp or dr =16 & setting exptime, set ratecorr to update table //if eiger, rate corr on, a put statement, dr=32 &setting subexp or dr =16 & setting exptime, set ratecorr to update table
double r; double r;
if( (thisDetector->myDetectorType == EIGER) && if( (thisDetector->myDetectorType == EIGER) &&
getRateCorrection(r) && getRateCorrection(r) &&
(t>=0) && (t>=0) &&
(((index == SUBFRAME_ACQUISITION_TIME) && (thisDetector->dynamicRange == 32))|| (((index == SUBFRAME_ACQUISITION_TIME) && (thisDetector->dynamicRange == 32))||
((index == ACQUISITION_TIME) && (thisDetector->dynamicRange == 16))) ((index == ACQUISITION_TIME) && (thisDetector->dynamicRange == 16)))
&& (t>=0) && getRateCorrection(r)){ && (t>=0) && getRateCorrection(r)){
setRateCorrection(r); setRateCorrection(r);
} }
//send acquisiton period/frame number to receiver //send acquisiton period/frame number to receiver
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)){ if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)){
if(ret != FAIL){ if(ret != FAIL){
retval = thisDetector->timerValue[index]; int64_t args[2];
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){ retval = -1;
int64_t args[2]; args[0] = index;
args[1] = retval; args[1] = thisDetector->timerValue[index];
if((t == -1) && (ret!= FORCE_UPDATE)) args[1] = -1;
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){ if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
//set #frames, #cycles
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){
#ifdef VERBOSE #ifdef VERBOSE
std::cout << "Setting/Getting number of frames " << index <<" to/from receiver " << args[1] << std::endl; std::cout << "Setting/Getting number of frames " << index <<" to/from receiver " << args[1] << std::endl;
#endif #endif
args[0] = FRAME_NUMBER; if(thisDetector->timerValue[CYCLES_NUMBER]==0)
retval = abs(thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER]); args[1] = thisDetector->timerValue[FRAME_NUMBER];
if(args[1] != -1) args[1]=retval; else
}else{ args[1] = thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER];
}
//set period
else{
#ifdef VERBOSE #ifdef VERBOSE
std::cout << "Setting/Getting acquisition period " << index << " to/from receiver " << args[1] << std::endl; std::cout << "Setting/Getting acquisition period " << index << " to/from receiver " << args[1] << std::endl;
#endif #endif
args[0] = FRAME_PERIOD; //if acquisition period is zero, then #frames/buffer depends on exposure time and not acq period
//if acquisition period is zero, then #frames/buffer depends on exposure time and not acq period if(!args[1])
if(!retval) args[1] = timerValue[ACQUISITION_TIME]; args[1] = timerValue[ACQUISITION_TIME];
} }
if (connectData() == OK) if (connectData() == OK)
ret=thisReceiver->sendIntArray(fnum2,ut,args); ret=thisReceiver->sendIntArray(fnum2,retval,args);
disconnectData(); disconnectData();
if((ut != retval)|| (ret==FAIL)){ if((args[1] != retval)|| (ret==FAIL)){
ret = FAIL; ret = FAIL;
if(index==FRAME_PERIOD){ if(index==FRAME_PERIOD){
//exptime sent if acq period = 0 //exptime sent if acq period = 0
if(retval){ if(retval){
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << ut << " instead of " << thisDetector->timerValue[index] << endl; cout << "ERROR:Acquisition Period in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET)); setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
} }
}else{ }else{
cout << "ERROR:Number of Frames (* Number of cycles) in receiver set incorrectly to " << ut << " instead of " << thisDetector->timerValue[index] << endl; cout << "ERROR:Number of Frames (* Number of cycles) in receiver set incorrectly to " << retval << " instead of " << args[1] << endl;
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET)); setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
}
}
if(ret==FORCE_UPDATE)
updateReceiver();
}
} }
}
if(ret==FORCE_UPDATE)
updateReceiver();
}
}
} }
return thisDetector->timerValue[index]; return thisDetector->timerValue[index];
}; };