mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
slsReceiver:trying to get deactivate to work
This commit is contained in:
@ -3556,6 +3556,10 @@ int multiSlsDetector::activate(int const enable) {
|
||||
return callDetectorMember(&slsDetector::activate, enable);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setDeactivatedRxrPaddingMode(int padding) {
|
||||
return callDetectorMember(&slsDetector::setDeactivatedRxrPaddingMode, padding);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getFlippedData(dimension d) {
|
||||
return callDetectorMember(&slsDetector::getFlippedData, d);
|
||||
}
|
||||
|
@ -1241,11 +1241,18 @@ public:
|
||||
int writeAdcRegister(int addr, int val);
|
||||
|
||||
/**
|
||||
* Activates the detector (Eiger only)
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
* @param enable active (1) or inactive (0), -1 gets
|
||||
* @returns 0 (inactive) or 1 (active)
|
||||
* @returns 0 (inactive) or 1 (active)for activate mode
|
||||
*/
|
||||
int activate(int const enable=GET_ONLINE_FLAG);
|
||||
int activate(int const enable=-1);
|
||||
|
||||
/**
|
||||
* Set deactivated Receiver padding mode (Eiger only)
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
int setDeactivatedRxrPaddingMode(int padding=-1);
|
||||
|
||||
/**
|
||||
* Returns the enable if data will be flipped across x or y axis (Eiger)
|
||||
|
@ -749,7 +749,8 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->receiverAPIVersion = 0;
|
||||
thisDetector->receiver_frameDiscardMode = NO_DISCARD;
|
||||
thisDetector->receiver_framePadding = 1;
|
||||
|
||||
thisDetector->activated = true;
|
||||
thisDetector->receiver_deactivatedPaddingEnable = true;
|
||||
|
||||
// get the detector parameters based on type
|
||||
detParameterList detlist;
|
||||
@ -5272,6 +5273,10 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
std::cout << "sub period:" << thisDetector->timerValue[SUBFRAME_PERIOD] << endl;
|
||||
std::cout << "dynamic range:" << thisDetector->dynamicRange << endl;
|
||||
std::cout << "flippeddatax:" << thisDetector->flippedData[X] << endl;
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
std::cout << "activated: " << thisDetector->activated << endl;
|
||||
std::cout << "receiver deactivated padding: " << thisDetector->receiver_deactivatedPaddingEnable << endl;
|
||||
}
|
||||
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl;
|
||||
std::cout << "Gap pixels: " << thisDetector->gappixels << endl;
|
||||
std::cout << "rx streaming source ip:" << thisDetector->receiver_zmqip << endl;
|
||||
@ -5319,6 +5324,7 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
setFlippedData(X,-1);
|
||||
activate(-1);
|
||||
setDeactivatedRxrPaddingMode(thisDetector->receiver_deactivatedPaddingEnable);
|
||||
}
|
||||
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
@ -6211,7 +6217,7 @@ int slsDetector::activate(int const enable) {
|
||||
int retval = -1;
|
||||
int arg = enable;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret = OK;
|
||||
int ret = FAIL;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER){
|
||||
std::cout<< "Not implemented for this detector" << std::endl;
|
||||
@ -6238,6 +6244,7 @@ int slsDetector::activate(int const enable) {
|
||||
setErrorMask((getErrorMask())|(DETECTOR_ACTIVATE));
|
||||
} else {
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
thisDetector->activated = retval;
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
@ -6254,12 +6261,13 @@ int slsDetector::activate(int const enable) {
|
||||
#endif
|
||||
|
||||
if(ret!=FAIL){
|
||||
int arg = thisDetector->activated;
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Activating/Deactivating Receiver: " << retval << std::endl;
|
||||
std::cout << "Activating/Deactivating Receiver: " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum2,retval,retval);
|
||||
ret=thisReceiver->sendInt(fnum2,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
@ -6276,12 +6284,44 @@ int slsDetector::activate(int const enable) {
|
||||
#endif
|
||||
|
||||
|
||||
return retval;
|
||||
return thisDetector->activated;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::setDeactivatedRxrPaddingMode(int padding) {
|
||||
int fnum = F_RECEIVER_DEACTIVATED_PADDING_ENABLE;
|
||||
int retval = -1;
|
||||
int arg = padding;
|
||||
int ret = OK;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER){
|
||||
std::cout<< "Not implemented for this detector" << std::endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACTIVATE));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Deactivated Receiver Padding Enable: " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACTIVATE));
|
||||
else
|
||||
thisDetector->receiver_deactivatedPaddingEnable = retval;
|
||||
}
|
||||
|
||||
return thisDetector->receiver_deactivatedPaddingEnable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetector::getFlippedData(dimension d) {
|
||||
return thisDetector->flippedData[d];
|
||||
}
|
||||
@ -8570,7 +8610,13 @@ int slsDetector::updateReceiverNoWait() {
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_upstream = ind;
|
||||
|
||||
// activate
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->activated = ind;
|
||||
|
||||
// deactivated padding enable
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_deactivatedPaddingEnable = ind;
|
||||
|
||||
if (!n) printf("n: %d\n", n);
|
||||
|
||||
|
@ -375,6 +375,12 @@ private:
|
||||
/** receiver partial frames padding enable */
|
||||
bool receiver_framePadding;
|
||||
|
||||
/** activated receiver */
|
||||
bool activated;
|
||||
|
||||
/** padding enable in deactivated receiver */
|
||||
bool receiver_deactivatedPaddingEnable;
|
||||
|
||||
} sharedSlsDetector;
|
||||
|
||||
|
||||
@ -1525,11 +1531,18 @@ public:
|
||||
int writeAdcRegister(int addr, int val);
|
||||
|
||||
/**
|
||||
* Activates the detector (Eiger only)
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
* @param enable active (1) or inactive (0), -1 gets
|
||||
* @returns 0 (inactive) or 1 (active)
|
||||
* @returns 0 (inactive) or 1 (active)for activate mode
|
||||
*/
|
||||
int activate(int const enable=GET_ONLINE_FLAG);
|
||||
int activate(int const enable=-1);
|
||||
|
||||
/**
|
||||
* Set deactivated Receiver padding mode (Eiger only)
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
int setDeactivatedRxrPaddingMode(int padding=-1);
|
||||
|
||||
/**
|
||||
* Returns the enable if data will be flipped across x or y axis (Eiger)
|
||||
|
@ -481,12 +481,19 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int setOnline(int const online=-1)=0;
|
||||
|
||||
/** @short activates the detector (detector specific)
|
||||
\param enable can be: -1 returns wether the detector is in active (1) or inactive (0) state
|
||||
\returns 0 (inactive) or 1 (active)
|
||||
*/
|
||||
virtual int activate(int const enable=GET_ONLINE_FLAG)=0;
|
||||
/**
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
* @param enable active (1) or inactive (0), -1 gets
|
||||
* @returns 0 (inactive) or 1 (active)for activate mode
|
||||
*/
|
||||
virtual int activate(int const enable=-1)=0;
|
||||
|
||||
/**
|
||||
* Set deactivated Receiver padding mode (Eiger only)
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
virtual int setDeactivatedRxrPaddingMode(int padding=-1)=0;
|
||||
|
||||
/**
|
||||
@short set detector settings
|
||||
|
@ -324,7 +324,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdOnline;
|
||||
++i;
|
||||
/*! \page config
|
||||
- <b>activate</b> Activates/Deactivates the detector. Deactivated detector does not send data. Used for EIGER only. \c Returns \c (int)
|
||||
- <b>activate [b] [p]</b> Activates/Deactivates the detector. \c b is 1 for activate, 0 for deactivate. Deactivated detector does not send data. \c p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Used for EIGER only. \c Returns \c (int) (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="activate"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdOnline;
|
||||
@ -4363,11 +4363,20 @@ string slsDetectorCommand::cmdOnline(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION) {
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string("Could not scan activate mode ")+string(args[1]);
|
||||
/* if(dynamic_cast<slsDetector*>(myDet) != NULL)
|
||||
return string("Can only set it from the multiDetector mode");*/
|
||||
myDet->activate(ival);
|
||||
bool padding = true;
|
||||
if (narg > 2) {
|
||||
if (string(args[2]) == "padding")
|
||||
padding = true;
|
||||
else if (string(args[2]) == "nopadding")
|
||||
padding = false;
|
||||
else
|
||||
return string ("Could not scan activate mode's padding option " + string(args[2]));
|
||||
myDet->setDeactivatedRxrPaddingMode(padding);
|
||||
}
|
||||
}
|
||||
sprintf(ans,"%d",myDet->activate());
|
||||
int ret = myDet->setDeactivatedRxrPaddingMode();
|
||||
sprintf(ans,"%d %s", myDet->activate(), ret == 1 ? "padding" : (ret == 0 ? "nopadding" : "unknown"));
|
||||
}
|
||||
else if(cmd=="r_online"){
|
||||
if (action==PUT_ACTION) {
|
||||
@ -4398,14 +4407,14 @@ string slsDetectorCommand::helpOnline(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "online i \n sets the detector in online (1) or offline (0) mode"<< std::endl;
|
||||
os << "r_online i \n sets the receiver in online (1) or offline (0) mode"<< std::endl;
|
||||
os << "activate i \n sets the detector in activated (1) or deactivated (0) mode (does not send data). Only for Eiger."<< std::endl;
|
||||
os << "activate i [p]\n sets the detector in activated (1) or deactivated (0) mode (does not send data). p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Only for Eiger."<< std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "online \n gets the detector online (1) or offline (0) mode"<< std::endl;
|
||||
os << "checkonline \n returns the hostnames of all detectors in offline mode"<< std::endl;
|
||||
os << "r_online \n gets the receiver online (1) or offline (0) mode"<< std::endl;
|
||||
os << "r_checkonline \n returns the hostnames of all receiver in offline mode"<< std::endl;
|
||||
os << "activate \n gets the detector activated (1) or deactivated (0) mode. Only for Eiger."<< std::endl;
|
||||
os << "activate \n gets the detector activated (1) or deactivated (0) mode. And padding or nonpadding for the deactivated receiver. Only for Eiger."<< std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
|
Reference in New Issue
Block a user