mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
reset counter bit in eiger detector partially or completely
This commit is contained in:
@ -5721,6 +5721,41 @@ int slsDetector::resetCounterBlock(int startACQ){
|
||||
|
||||
|
||||
|
||||
int slsDetector::setCounterBit(int i){
|
||||
int fnum=F_SET_COUNTER_BIT;
|
||||
int ret = FAIL;
|
||||
int retval=-1;
|
||||
char mess[100];
|
||||
|
||||
if(thisDetector->onlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
if(i ==-1)
|
||||
std::cout<< "Getting counter bit from detector" << endl;
|
||||
else if(i==0)
|
||||
std::cout<< "Resetting counter bit in detector " << endl;
|
||||
else
|
||||
std::cout<< "Setting counter bit in detector " << endl;
|
||||
#endif
|
||||
if (connectControl() == OK){
|
||||
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&i,sizeof(i));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Receiver returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_SET_COUNTER_BIT));
|
||||
}
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1435,6 +1435,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int resetCounterBlock(int startACQ=0);
|
||||
|
||||
/** set/get counter bit in detector
|
||||
* @param i is -1 to get, 0 to reset and any other value to set the counter bit
|
||||
/returns the counter bit in detector
|
||||
*/
|
||||
int setCounterBit(int i = -1);
|
||||
|
||||
|
||||
int getMoveFlag(int imod){if (moveFlag) return *moveFlag; else return 1;};
|
||||
|
||||
|
@ -163,6 +163,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdCounter;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="setctrbit"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdCounter;
|
||||
i++;
|
||||
|
||||
/* trim/cal directories */
|
||||
descrToFuncMap[i].m_pFuncName="trimdir"; //OK
|
||||
@ -2203,6 +2206,7 @@ string slsDetectorCommand::helpImage(int narg, char *args[], int action){
|
||||
|
||||
string slsDetectorCommand::cmdCounter(int narg, char *args[], int action){
|
||||
int ival;
|
||||
char answer[100];
|
||||
string sval;
|
||||
int retval;
|
||||
if (action==HELP_ACTION)
|
||||
@ -2229,6 +2233,16 @@ string slsDetectorCommand::cmdCounter(int narg, char *args[], int action){
|
||||
retval=myDet->resetCounterBlock(ival);
|
||||
}
|
||||
|
||||
else if (string(args[0])==string("setctrbit")){
|
||||
if (action==PUT_ACTION){
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string("Could not scan resetctrbit input ")+string(args[1]);
|
||||
if(ival>=0)
|
||||
sprintf(answer,"%d",myDet->setCounterBit(ival));
|
||||
}else
|
||||
sprintf(answer,"%d",myDet->setCounterBit());
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
if(retval==OK)
|
||||
return string("Counter read/reset succesfully");
|
||||
@ -2243,10 +2257,13 @@ string slsDetectorCommand::helpCounter(int narg, char *args[], int action){
|
||||
if (action==PUT_ACTION || action==HELP_ACTION){
|
||||
os << "readctr \t Cannot put"<< std::endl;
|
||||
os << "resetctr i \t resets counter in detector, restarts acquisition if i=1"<< std::endl;
|
||||
os << "setctrbit i \t sets/resets counter bit in detector"<< std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION){
|
||||
os << "readctr i fname\t reads counter in detector to file fname, restarts acquisition if i=1"<< std::endl;
|
||||
os << "resetctr \t Cannot get"<< std::endl;
|
||||
os << "setctrbit i \t gets the counter bit in detector"<< std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION)
|
||||
os << "readctr i fname\t reads counter in detector to file fname, restarts acquisition if i=1"<< std::endl;
|
||||
os << "resetctr \t Cannot get"<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
@ -382,8 +382,11 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
*/
|
||||
virtual int resetCounterBlock(int startACQ=0)=0;
|
||||
|
||||
|
||||
|
||||
/** set/get counter bit in detector
|
||||
* @param i is -1 to get, 0 to reset and any other value to set the counter bit
|
||||
/returns the counter bit in detector
|
||||
*/
|
||||
virtual int setCounterBit(int i = -1)=0;
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user