mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_detector_software into zmqdata
This commit is contained in:
@ -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];
|
||||
};
|
||||
|
@ -791,6 +791,11 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="adc"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
|
||||
i++;
|
||||
|
||||
|
||||
/* r/w timers */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="timing"; //
|
||||
@ -3859,6 +3864,7 @@ string slsDetectorCommand::helpDAC(int narg, char *args[], int action) {
|
||||
string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
||||
|
||||
dacIndex adc;
|
||||
int idac;
|
||||
// double val=-1;
|
||||
char answer[1000];
|
||||
|
||||
@ -3866,8 +3872,11 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
||||
return helpADC(narg, args, action);
|
||||
else if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
|
||||
if (cmd=="temp_adc")
|
||||
|
||||
if (sscanf(args[0],"adc:%d",&idac)==1) {
|
||||
printf("chiptestboard!\n");
|
||||
adc=(dacIndex)(idac+1000);
|
||||
} else if (cmd=="temp_adc")
|
||||
adc=TEMPERATURE_ADC;
|
||||
else if (cmd=="temp_fpga")
|
||||
adc=TEMPERATURE_FPGA;
|
||||
@ -3893,7 +3902,11 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
||||
sprintf(answer,"%f",myDet->getADC(adc));
|
||||
#endif
|
||||
//if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
|
||||
strcat(answer,"°C");
|
||||
if (adc<1000)
|
||||
strcat(answer,"°C");
|
||||
else
|
||||
strcat(answer,"mV");
|
||||
|
||||
return string(answer);
|
||||
|
||||
}
|
||||
@ -4001,12 +4014,13 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
rval=(double)ret*1E-9;
|
||||
else rval=ret;
|
||||
|
||||
// cout << "here!"<< endl;
|
||||
//set frame index
|
||||
if (index==FRAME_NUMBER || index==CYCLES_NUMBER ){
|
||||
if ((myDet->setTimer(FRAME_NUMBER,-1)*myDet->setTimer(CYCLES_NUMBER,-1))>1)
|
||||
myDet->setFrameIndex(0);
|
||||
else
|
||||
myDet->setFrameIndex(-1);
|
||||
if ((myDet->setTimer(FRAME_NUMBER,-1)*myDet->setTimer(CYCLES_NUMBER,-1))>1) {
|
||||
myDet->setFrameIndex(0);
|
||||
} else
|
||||
myDet->setFrameIndex(-1);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user