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;
@ -4053,45 +4052,53 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
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];
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
int64_t args[2]; int64_t args[2];
args[1] = retval; retval = -1;
if((t == -1) && (ret!= FORCE_UPDATE)) args[1] = -1; args[0] = index;
args[1] = thisDetector->timerValue[index];
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
//set #frames, #cycles
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){ 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(!retval) args[1] = timerValue[ACQUISITION_TIME]; if(!args[1])
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));
} }
} }