mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
set dynamic range implemented for receiver
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@797 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
1607ddb096
commit
1557cb1de8
@ -45,6 +45,7 @@ using namespace std;
|
||||
#define DETECTOR_TIMER_VALUE_NOT_SET 0x0000000000000100ULL
|
||||
#define RECEIVER_ACQ_PERIOD_NOT_SET 0x0000000000000200ULL
|
||||
#define RECEIVER_FRAME_NUM_NOT_SET 0x0000000000000400ULL
|
||||
#define RECEIVER_DYNAMIC_RANGE 0x0000000000000800ULL
|
||||
|
||||
/** @short class returning all error messages for error mask */
|
||||
class errorDefs {
|
||||
@ -130,6 +131,10 @@ public:
|
||||
if(slsErrorMask&RECEIVER_FRAME_NUM_NOT_SET)
|
||||
retval.append("Could not set frame number in receiver.\n");
|
||||
|
||||
if(slsErrorMask&RECEIVER_DYNAMIC_RANGE)
|
||||
retval.append("Could not set dynamic range in receiver.\n");
|
||||
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
@ -3538,10 +3538,12 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
//send acquisiton period/frame number to receiver
|
||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD))
|
||||
{
|
||||
if((ret != FAIL) && (t != -1)){
|
||||
if(ret != FAIL){
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
int64_t args[2];
|
||||
args[1] = retval;
|
||||
if(t == -1)
|
||||
args[1] = -1;
|
||||
|
||||
if(index==FRAME_NUMBER){
|
||||
#ifdef VERBOSE
|
||||
@ -4017,7 +4019,7 @@ int slsDetector::setDynamicRange(int n){
|
||||
|
||||
// cout << "single " << endl;
|
||||
int fnum=F_SET_DYNAMIC_RANGE;
|
||||
int retval=-1;
|
||||
int retval=-1,retval1;
|
||||
char mess[100];
|
||||
int ret=OK;
|
||||
|
||||
@ -4068,8 +4070,27 @@ int slsDetector::setDynamicRange(int n){
|
||||
std::cout<< "Dynamic range set to "<< thisDetector->dynamicRange << std::endl;
|
||||
std::cout<< "Data bytes "<< thisDetector->dataBytes << std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//receiver
|
||||
if(ret != FAIL){
|
||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending/Getting dynamic range to/from receiver " << retval << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK)
|
||||
ret=thisReceiver->sendInt(fnum,retval1,retval);
|
||||
if((retval1 != retval)|| (ret==FAIL)){
|
||||
ret = FAIL;
|
||||
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << retval1 << " instead of " << retval << endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_DYNAMIC_RANGE));
|
||||
}
|
||||
if(ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
}
|
||||
}
|
||||
|
||||
return thisDetector->dynamicRange;
|
||||
};
|
||||
|
||||
@ -4876,9 +4897,15 @@ char* slsDetector::setReceiver(string receiverIP){
|
||||
else
|
||||
setFrameIndex(-1);
|
||||
|
||||
setTimer(FRAME_PERIOD,setTimer(FRAME_PERIOD,-1));
|
||||
setTimer(FRAME_PERIOD,thisDetector->timerValue[FRAME_PERIOD]);
|
||||
setUDPConnection();
|
||||
}
|
||||
|
||||
else{
|
||||
setTimer(FRAME_NUMBER,thisDetector->timerValue[FRAME_NUMBER]);
|
||||
setDynamicRange(thisDetector->dynamicRange);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return thisDetector->receiver_hostname;
|
||||
|
@ -55,6 +55,7 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det):
|
||||
frameIndexOffset(GOTTHARD_FRAME_INDEX_OFFSET),
|
||||
acquisitionPeriod(SAMPLE_TIME_IN_NS),
|
||||
numberOfFrames(0),
|
||||
dynamicRange(0),
|
||||
shortFrame(-1),
|
||||
currframenum(0),
|
||||
prevframenum(0),
|
||||
@ -378,9 +379,17 @@ int32_t slsReceiverFunctionList::setScanTag(int32_t stag){
|
||||
}
|
||||
|
||||
int32_t slsReceiverFunctionList::setDynamicRange(int32_t dr){
|
||||
if(dr >= 0)
|
||||
receiver->setDynamicRange(dr);
|
||||
return receiver->getDynamicRange();
|
||||
if(dr >= 0){
|
||||
if(myDetectorType == EIGER)
|
||||
receiver->setDynamicRange(dr);
|
||||
else
|
||||
dynamicRange = dr;
|
||||
}
|
||||
|
||||
if(myDetectorType == EIGER)
|
||||
return receiver->getDynamicRange();
|
||||
else
|
||||
return dynamicRange;
|
||||
}
|
||||
|
||||
|
||||
|
@ -437,6 +437,9 @@ private:
|
||||
/** frame number */
|
||||
int32_t numberOfFrames;
|
||||
|
||||
/** dynamic range */
|
||||
int dynamicRange;
|
||||
|
||||
/** short frames */
|
||||
int shortFrame;
|
||||
|
||||
|
@ -320,7 +320,7 @@ int slsReceiverFuncs::function_table(){
|
||||
flist[F_SET_TIMER] = &slsReceiverFuncs::set_timer;
|
||||
flist[F_ENABLE_COMPRESSION] = &slsReceiverFuncs::enable_compression;
|
||||
flist[F_SET_DETECTOR_HOSTNAME] = &slsReceiverFuncs::set_detector_hostname;
|
||||
|
||||
flist[F_SET_DYNAMIC_RANGE] = &slsReceiverFuncs::set_dynamic_range;
|
||||
|
||||
//General Functions
|
||||
flist[F_LOCK_SERVER] = &slsReceiverFuncs::lock_receiver;
|
||||
@ -1605,6 +1605,66 @@ int slsReceiverFuncs::set_detector_hostname() {
|
||||
|
||||
|
||||
|
||||
int slsReceiverFuncs::set_dynamic_range() {
|
||||
ret=OK;
|
||||
int retval=-1;
|
||||
int dr;
|
||||
strcpy(mess,"Could not set dynamic range\n");
|
||||
|
||||
|
||||
// receive arguments
|
||||
if(socket->ReceiveDataOnly(&dr,sizeof(dr)) < 0 ){
|
||||
strcpy(mess,"Error reading from socket\n");
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
// execute action if the arguments correctly arrived
|
||||
#ifdef SLS_RECEIVER_FUNCTION_LIST
|
||||
if (ret==OK) {
|
||||
if (lockStatus==1 && socket->differentClients==1){
|
||||
sprintf(mess,"Receiver locked by %s\n", socket->lastClientIP);
|
||||
ret=FAIL;
|
||||
}
|
||||
else
|
||||
retval=slsReceiverList->setDynamicRange(dr);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
if(ret!=FAIL)
|
||||
cout << "dynamic range" << dr << endl;
|
||||
else
|
||||
cout << mess << endl;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(ret==OK && socket->differentClients){
|
||||
cout << "Force update" << endl;
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
// send answer
|
||||
socket->SendDataOnly(&ret,sizeof(ret));
|
||||
if(ret==FAIL)
|
||||
socket->SendDataOnly(mess,sizeof(mess));
|
||||
socket->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
//return ok/fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -157,10 +157,11 @@ public:
|
||||
/** enable compression */
|
||||
int enable_compression();
|
||||
|
||||
/** set detector hostname for eiger */
|
||||
/** set detector hostname */
|
||||
int set_detector_hostname();
|
||||
|
||||
|
||||
/** set dynamic range */
|
||||
int set_dynamic_range();
|
||||
|
||||
|
||||
//General Functions
|
||||
|
Loading…
x
Reference in New Issue
Block a user