mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-02 05:34:56 +01:00
Merging with anna's jungfrau detector server version
This commit is contained in:
@@ -1078,62 +1078,54 @@ int set_dac(int file_des) {
|
||||
if (differentClients==1 && lockStatus==1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else{
|
||||
} else{
|
||||
if (ind<16) {
|
||||
|
||||
if (ind<16) {
|
||||
if (mV) {
|
||||
if (val>2500)
|
||||
val=-1;
|
||||
printf("%d mV is ",val);
|
||||
if (val>0)
|
||||
val=4095*val/2500;
|
||||
printf("%d DACu\n", val);
|
||||
} else if (val>4095)
|
||||
val=-1;
|
||||
|
||||
|
||||
retval=setDac(ind,val);
|
||||
/* if(idac==HIGH_VOLTAGE) */
|
||||
/* retval=initHighVoltageByModule(val,imod); */
|
||||
/* else */
|
||||
/* retval=initDACbyIndexDACU(idac,val,imod); */
|
||||
}
|
||||
else if (ind==ADC_VPP) {
|
||||
printf("Setting ADC VPP to %d\n",val);
|
||||
if (val>4 || val<0)
|
||||
printf("Cannot set ADC VPP to %d\n",val);
|
||||
else {
|
||||
writeADC(0x18,val);
|
||||
adcvpp=val;
|
||||
}
|
||||
retval=adcvpp;;
|
||||
|
||||
if (mV) {
|
||||
if (val>2500)
|
||||
val=-1;
|
||||
printf("%d mV is ",val);
|
||||
if (val>0)
|
||||
val=4095*val/2500;
|
||||
printf("%d DACu\n", val);
|
||||
} else if (val>4095)
|
||||
val=-1;
|
||||
|
||||
|
||||
retval=setDac(ind,val);
|
||||
/* if(idac==HIGH_VOLTAGE) */
|
||||
/* retval=initHighVoltageByModule(val,imod); */
|
||||
/* else */
|
||||
/* retval=initDACbyIndexDACU(idac,val,imod); */
|
||||
}
|
||||
else if (ind==ADC_VPP) {
|
||||
printf("Setting ADC VPP to %d\n",val);
|
||||
if (val>4 || val<0)
|
||||
printf("Cannot set ADC VPP to %d\n",val);
|
||||
else {
|
||||
writeADC(0x18,val);
|
||||
adcvpp=val;
|
||||
}
|
||||
retval=adcvpp;;
|
||||
|
||||
}
|
||||
} else if (ind==HV_NEW )
|
||||
retval=initHighVoltageByModule(val,imod);
|
||||
else
|
||||
printf("**********No dac with index %d\n",ind);
|
||||
}
|
||||
}
|
||||
if(ret==OK){
|
||||
/* ret=FAIL; */
|
||||
/* if(idac==HIGH_VOLTAGE){ */
|
||||
/* if(retval==-2) */
|
||||
/* strcpy(mess,"Invalid Voltage.Valid values are 0,90,110,120,150,180,200"); */
|
||||
/* else if(retval==-3) */
|
||||
/* strcpy(mess,"Weird value read back or it has not been set yet\n"); */
|
||||
/* else */
|
||||
/* ret=OK; */
|
||||
/* }//since v r saving only msb */
|
||||
/* else if ((retval-val)<=3 || val==-1) */
|
||||
/* ret=OK; */
|
||||
if (ind<16) {
|
||||
if (mV) {
|
||||
if (ind<16) {
|
||||
if (mV) {
|
||||
|
||||
printf("%d DACu is ",retval);
|
||||
retval1=2500*retval/16535;
|
||||
printf("%d mV \n",retval1);
|
||||
} else
|
||||
retval1=retval;
|
||||
} else
|
||||
retval1=retval;
|
||||
|
||||
printf("%d DACu is ",retval);
|
||||
retval1=2500*retval/16535;
|
||||
printf("%d mV \n",retval1);
|
||||
} else
|
||||
retval1=retval;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE
|
||||
@@ -2000,10 +1992,13 @@ int get_run_status(int file_des) {
|
||||
// else if(!(retval&RUNMACHINE_BUSY_BIT)){ //commented by Anna 24.10.2012
|
||||
else if(!(retval&RUN_BUSY_BIT)){ // by Anna 24.10.2012
|
||||
|
||||
if((retval&STOPPED_BIT) ){ //
|
||||
|
||||
|
||||
//and readbusy=1, its last frame read
|
||||
if((retval&READMACHINE_BUSY_BIT) ){ //
|
||||
printf("-----------------------------------STOPPED--------------------------\n");
|
||||
s=STOPPED;
|
||||
} else if((retval&READMACHINE_BUSY_BIT) ){ // ///and readbusy=1, its last frame read
|
||||
|
||||
|
||||
|
||||
printf("-----------------------------------READ MACHINE BUSY--------------------------\n");
|
||||
@@ -2034,7 +2029,7 @@ int get_run_status(int file_des) {
|
||||
printf("-----------------------------------RUNNING-----------------------------------\n");
|
||||
s=RUNNING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user