Added adc command for chiptestboard

This commit is contained in:
2016-09-05 10:49:47 +02:00
parent f8b62bba64
commit 988426dc96
7 changed files with 194 additions and 77 deletions

View File

@ -3955,9 +3955,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
if (index!=MEASUREMENTS_NUMBER) {
#ifdef VERBOSE
//#ifdef VERBOSE
std::cout<< "Setting timer "<< index << " to " << t << "ns/value" << std::endl;
#endif
//#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
@ -3984,29 +3984,29 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
} else {
//std::cout<< "offline " << std::endl;
if (t>=0)
thisDetector->timerValue[index]=t;
thisDetector->timerValue[index]=t;
if((thisDetector->myDetectorType==GOTTHARD)||
(thisDetector->myDetectorType==PROPIX)||
(thisDetector->myDetectorType==JUNGFRAU)||
(thisDetector->myDetectorType==MOENCH))
thisDetector->timerValue[PROBES_NUMBER]=0;
(thisDetector->myDetectorType==PROPIX)||
(thisDetector->myDetectorType==JUNGFRAU)||
(thisDetector->myDetectorType==MOENCH))
thisDetector->timerValue[PROBES_NUMBER]=0;
}
} else {
if (t>=0)
thisDetector->timerValue[index]=t;
if (t>=0)
thisDetector->timerValue[index]=t;
}
#ifdef VERBOSE
std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl;
#endif
if ((thisDetector->myDetectorType==MYTHEN)&&(index==PROBES_NUMBER)) {
setDynamicRange();
//cout << "Changing probes: data size = " << thisDetector->dataBytes <<endl;
setDynamicRange();
//cout << "Changing probes: data size = " << thisDetector->dataBytes <<endl;
}
/* set progress */
if ((index==FRAME_NUMBER) || (index==CYCLES_NUMBER)) {
setTotalProgress();
setTotalProgress();
}
double r;
@ -4016,51 +4016,51 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
//send acquisiton period/frame number to receiver
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)){
if(ret != FAIL){
retval = thisDetector->timerValue[index];
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
int64_t args[2];
args[1] = retval;
if((t == -1) && (ret!= FORCE_UPDATE)) args[1] = -1;
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){
if(ret != FAIL){
retval = thisDetector->timerValue[index];
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
int64_t args[2];
args[1] = retval;
if((t == -1) && (ret!= FORCE_UPDATE)) args[1] = -1;
if((index==FRAME_NUMBER)||(index==CYCLES_NUMBER)){
#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
args[0] = FRAME_NUMBER;
retval = abs(thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER]);
if(args[1] != -1) args[1]=retval;
}else{
args[0] = FRAME_NUMBER;
retval = abs(thisDetector->timerValue[FRAME_NUMBER]*thisDetector->timerValue[CYCLES_NUMBER]);
if(args[1] != -1) args[1]=retval;
}else{
#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
args[0] = FRAME_PERIOD;
//if acquisition period is zero, then #frames/buffer depends on exposure time and not acq period
if(!retval) args[1] = timerValue[ACQUISITION_TIME];
}
args[0] = FRAME_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 (connectData() == OK)
ret=thisReceiver->sendIntArray(fnum2,ut,args);
disconnectData();
if((ut != retval)|| (ret==FAIL)){
ret = FAIL;
if(index==FRAME_PERIOD){
//exptime sent if acq period = 0
if(retval){
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << ut << " instead of " << thisDetector->timerValue[index] << endl;
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
}
}else{
cout << "ERROR:Number of Frames (* Number of cycles) in receiver set incorrectly to " << ut << " instead of " << thisDetector->timerValue[index] << endl;
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
}
}
if(ret==FORCE_UPDATE)
updateReceiver();
}
if (connectData() == OK)
ret=thisReceiver->sendIntArray(fnum2,ut,args);
disconnectData();
if((ut != retval)|| (ret==FAIL)){
ret = FAIL;
if(index==FRAME_PERIOD){
//exptime sent if acq period = 0
if(retval){
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << ut << " instead of " << thisDetector->timerValue[index] << endl;
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
}
}else{
cout << "ERROR:Number of Frames (* Number of cycles) in receiver set incorrectly to " << ut << " instead of " << thisDetector->timerValue[index] << endl;
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
}
}
if(ret==FORCE_UPDATE)
updateReceiver();
}
}
}
return thisDetector->timerValue[index];
};