10Gbe, some functions in gotthard and eiger servers including mv in dacs, mv in dacs, changing settings file

This commit is contained in:
Maliakal Dhanya
2014-07-11 13:06:48 +02:00
parent 018b800117
commit 828a2dbd17
21 changed files with 867 additions and 863 deletions

View File

@ -891,13 +891,15 @@ int read_register(int file_des) {
int set_dac(int file_des) {
//default:all mods
int retval;
int retval[2];retval[1]=-1;
int temp;
int ret=OK;
int arg[2];
int arg[3];
enum dacIndex ind;
int imod;
int n;
int val;
int mV;
int idac=0;
sprintf(mess,"Can't set DAC\n");
@ -909,6 +911,7 @@ int set_dac(int file_des) {
}
ind=arg[0];
imod=arg[1];
mV=arg[2];
n = receiveDataOnly(file_des,&val,sizeof(val));
if (n < 0) {
@ -967,33 +970,37 @@ int set_dac(int file_des) {
ret=FAIL;
sprintf(mess,"Detector locked by %s\n",lastClientIP);
} else{
if(idac==HIGH_VOLTAGE)
retval=initHighVoltageByModule(val,imod);
else
retval=initDACbyIndexDACU(idac,val,imod);
if(idac==HIGH_VOLTAGE){
retval[0]=initHighVoltageByModule(val,imod);
ret=FAIL;
if(retval[0]==-2)
strcpy(mess,"Invalid Voltage.Valid values are 0,90,110,120,150,180,200");
else if(retval[0]==-3)
strcpy(mess,"Weird value read back or it has not been set yet\n");
else
ret=OK;
}else{
initDACbyIndexDACU(idac,val,imod,mV,retval);
ret=FAIL;
if(mV)
temp = retval[1];
else
temp = retval[0];
if ((abs(temp-val)<=3) || val==-1) {
ret=OK;
#ifdef VERBOSE
printf("DAC set to %d in dac units and %d mV\n", retval[0],retval[1]);
#endif
}
}
}
}
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;
}
#endif
#ifdef VERBOSE
printf("DAC set to %d V\n", retval);
#endif
if(ret==FAIL)
printf("Setting dac %d of module %d: wrote %d but read %d\n", ind, imod, val, retval);
printf("Setting dac %d of module %d: wrote %d but read %d\n", ind, imod, val, temp);
else{
if (differentClients)
ret=FORCE_UPDATE;