slsDetectorSoftware: Eiger server, added 3 commands, measuredperiod,measuredsubperiod, status trigger. measured period is in 10ns in det server, status trigger reads reg,sets bit and unsets bit

This commit is contained in:
2018-08-10 19:14:05 +02:00
parent c934e92a41
commit 0018fa46f8
19 changed files with 282 additions and 40 deletions

View File

@ -3621,7 +3621,6 @@ int slsDetector::cleanupAcquisition() {
int slsDetector::startAcquisition() {
int fnum=F_START_ACQUISITION;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
@ -3644,9 +3643,6 @@ int slsDetector::startAcquisition() {
}
}
return ret;
}
@ -3691,6 +3687,35 @@ int slsDetector::stopAcquisition() {
}
int slsDetector::sendSoftwareTrigger() {
int fnum=F_SOFTWARE_TRIGGER;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
#ifdef VERBOSE
std::cout<< "Sending software trigger "<< std::endl;
#endif
thisDetector->stoppedFlag=0;
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
}
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
return ret;
}
int slsDetector::startReadOut() {
int fnum=F_START_READOUT;

View File

@ -1069,6 +1069,12 @@ public:
*/
int stopAcquisition();
/**
* Give an internal software trigger to the detector (Eiger only)
* @return OK or FAIL
*/
int sendSoftwareTrigger();
/**
* Start readout (without exposure or interrupting exposure) (Mythen)
* @returns OK or FAIL

View File

@ -193,7 +193,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
++i;
/*! \page acquisition
- <b> status [s] </b> starts or stops acquisition in detector in non blocking mode. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). \c s: [\c start, \c stop]. \c Returns the detector status: [\c running, \c error, \c transmitting, \c finished, \c waiting, \c idle]. \c Returns \c (string)
- <b> status [s] </b> starts or stops acquisition in detector in non blocking mode. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). Eiger can also provide an internal software trigger. \c s: [\c start, \c stop, \c trigger(EIGER only)]. \c Returns the detector status: [\c running, \c error, \c transmitting, \c finished, \c waiting, \c idle]. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName="status"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdStatus;
@ -743,6 +743,20 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
++i;
/*! \page timing
- <b>measuredperiod</b> gets the measured frame period (time between last frame and the previous one) in s. For Eiger only. Makes sense only for acquisitions of more than 1 frame. \c Returns \c (double with 9 decimal digits)
*/
descrToFuncMap[i].m_pFuncName="measuredperiod"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
++i;
/*! \page timing
- <b>measuredsubperiod</b> gets the measured subframe period (time between last subframe and the previous one) in s. For Eiger only and in 32 bit mode. \c Returns \c (double with 9 decimal digits)
*/
descrToFuncMap[i].m_pFuncName="measuredsubperiod"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
++i;
/* speed */
/*! \page config
\section configspeed Speed
@ -2637,9 +2651,12 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
if (string(args[1])=="start")
myDet->startAcquisition();
else if (string(args[1])=="stop") {
myDet->setReceiverOnline(ONLINE_FLAG);
myDet->setReceiverOnline(ONLINE_FLAG);//restream stop
myDet->stopAcquisition();
}
else if (string(args[1])=="trigger") {
myDet->sendSoftwareTrigger();
}
else
return string("unknown action");
}
@ -2671,7 +2688,7 @@ string slsDetectorCommand::helpStatus(int narg, char *args[], int action) {
os << string("busy \t gets the status of acquire- can be: 0 or 1. 0 for idle, 1 for running\n");
}
if (action==PUT_ACTION || action==HELP_ACTION) {
os << string("status \t controls the detector acquisition - can be start or stop. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). \n");
os << string("status \t controls the detector acquisition - can be start or stop or trigger(EIGER only). When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). Eiger can also provide an internal software trigger\n");
os << string("busy i\t sets the status of acquire- can be: 0(idle) or 1(running).Command Acquire sets it to 1 at beignning of acquire and back to 0 at the end. Clear Flag for unexpected acquire terminations. \n");
}
return os.str();
@ -5777,6 +5794,10 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
index=MEASUREMENT_TIME;
else if (cmd=="nframes")
index=FRAMES_FROM_START;
else if (cmd=="measuredperiod")
index=MEASURED_PERIOD;
else if (cmd=="measuredsubperiod")
index=MEASURED_SUBPERIOD;
else
return string("could not decode timer ")+cmd;
@ -5786,13 +5807,13 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
}
myDet->setOnline(ONLINE_FLAG);
ret=myDet->getTimeLeft(index);
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER || index==ACTUAL_TIME || index==MEASUREMENT_TIME)
if ((ret!=-1) && (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER
|| index==ACTUAL_TIME || index==MEASUREMENT_TIME ||
MEASURED_PERIOD || MEASURED_SUBPERIOD))
rval=(double)ret*1E-9;
else rval=ret;
@ -5820,6 +5841,8 @@ string slsDetectorCommand::helpTimeLeft(int narg, char *args[], int action) {
os << "framesl \t gets the number of frames left" << std::endl;
os << "cyclesl \t gets the number of cycles left" << std::endl;
os << "probesl \t gets the number of probes left" << std::endl;
os << "measuredperiod \t gets the measured frame period (time between last frame and the previous one) in s. For Eiger only. Makes sense only for acquisitions of more than 1 frame." << std::endl;
os << "measuredsubperiod \t gets the measured subframe period (time between last subframe and the previous one) in s. For Eiger only and in 32 bit mode." << std::endl;
os << std::endl;
}

View File

@ -475,6 +475,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
int acquire(int delflag=1);
/**
* Give an internal software trigger to the detector (Eiger only)
* @return OK or FAIL
*/
virtual int sendSoftwareTrigger()=0;
// double* convertAngles(){return convertAngles(currentPosition);};
// virtual double* convertAngles(double pos)=0;