mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 23:28:04 +01:00
pulsing client side, and bug fix server side for reset partially
This commit is contained in:
@@ -7451,4 +7451,65 @@ int slsDetector::setCTBPatWaitTime(int level, uint64_t t) {
|
||||
|
||||
}
|
||||
|
||||
int slsDetector::pulsePixel(int n,int x,int y) {
|
||||
int ret=FAIL;
|
||||
int fnum=F_PULSE_PIXEL;
|
||||
char mess[100];
|
||||
int arg[3];
|
||||
arg[0] = n; arg[1] = x; arg[2] = y;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< std::endl<< "Pulsing Pixel " << n << " number of times at (" << x << "," << "y)" << endl << endl;
|
||||
#endif
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_PULSE_PIXEL));
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::pulsePixelNMove(int n,int x,int y) {
|
||||
int ret=FAIL;
|
||||
int fnum=F_PULSE_PIXEL_AND_MOVE;
|
||||
char mess[100];
|
||||
int arg[3];
|
||||
arg[0] = n; arg[1] = x; arg[2] = y;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< std::endl<< "Pulsing Pixel " << n << " number of times and move by deltax:" << x << " deltay:" << y << endl << endl;
|
||||
#endif
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_PULSE_PIXEL_NMOVE));
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1734,6 +1734,24 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int setCTBPatWaitTime(int level, uint64_t t=-1);
|
||||
|
||||
/**
|
||||
Pulse Pixel
|
||||
\param n is number of times to pulse
|
||||
\param x is x coordinate
|
||||
\param y is y coordinate
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int pulsePixel(int n=0,int x=0,int y=0);
|
||||
|
||||
/**
|
||||
Pulse Pixel and move by a relative value
|
||||
\param n is number of times to pulse
|
||||
\param x is relative x value
|
||||
\param y is relative y value
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int pulsePixelNMove(int n=0,int x=0,int y=0);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -1019,7 +1019,16 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
i++;
|
||||
|
||||
|
||||
/* pulse pixel */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="pulse"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPulse;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="pulsenmove"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPulse;
|
||||
i++;
|
||||
|
||||
|
||||
|
||||
numberOfCommands=i;
|
||||
@@ -4916,3 +4925,73 @@ else return helpPattern(narg, args, action);
|
||||
return os.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
string slsDetectorCommand::helpPulse(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "pulse [n] [x] [y] \t pulses pixel at coordinates (x,y) n number of times" << std::endl;
|
||||
os << "pulsenmove [n] [x] [y]\t pulses pixel n number of times and moves relatively by x value (x axis) and y value(y axis)" << std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION){
|
||||
os << "pulse \t cannot get" << std::endl;
|
||||
os << "pulsenmove \t cannot get" << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdPulse(int narg, char *args[], int action) {
|
||||
int ival1=1,ival2=-2,ival3=-1;
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
return helpPulse(narg, args, action);
|
||||
else if (action==GET_ACTION)
|
||||
return string("cannot get ")+cmd;
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
if (string(args[0])==string("pulse")){
|
||||
if(myDet->pulsePixel(ival1,ival2,ival3) == OK)
|
||||
return string("Pulse pixel successful");
|
||||
else
|
||||
return string("Pulse pixel failed");
|
||||
}
|
||||
|
||||
else if (string(args[0])==string("pulsenmove")){
|
||||
if(myDet->pulsePixelNMove(ival1,ival2,ival3) == OK)
|
||||
return string("Pulse pixel and move successful");
|
||||
else
|
||||
return string("Pulse pixel and move failed");
|
||||
}
|
||||
|
||||
return string("could not decode command")+cmd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
static string helpOverwrite(int narg, char *args[], int action);
|
||||
static string helpReceiver(int narg, char *args[], int action);
|
||||
static string helpPattern(int narg, char *args[], int action);
|
||||
|
||||
static string helpPulse(int narg, char *args[], int action);
|
||||
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
string cmdOverwrite(int narg, char *args[], int action);
|
||||
string cmdReceiver(int narg, char *args[], int action);
|
||||
string cmdPattern(int narg, char *args[], int action);
|
||||
string cmdPulse(int narg, char *args[], int action);
|
||||
|
||||
|
||||
int numberOfCommands;
|
||||
|
||||
@@ -760,9 +760,23 @@ virtual int setReceiverFifoDepth(int i = -1)=0;
|
||||
*/
|
||||
virtual int setCTBPatWaitTime(int level, uint64_t t=-1)=0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Pulse Pixel
|
||||
\param n is number of times to pulse
|
||||
\param x is x coordinate
|
||||
\param y is y coordinate
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
virtual int pulsePixel(int n=0,int x=0,int y=0)=0;
|
||||
|
||||
/**
|
||||
Pulse Pixel and move by a relative value
|
||||
\param n is number of times to pulse
|
||||
\param x is relative x value
|
||||
\param y is relative y value
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
virtual int pulsePixelNMove(int n=0,int x=0,int y=0)=0;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user