quad implemented

This commit is contained in:
2019-07-10 17:39:43 +02:00
parent 3e2b471ee1
commit 1189b991e5
32 changed files with 558 additions and 76 deletions

View File

@ -9756,5 +9756,50 @@ int slsDetector::setCTBPatWaitTime(int level, uint64_t t) {
}
int slsDetector::setQuad(int val) {
int fnum = F_QUAD, fnum2 = F_RECEIVER_QUAD;
int ret = FAIL;
int retval = -1;
// set row column header in detector
if (val >= 0) {
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&val,sizeof(val));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL){
char mess[MAX_STR_LENGTH] = {};
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(SOME_ERROR));
}
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
} else
ret = OK;
// set quad type to receiver (flipped data and detector shape, numdet)
if (ret != FAIL) {
ret = FAIL;
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
#ifdef VERBOSE
if(val ==-1)
std::cout<< "Getting Receiver Quad mode" << endl;
else
std::cout<< "Setting Receiver Quad Mode to " << val << endl;
#endif
if (connectData() == OK){
ret=thisReceiver->sendInt(fnum2,retval,val);
disconnectData();
}
if(ret==FAIL)
setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET));
}
}
return retval;
}

View File

@ -2274,6 +2274,13 @@ public:
*/
int setCTBPatWaitTime(int level, uint64_t t=-1);
/**
* Set or Get Quad Type (Only for Eiger Quad detector hardware)
* @param val 1 if quad type set, else 0, -1 gets
* @returns 1 if quad type set, else 0
*/
int setQuad(int val = -1);
private:
/**

View File

@ -378,6 +378,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
++i;
/*! \page config
- <b>quad [i] </b> if 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="quad"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
++i;
/*! \page config
- <b>roimask [i]</b> ?? \c Returns \c (int) in hexadecimal
*/
@ -4458,7 +4465,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
myDet->setOnline(ONLINE_FLAG);
if (cmd == "roi")
if (cmd == "roi" || cmd == "quad")
myDet->setReceiverOnline(ONLINE_FLAG);
if (action==PUT_ACTION) {
@ -4494,6 +4501,13 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
myDet->setMaxNumberOfChannelsPerDetector(Y,val);
}
if(cmd=="quad"){
if (val >=0 ) {
sprintf(ans, "%d", myDet->setQuad(val));
return string(ans);
}
}
if(cmd=="flippeddatax"){
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1))
return string ("cannot scan flippeddata x mode: must be 0 or 1");
@ -4533,7 +4547,13 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
} else if (cmd=="detsizechan") {
sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y));
return string(ans);
}
else if (cmd=="quad") {
sprintf(ans, "%d", myDet->setQuad());
return string(ans);
}
else if(cmd=="flippeddatax"){
myDet->setReceiverOnline(ONLINE_FLAG);
ret = myDet->getFlippedData(X);
@ -4571,6 +4591,7 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
os << "dr i \n sets the dynamic range of the detector"<< std::endl;
os << "roi i xmin xmax ymin ymax \n sets region of interest where i is number of rois;i=0 to clear rois"<< std::endl;
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl;
os << "quad i \n if i = 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
os << "flippeddatax x \n sets if the data should be flipped on the x axis"<< std::endl;
os << "flippeddatay y \n sets if the data should be flipped on the y axis"<< std::endl;
os << "gappixels i \n enables/disables gap pixels in system (detector & receiver). 1 sets, 0 unsets. Used in EIGER only and multidetector level." << std::endl;
@ -4581,6 +4602,7 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
os << "dr \n gets the dynamic range of the detector"<< std::endl;
os << "roi \n gets region of interest"<< std::endl;
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl;
os << "quad \n returns 1 if the detector size is a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
os << "flippeddatax\n gets if the data will be flipped on the x axis"<< std::endl;
os << "flippeddatay\n gets if the data will be flipped on the y axis"<< std::endl;
os << "gappixels\n gets if gap pixels is enabled in system. Used in EIGER only and multidetector level." << std::endl;

View File

@ -1021,6 +1021,13 @@ virtual int setReceiverSilentMode(int i = -1)=0;
*/
virtual int checkVersionCompatibility(portType t) = 0;
/**
* Set or Get Quad Type (Only for Eiger Quad detector hardware)
* @param val 1 if quad type set, else 0, -1 gets
* @returns 1 if quad type set, else 0
*/
virtual int setQuad(int val = -1) = 0;
protected: