slsDetectorSoftware: moved offsets from multi shm to sls shm, and moved updated offsets and createthreadpool to end of addmultipledetectors, so that it is not done each time per detector

This commit is contained in:
2018-06-29 12:21:15 +02:00
parent ed1135566a
commit d7cc9fc023
4 changed files with 86 additions and 37 deletions

View File

@ -636,6 +636,8 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
thisDetector->stoppedFlag = 0;
strncpy(thisDetector->hostname, DEFAULT_HOSTNAME, MAX_STR_LENGTH-1);
thisDetector->hostname[MAX_STR_LENGTH-1] = 0;
thisDetector->offset[X] = 0;
thisDetector->offset[Y] = 0;
thisDetector->controlPort = DEFAULT_PORTNO;
thisDetector->stopPort = DEFAULT_PORTNO + 1;
thisDetector->myDetectorType = type;
@ -1692,6 +1694,14 @@ int slsDetector::getNChips(dimension d) {
return thisDetector->nChip[d];
}
int slsDetector::getDetectorOffset(dimension d) {
return thisDetector->offset[d];
}
void slsDetector::setDetectorOffset(dimension d, int off) {
if (off >= 0)
thisDetector->offset[d] = off;
}
int slsDetector::setOnline(int off) {
int old=thisDetector->onlineFlag;

View File

@ -19,7 +19,7 @@ class multiSlsDetector;
class SharedMemory;
class receiverInterface;
#define SLS_SHMVERSION 0x180628
#define SLS_SHMVERSION 0x180629
#define NMODMAXX 24
#define NMODMAXY 24
#define NCHIPSMAX 10
@ -57,11 +57,6 @@ private:
/** shared memory version */
int shmversion;
/** END OF FIXED PATTERN -----------------------------------------------*/
/** online flag - is set if the detector is connected, unset if socket
* connection is not possible */
int onlineFlag;
@ -74,6 +69,14 @@ private:
* before starting the communication */
char hostname[MAX_STR_LENGTH];
/** END OF FIXED PATTERN -----------------------------------------------*/
/** Detector offset in the X & Y direction in the multi detector structure */
int offset[2];
/** is the port used for control functions */
int controlPort;
@ -719,6 +722,20 @@ public:
*/
int getNChips(dimension d);
/**
* Get Detector offset from shared memory in dimension d
* @param d dimension d
* @returns offset in dimension d
*/
int getDetectorOffset(dimension d);
/**
* Set Detector offset in shared memory in dimension d
* @param d dimension d
* @param off offset for detector
*/
void setDetectorOffset(dimension d, int off);
/**
* Checks if the detector is online and sets the online flag
* @param online if GET_ONLINE_FLAG, only returns shared memory online flag,