added more accurate temperature sensors for eiger, and to gui

This commit is contained in:
Dhanya Maliakal 2016-07-22 10:40:58 +02:00
parent 6a245d2a98
commit ee26339fd7
8 changed files with 106 additions and 19 deletions

View File

@ -351,7 +351,12 @@ enum dacIndex {
E_Vis, /**< eiger */ E_Vis, /**< eiger */
IO_DELAY, /**< eiger io delay */ IO_DELAY, /**< eiger io delay */
ADC_VPP, /**< adc vpp for jctb */ ADC_VPP, /**< adc vpp for jctb */
HV_NEW /**< new hv index for jungfrau & c */ HV_NEW, /**< new hv index for jungfrau & c */
TEMPERATURE_FPGAEXT, /**< temperature sensor (close to fpga) */
TEMPERATURE_10GE, /**< temperature sensor (close to 10GE) */
TEMPERATURE_DCDC, /**< temperature sensor (close to DCDC) */
TEMPERATURE_SODL, /**< temperature sensor (close to SODL) */
TEMPERATURE_SODR /**< temperature sensor (close to SODR) */
}; };
/** /**

View File

@ -437,9 +437,33 @@ int setHighVoltage(int val, int imod){
} }
int getADC(enum detDacIndex ind, int imod){ int getADC(enum detAdcIndex ind, int imod){
//get adc value int retval = -1;
return 0; char tempnames[6][20]={"FPGA EXT", "10GE","DCDC", "SODL", "SODR", "FPGA"};
char cstore[255];
switch(ind){
case TEMP_FPGA:
retval=getBebFPGATemp()*1000;
break;
case TEMP_FPGAEXT:
case TEMP_10GE:
case TEMP_DCDC:
case TEMP_SODL:
case TEMP_SODR:
sprintf(cstore,"more /sys/class/hwmon/hwmon%d/device/temp1_input",ind);
FILE* sysFile = popen(cstore, "r");
fgets(cstore, sizeof(cstore), sysFile);
pclose(sysFile);
sscanf(cstore,"%d",&retval);
break;
default:
return -1;
}
printf("Temperature %s: %f°C\n",tempnames[ind],(double)retval/1000.00);
return retval;
} }

View File

@ -40,5 +40,7 @@
enum detDacIndex{SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RXB_RB,RXB_LB,VCMP_RR,VCP,VCN,VIS,VTHRESHOLD}; enum detDacIndex{SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RXB_RB,RXB_LB,VCMP_RR,VCP,VCN,VIS,VTHRESHOLD};
enum detAdcIndex{TEMP_FPGAEXT, TEMP_10GE, TEMP_DCDC, TEMP_SODL, TEMP_SODR, TEMP_FPGA};
#endif /* SLSDETECTORSERVER_DEFS_H_ */ #endif /* SLSDETECTORSERVER_DEFS_H_ */

View File

@ -2325,6 +2325,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
if (ret==FAIL) { if (ret==FAIL) {
std::cout<< "Get ADC failed " << std::endl; std::cout<< "Get ADC failed " << std::endl;
} }
return retval; return retval;

View File

@ -727,6 +727,26 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
i++; i++;
descrToFuncMap[i].m_pFuncName="temp_fpgaext"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
i++;
descrToFuncMap[i].m_pFuncName="temp_10ge"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
i++;
descrToFuncMap[i].m_pFuncName="temp_dcdc"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
i++;
descrToFuncMap[i].m_pFuncName="temp_sodl"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
i++;
descrToFuncMap[i].m_pFuncName="temp_sodr"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
i++;
/* r/w timers */ /* r/w timers */
descrToFuncMap[i].m_pFuncName="timing"; // descrToFuncMap[i].m_pFuncName="timing"; //
@ -3753,17 +3773,29 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
adc=TEMPERATURE_ADC; adc=TEMPERATURE_ADC;
else if (cmd=="temp_fpga") else if (cmd=="temp_fpga")
adc=TEMPERATURE_FPGA; adc=TEMPERATURE_FPGA;
else if (cmd=="temp_fpgaext")
adc=TEMPERATURE_FPGAEXT;
else if (cmd=="temp_10ge")
adc=TEMPERATURE_10GE;
else if (cmd=="temp_dcdc")
adc=TEMPERATURE_DCDC;
else if (cmd=="temp_sodl")
adc=TEMPERATURE_SODL;
else if (cmd=="temp_sodr")
adc=TEMPERATURE_SODR;
else else
return string("cannot decode adc ")+cmd; return string("cannot decode adc ")+cmd;
myDet->setOnline(ONLINE_FLAG); myDet->setOnline(ONLINE_FLAG);
#ifdef DACS_INT #ifdef DACS_INT
sprintf(answer,"%d",myDet->getADC(adc)); if (myDet->getDetectorsType() == EIGER)
sprintf(answer,"%.2f",(double)myDet->getADC(adc)/1000.00);
else sprintf(answer,"%d",myDet->getADC(adc));
#else #else
sprintf(answer,"%f",myDet->getADC(adc)); sprintf(answer,"%f",myDet->getADC(adc));
#endif #endif
if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA)) //if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
strcat(answer,"°C"); strcat(answer,"°C");
return string(answer); return string(answer);
} }
@ -3774,10 +3806,20 @@ string slsDetectorCommand::helpADC(int narg, char *args[], int action) {
if (action==PUT_ACTION || action==HELP_ACTION) { if (action==PUT_ACTION || action==HELP_ACTION) {
os << "temp_adc " << "Cannot be set" << std::endl; os << "temp_adc " << "Cannot be set" << std::endl;
os << "temp_fpga " << "Cannot be set" << std::endl; os << "temp_fpga " << "Cannot be set" << std::endl;
os << "temp_fpgaext " << "Cannot be set" << std::endl;
os << "temp_10ge " << "Cannot be set" << std::endl;
os << "temp_dcdc " << "Cannot be set" << std::endl;
os << "temp_sodl " << "Cannot be set" << std::endl;
os << "temp_sodr " << "Cannot be set" << std::endl;
} }
if (action==GET_ACTION || action==HELP_ACTION) { if (action==GET_ACTION || action==HELP_ACTION) {
os << "temp_adc " << "\t gets the temperature of the adc" << std::endl; os << "temp_adc " << "\t gets the temperature of the adc" << std::endl;
os << "temp_fpga " << "\t gets the temperature of the fpga" << std::endl; os << "temp_fpga " << "\t gets the temperature of the fpga" << std::endl;
os << "temp_fpgaext " << "\t gets the temperature close to the fpga" << std::endl;
os << "temp_10ge " << "\t gets the temperature close to the 10GE" << std::endl;
os << "temp_dcdc " << "\t gets the temperature close to the dc dc converter" << std::endl;
os << "temp_sodl " << "\t gets the temperature close to the left so-dimm memory" << std::endl;
os << "temp_sodr " << "\t gets the temperature close to the right so-dimm memory" << std::endl;
} }
return os.str(); return os.str();
} }

View File

@ -37,7 +37,7 @@ int detectorTest( enum digitalTestMode arg);
void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]); void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]);
int getADC(enum detDacIndex ind, int imod); int getADC(enum detAdcIndex ind, int imod);
#if defined(EIGERD) || defined(GOTTHARD) #if defined(EIGERD) || defined(GOTTHARD)

View File

@ -1280,7 +1280,7 @@ int get_adc(int file_des) {
enum dacIndex ind; enum dacIndex ind;
int imod; int imod;
int n; int n;
enum detDacIndex idac=0; enum detAdcIndex iadc=0;
sprintf(mess,"Can't read ADC\n"); sprintf(mess,"Can't read ADC\n");
@ -1299,16 +1299,29 @@ int get_adc(int file_des) {
sprintf(mess,"Module number %d out of range\n",imod); sprintf(mess,"Module number %d out of range\n",imod);
} }
#endif #endif
switch (ind) { switch (ind) {
#ifdef EIGERD #ifdef EIGERD
case TEMPERATURE_FPGA: //dac = TEMP_FPGA; case TEMPERATURE_FPGA:
retval=getBebFPGATemp(); iadc = TEMP_FPGA;
printf("Temperature: %d°C\n",retval); break;
case TEMPERATURE_FPGAEXT:
iadc = TEMP_FPGAEXT;
break;
case TEMPERATURE_10GE:
iadc = TEMP_10GE;
break;
case TEMPERATURE_DCDC:
iadc = TEMP_DCDC;
break;
case TEMPERATURE_SODL:
iadc = TEMP_SODL;
break;
case TEMPERATURE_SODR:
iadc = TEMP_SODR;
break; break;
#endif #endif
#ifdef GOTTHARDD #ifdef GOTTHARDD
case TEMPERATURE_FPGA: //dac = TEMP_FPGA; case TEMPERATURE_FPGA:
break; break;
case TEMPERATURE_ADC: case TEMPERATURE_ADC:
break; break;
@ -1316,23 +1329,23 @@ int get_adc(int file_des) {
default: default:
printf("Unknown DAC index %d\n",ind); printf("Unknown DAC index %d\n",ind);
ret=FAIL; ret=FAIL;
sprintf(mess,"Unknown ADC index %d\n",ind); sprintf(mess,"Unknown ADC index %d. Not implemented for this detector\n",ind);
break; break;
} }
#ifdef SLS_DETECTOR_FUNCTION_LIST #ifdef SLS_DETECTOR_FUNCTION_LIST
if ((ret==OK) && (retval==-1)) { if (ret==OK) {
retval=getADC(idac,imod); retval=getADC(iadc,imod);
} }
#endif #endif
#ifdef VERBOSE #ifdef VERBOSE
printf("Getting ADC %d of module %d\n", idac, imod); printf("Getting ADC %d of module %d\n", iadc, imod);
#endif #endif
#ifdef VERBOSE #ifdef VERBOSE
printf("ADC is %f V\n", retval); printf("ADC is %f V\n", retval);
#endif #endif
if (ret==FAIL) { if (ret==FAIL) {
printf("Getting adc %d of module %d failed\n", idac, imod); printf("Getting adc %d of module %d failed\n", iadc, imod);
} }