mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 08:10:02 +02:00
added more accurate temperature sensors for eiger, and to gui
This commit is contained in:
parent
6a245d2a98
commit
ee26339fd7
@ -351,7 +351,12 @@ enum dacIndex {
|
||||
E_Vis, /**< eiger */
|
||||
IO_DELAY, /**< eiger io delay */
|
||||
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) */
|
||||
};
|
||||
|
||||
/**
|
||||
|
Binary file not shown.
@ -437,9 +437,33 @@ int setHighVoltage(int val, int imod){
|
||||
}
|
||||
|
||||
|
||||
int getADC(enum detDacIndex ind, int imod){
|
||||
//get adc value
|
||||
return 0;
|
||||
int getADC(enum detAdcIndex ind, int imod){
|
||||
int retval = -1;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 detAdcIndex{TEMP_FPGAEXT, TEMP_10GE, TEMP_DCDC, TEMP_SODL, TEMP_SODR, TEMP_FPGA};
|
||||
|
||||
|
||||
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
||||
|
@ -2325,6 +2325,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
|
||||
if (ret==FAIL) {
|
||||
std::cout<< "Get ADC failed " << std::endl;
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
|
||||
|
@ -727,6 +727,26 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
|
||||
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 */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="timing"; //
|
||||
@ -3753,16 +3773,28 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
||||
adc=TEMPERATURE_ADC;
|
||||
else if (cmd=="temp_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
|
||||
return string("cannot decode adc ")+cmd;
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
#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
|
||||
sprintf(answer,"%f",myDet->getADC(adc));
|
||||
#endif
|
||||
if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
|
||||
//if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
|
||||
strcat(answer,"°C");
|
||||
return string(answer);
|
||||
|
||||
@ -3774,10 +3806,20 @@ string slsDetectorCommand::helpADC(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "temp_adc " << "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) {
|
||||
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_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();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ int detectorTest( enum digitalTestMode arg);
|
||||
|
||||
|
||||
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)
|
||||
|
@ -1280,7 +1280,7 @@ int get_adc(int file_des) {
|
||||
enum dacIndex ind;
|
||||
int imod;
|
||||
int n;
|
||||
enum detDacIndex idac=0;
|
||||
enum detAdcIndex iadc=0;
|
||||
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (ind) {
|
||||
#ifdef EIGERD
|
||||
case TEMPERATURE_FPGA: //dac = TEMP_FPGA;
|
||||
retval=getBebFPGATemp();
|
||||
printf("Temperature: %d°C\n",retval);
|
||||
case TEMPERATURE_FPGA:
|
||||
iadc = TEMP_FPGA;
|
||||
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;
|
||||
#endif
|
||||
#ifdef GOTTHARDD
|
||||
case TEMPERATURE_FPGA: //dac = TEMP_FPGA;
|
||||
case TEMPERATURE_FPGA:
|
||||
break;
|
||||
case TEMPERATURE_ADC:
|
||||
break;
|
||||
@ -1316,23 +1329,23 @@ int get_adc(int file_des) {
|
||||
default:
|
||||
printf("Unknown DAC index %d\n",ind);
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Unknown ADC index %d\n",ind);
|
||||
sprintf(mess,"Unknown ADC index %d. Not implemented for this detector\n",ind);
|
||||
break;
|
||||
}
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
if ((ret==OK) && (retval==-1)) {
|
||||
retval=getADC(idac,imod);
|
||||
if (ret==OK) {
|
||||
retval=getADC(iadc,imod);
|
||||
}
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
printf("Getting ADC %d of module %d\n", idac, imod);
|
||||
printf("Getting ADC %d of module %d\n", iadc, imod);
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("ADC is %f V\n", retval);
|
||||
#endif
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user