added auto comp disable feature

This commit is contained in:
2018-02-02 18:01:01 +01:00
parent c520f10409
commit 5d04067973
15 changed files with 200 additions and 8 deletions

View File

@ -7513,6 +7513,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

@ -551,6 +551,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!

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
@ -461,6 +460,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
++i;
/*! \page config
- <b>auto_comp_disable i </b> 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")
*/
@ -5854,7 +5860,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);
@ -5868,6 +5876,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;
@ -5887,6 +5908,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 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) {
@ -5896,6 +5918,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 gets if the automatic comparator diable mode is enabled/disabled" << std::endl;
}
return os.str();

View File

@ -582,6 +582,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