diff --git a/slsDetectorSoftware/commonFiles/sls_detector_defs.h b/slsDetectorSoftware/commonFiles/sls_detector_defs.h index 2148d8e49..45ad39766 100755 --- a/slsDetectorSoftware/commonFiles/sls_detector_defs.h +++ b/slsDetectorSoftware/commonFiles/sls_detector_defs.h @@ -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) */ }; /** diff --git a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv2.0.3.11.5 b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv2.0.3.11.6 similarity index 57% rename from slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv2.0.3.11.5 rename to slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv2.0.3.11.6 index 788082da7..16ccc9e82 100755 Binary files a/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv2.0.3.11.5 and b/slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv2.0.3.11.6 differ diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index 30f31ba49..ba022ede0 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -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; } diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h b/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h index aa52415a8..06e2bdc26 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorServer_defs.h @@ -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_ */ diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 58bc7a664..27a153fdb 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -2325,6 +2325,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){ if (ret==FAIL) { std::cout<< "Get ADC failed " << std::endl; } + return retval; diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 4591026e2..1c5ba6765 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -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,17 +3773,29 @@ 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)) - strcat(answer,"°C"); + //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(); } diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h index 0ff6661e3..9c4ba3c6f 100644 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h @@ -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) diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c index e3b062421..c48621929 100755 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c @@ -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); }