merge conflict removed, jungfrau server and eiger server re compiled

This commit is contained in:
2018-02-05 12:33:05 +01:00
24 changed files with 1213 additions and 158 deletions

View File

@ -2694,6 +2694,129 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
};
int slsDetector::setThresholdTemperature(int val, int imod) {
int retval = -1;
int fnum = F_THRESHOLD_TEMP;
int ret = FAIL;
char mess[MAX_STR_LENGTH] = "";
int arg[2];
arg[0]=val;
arg[1]=imod;
#ifdef VERBOSE
std::cout<< std::endl;
std::cout<< "Setting/Getting Threshold Temperature to "<< val << " of module " << imod << std::endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectStop() == OK){
stopSocket->SendDataOnly(&fnum,sizeof(fnum));
stopSocket->SendDataOnly(arg,sizeof(arg));
stopSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret!=FAIL) {
stopSocket->ReceiveDataOnly(&retval,sizeof(retval));
#ifdef VERBOSE
std::cout<< "Threshold Temperature returned "<< retval << std::endl;
#endif
} else {
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(TEMPERATURE_CONTROL));
}
disconnectStop();
}
}
return retval;
}
int slsDetector::setTemperatureControl(int val, int imod) {
int retval = -1;
int fnum = F_TEMP_CONTROL;
int ret = FAIL;
char mess[MAX_STR_LENGTH] = "";
int arg[2];
arg[0]=val;
arg[1]=imod;
#ifdef VERBOSE
std::cout<< std::endl;
std::cout<< "Setting/Getting Threshold Temperature to "<< val << " of module " << imod << std::endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectStop() == OK){
stopSocket->SendDataOnly(&fnum,sizeof(fnum));
stopSocket->SendDataOnly(arg,sizeof(arg));
stopSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret!=FAIL) {
stopSocket->ReceiveDataOnly(&retval,sizeof(retval));
#ifdef VERBOSE
std::cout<< "Threshold Temperature returned "<< retval << std::endl;
#endif
} else {
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(TEMPERATURE_CONTROL));
}
disconnectStop();
}
}
return retval;
}
int slsDetector::setTemperatureEvent(int val, int imod) {
int retval = -1;
int fnum = F_TEMP_EVENT;
int ret = FAIL;
char mess[MAX_STR_LENGTH] = "";
int arg[2];
arg[0]=val;
arg[1]=imod;
#ifdef VERBOSE
std::cout<< std::endl;
std::cout<< "Setting/Getting Threshold Temperature to "<< val << " of module " << imod << std::endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectStop() == OK){
stopSocket->SendDataOnly(&fnum,sizeof(fnum));
stopSocket->SendDataOnly(arg,sizeof(arg));
stopSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret!=FAIL) {
stopSocket->ReceiveDataOnly(&retval,sizeof(retval));
#ifdef VERBOSE
std::cout<< "Threshold Temperature returned "<< retval << std::endl;
#endif
} else {
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(TEMPERATURE_CONTROL));
}
disconnectStop();
}
}
return retval;
}
/*
configure single channel
enum channelRegisterBit {
@ -7614,6 +7737,43 @@ int slsDetector::powerChip(int ival){
return retval;
}
int slsDetector::setAutoComparatorDisableMode(int ival){
int ret=FAIL;
int fnum=F_AUTO_COMP_DISABLE;
char mess[MAX_STR_LENGTH]="";
int retval=-1;
if(thisDetector->myDetectorType != JUNGFRAU){
std::cout << "Not implemented for this detector" << std::endl;
return FAIL;
}
#ifdef VERBOSE
std::cout<< "Enabling/disabling Auto comp disable mode " << endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&ival,sizeof(ival));
//check opening error
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(AUTO_COMP_DISABLE));
}else
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
return retval;
}
int slsDetector::loadSettingsFile(string fname, int imod) {
sls_detector_module *myMod=NULL;

View File

@ -568,6 +568,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
*/
int powerChip(int ival= -1);
/** automatic comparator disable for Jungfrau only
\param ival on is 1, off is 0, -1 to get
\returns OK or FAIL
*/
int setAutoComparatorDisableMode(int ival= -1);
/** loads the modules settings/trimbits reading from a file
\param fname file name . If not specified, extension is automatically generated!
@ -944,7 +950,31 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
\returns current ADC value (temperature for eiger and jungfrau in millidegrees)
*/
dacs_t getADC(dacIndex index, int imod=0);
/**
set/gets threshold temperature (Jungfrau only)
\param val value in millidegrees, -1 gets
\param imod module number, -1 is all
\returns threshold temperature in millidegrees
*/
int setThresholdTemperature(int val=-1, int imod=-1);
/**
enables/disables temperature control (Jungfrau only)
\param val value, -1 gets
\param imod module number, -1 is all
\returns temperature control enable
*/
int setTemperatureControl(int val=-1, int imod=-1);
/**
Resets/ gets over-temperature event (Jungfrau only)
\param val value, -1 gets
\param imod module number, -1 is all
\returns over-temperature event
*/
int setTemperatureEvent(int val=-1, int imod=-1);
/**
configure channel
\param reg channel register

View File

@ -234,7 +234,6 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
/*! \page config Configuration commands
Commands to configure the detector. these commands are often left to the configuration file.
- \ref configstructure "Data Structure": commands to configure detector data structure
@ -469,6 +468,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
++i;
/*! \page config
- <b>auto_comp_disable i </b> Currently not implemented. this mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us). 1 enables mode, 0 disables mode. By default, mode is disabled (comparator is enabled throughout). (JUNGFRAU only). \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="auto_comp_disable"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
++i;
/*! \page config
- <b>pulse [n] [x] [y]</b> pulses pixel at coordinates (x,y) n number of times. Used in EIGER only. Only put! \c Returns \c ("successful", "unsuccessful")
*/
@ -966,6 +972,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
- \ref settingssett "Settings and Threshold": commands to configure settings and threshold of detector
- \ref settingsdacs "DACs": commands to configure DACs of detector
- \ref settingsadcs "ADCs": commands to readout ADCs of detector
- \ref settingstmp "Temp Control": commands to monitor and handle temperature overshoot (only JUNGFRAU)
*/
/* trim/cal directories */
@ -1640,6 +1647,35 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
++i;
/* temperature control */
/*! \page settings
\section settingsadcs Temp Control
commands to monitor and handle temperature overshoot (only JUNGFRAU)
*/
/*! \page settings
- <b>temp_threshold</b> Sets/gets the threshold temperature. JUNGFRAU ONLY. \c Returns \c (double"°C")
*/
descrToFuncMap[i].m_pFuncName="temp_threshold"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTempControl;
++i;
/*! \page settings
- <b>temp_control</b> Enables/Disables the temperature control. 1 enables, 0 disables. JUNGFRAU ONLY. \c Returns \c int
*/
descrToFuncMap[i].m_pFuncName="temp_control"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTempControl;
++i;
/*! \page settings
- <b>temp_event</b> Resets/gets over-temperative event. Put only with option 0 to clear event. Gets 1 if temperature went over threshold and control is enabled, else 0. /Disables the temperature control. JUNGFRAU ONLY. \c Returns \c int
*/
descrToFuncMap[i].m_pFuncName="temp_event"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTempControl;
++i;
/* file name */
/*! \page output Output settings
@ -5438,6 +5474,80 @@ string slsDetectorCommand::helpADC(int narg, char *args[], int action) {
return os.str();
}
string slsDetectorCommand::cmdTempControl(int narg, char *args[], int action) {
char answer[1000]="";
int val = -1;
if (action==HELP_ACTION)
return helpTempControl(narg, args, action);
myDet->setOnline(ONLINE_FLAG);
if (cmd == "temp_threshold") {
if (action==PUT_ACTION) {
double fval=0.0;
if (!sscanf(args[1],"%lf", &fval))
return string("cannot scan temp control value ")+string(args[1]);
val = fval * 1000;
myDet->setThresholdTemperature(val);
}
val = myDet->setThresholdTemperature();
if (val == -1)
sprintf(answer,"%d",val);
else
sprintf(answer,"%.2f°C", (double)val/1000.000);
}
else if (cmd == "temp_control") {
if (action==PUT_ACTION) {
if (!sscanf(args[1],"%d", &val))
return string("cannot scan temp control value ")+string(args[1]);
if ((val!=0) && (val!=1))
return string ("temp_control option must be 0 or 1");
myDet->setTemperatureControl(val);
}
sprintf(answer,"%d", myDet->setTemperatureControl());
}
else if (cmd == "temp_event") {
if (action==PUT_ACTION) {
if (!sscanf(args[1],"%d", &val))
return string("cannot scan temp control value ")+string(args[1]);
if (val!=0)
return string ("temp_event option must be 0 to clear event");
myDet->setTemperatureEvent(val);
}
sprintf(answer,"%d", myDet->setTemperatureEvent());
}
else
return string ("cannot scan command " + cmd);
return string(answer);
}
string slsDetectorCommand::helpTempControl(int narg, char *args[], int action) {
ostringstream os;
if (action==PUT_ACTION || action==HELP_ACTION) {
os << "temp_threshold t \t sets the threshold temperature. Jungfrau only" << std::endl;
os << "temp_control t \t Enables/Disables the temperature control. 1 enables, 0 disables. JUNGFRAU ONLY" << std::endl;
os << "temp_event t \t Resets over-temperative event. Put only with option 0 to clear event. JUNGFRAU ONLY." << std::endl;
}
if (action==GET_ACTION || action==HELP_ACTION) {
os << "temp_threshold \t gets the threshold temperature. Jungfrau only." << std::endl;
os << "temp_control \t gets temperature control enable. 1 enabled, 0 disabled. JUNGFRAU ONLY" << std::endl;
os << "temp_event \t gets over-temperative event. Gets 1 if temperature went over threshold and control is enabled, else 0. /Disables the temperature control. JUNGFRAU ONLY." << std::endl;
}
return os.str();
}
string slsDetectorCommand::cmdTiming(int narg, char *args[], int action){
#ifdef VERBOSE
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
@ -5894,7 +6004,9 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
}
sprintf(ans,"%d",myDet->powerChip());
return string(ans);
} else if (cmd=="led") {
}
else if (cmd=="led") {
char ans[100];
int val=0;
myDet->setOnline(ONLINE_FLAG);
@ -5908,6 +6020,19 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
sprintf(ans,"%d",~(myDet->readRegister(0x4d))&1);
return string(ans);
}
else if (cmd=="auto_comp_disable") {
char ans[100];
myDet->setOnline(ONLINE_FLAG);
if (action==PUT_ACTION){
int ival = -1;
if (!sscanf(args[1],"%d",&ival))
return string("could not scan auto_comp_control parameter " + string(args[1]));
myDet->setAutoComparatorDisableMode(ival);
}
sprintf(ans,"%d",myDet->setAutoComparatorDisableMode());
return string(ans);
}
else
return string("unknown command ")+cmd;
@ -5927,6 +6052,7 @@ string slsDetectorCommand::helpAdvanced(int narg, char *args[], int action) {
os << "led s \t sets led status (0 off, 1 on)" << std::endl;
os << "powerchip i \t powers on or off the chip. i = 1 for on, i = 0 for off" << std::endl;
os << "auto_comp_disable i \t Currently not implemented. this mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us). 1 enables mode, 0 disables mode. By default, mode is disabled (comparator is enabled throughout). (JUNGFRAU only). " << std::endl;
}
if (action==GET_ACTION || action==HELP_ACTION) {
@ -5936,6 +6062,7 @@ string slsDetectorCommand::helpAdvanced(int narg, char *args[], int action) {
os << "led \t returns led status (0 off, 1 on)" << std::endl;
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, safe, unknown" << std::endl;
os << "powerchip \t gets if the chip has been powered on or off" << std::endl;
os << "auto_comp_disable \t Currently not implemented. gets if the automatic comparator diable mode is enabled/disabled" << std::endl;
}
return os.str();

View File

@ -82,6 +82,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
static string helpImage(int narg, char *args[], int action);
static string helpCounter(int narg, char *args[], int action);
static string helpADC(int narg, char *args[], int action);
static string helpTempControl(int narg, char *args[], int action);
static string helpEnablefwrite(int narg, char *args[], int action);
static string helpOverwrite(int narg, char *args[], int action);
static string helpReceiver(int narg, char *args[], int action);
@ -155,6 +156,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
string cmdImage(int narg, char *args[], int action);
string cmdCounter(int narg, char *args[], int action);
string cmdADC(int narg, char *args[], int action);
string cmdTempControl(int narg, char *args[], int action);
string cmdEnablefwrite(int narg, char *args[], int action);
string cmdOverwrite(int narg, char *args[], int action);
string cmdReceiver(int narg, char *args[], int action);

View File

@ -622,6 +622,12 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
*/
virtual int powerChip(int ival= -1)=0;
/** automatic comparator disable for Jungfrau only
\param ival on is 1, off is 0, -1 to get
\returns OK or FAIL
*/
virtual int setAutoComparatorDisableMode(int ival= -1)=0;
/** saves the modules settings/trimbits writing to a file
\param fname file name . Axtension is automatically generated!
\param imod module number, -1 means all modules
@ -658,6 +664,30 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
*/
virtual dacs_t getADC(dacIndex index, int imod=-1)=0;
/**
set/gets threshold temperature (Jungfrau only)
\param val value in millidegrees, -1 gets
\param imod module number, -1 is all
\returns threshold temperature in millidegrees
*/
virtual int setThresholdTemperature(int val=-1, int imod=-1)=0;
/**
enables/disables temperature control (Jungfrau only)
\param val value, -1 gets
\param imod module number, -1 is all
\returns temperature control enable
*/
virtual int setTemperatureControl(int val=-1, int imod=-1)=0;
/**
Resets/ gets over-temperature event (Jungfrau only)
\param val value, -1 gets
\param imod module number, -1 is all
\returns over-temperature event
*/
virtual int setTemperatureEvent(int val=-1, int imod=-1)=0;
/**
get the maximum size of the detector
\param d dimension