This commit is contained in:
maliakal_d 2019-08-16 17:07:30 +02:00
parent 336f8ceb50
commit 10ce82fc5f
10 changed files with 115 additions and 181 deletions

View File

@ -54,13 +54,13 @@ struct sharedMultiSlsDetector {
* -----------------------------------------------*/
/** Number of detectors operated at once */
int numberOfDetector[2];
slsDetectorDefs::xy numberOfDetector;
/** total number of channels for all detectors */
int numberOfChannels[2];
slsDetectorDefs::xy numberOfChannels;
/** max number of channels for complete detector*/
int maxNumberOfChannels[2];
slsDetectorDefs::xy maxNumberOfChannels;
/** flag for acquiring */
bool acquiringFlag;
@ -1413,22 +1413,20 @@ class multiSlsDetector : public virtual slsDetectorDefs {
int setDeactivatedRxrPaddingMode(int padding = -1, int detPos = -1);
/**
* Returns the enable if data will be flipped across x or y axis (Eiger)
* @param d axis across which data is flipped
* Returns the enable if data will be flipped across x axis (Eiger)
* @param detPos -1 for all detectors in list or specific detector position
* @returns 1 for flipped, else 0
*/
int getFlippedData(dimension d = X, int detPos = -1); //
int getFlippedDataX(int detPos = -1); //
/**
* Sets the enable which determines if
* data will be flipped across x or y axis (Eiger)
* @param d axis across which data is flipped
* data will be flipped across x axis (Eiger)
* @param value 0 or 1 to reset/set or -1 to get value
* @param detPos -1 for all detectors in list or specific detector position
* @returns enable flipped data across x or y axis
*/
int setFlippedData(dimension d = X, int value = -1, int detPos = -1); //
int setFlippedDataX(int value = -1, int detPos = -1); //
/**
* Sets all the trimbits to a particular value (Eiger)

View File

@ -13,7 +13,7 @@
class ServerInterface;
#define SLS_SHMAPIVERSION 0x190726
#define SLS_SHMVERSION 0x190815
#define SLS_SHMVERSION 0x190816
/**
* @short structure allocated in shared memory to store detector settings for
@ -36,7 +36,7 @@ struct sharedSlsDetector {
/** END OF FIXED PATTERN -----------------------------------------------*/
/** Number of detectors in multi list in x dir and y dir */
int multiSize[2];
slsDetectorDefs::xy multiSize;
/** is the port used for control functions */
int controlPort;
@ -50,17 +50,11 @@ struct sharedSlsDetector {
/** list of the energies at which the detector has been trimmed */
sls::FixedCapacityContainer<int, MAX_TRIMEN> trimEnergies;
/** number of channels per chip */
int nChans;
/** number of channels per chip in one direction */
int nChan[2];
/** number of chips per module*/
int nChips;
slsDetectorDefs::xy nChan;
/** number of chips per module in one direction */
int nChip[2];
slsDetectorDefs::xy nChip;
/** number of dacs per module*/
int nDacs;
@ -142,7 +136,7 @@ struct sharedSlsDetector {
int tenGigaEnable;
/** flipped data across x or y axis */
int flippedData[2];
int flippedDataX;
/** tcp port from gui/different process to receiver (only data) */
int zmqport;
@ -166,7 +160,7 @@ struct sharedSlsDetector {
int gappixels;
/** gap pixels in each direction */
int nGappixels[2];
slsDetectorDefs::xy nGappixels;
/** additional json header */
char rxAdditionalJsonHeader[MAX_STR_LENGTH];
@ -356,10 +350,9 @@ class slsDetector : public virtual slsDetectorDefs {
/**
* Set Detector offset in shared memory in dimension d
* @param detx number of detectors in X dir in multi list
* @param dety number of detectors in Y dir in multi list
* @param det detector size
*/
void updateMultiSize(int detx, int dety);
void updateMultiSize(slsDetectorDefs::xy det);
int setControlPort(int port_number);
@ -1168,20 +1161,18 @@ class slsDetector : public virtual slsDetectorDefs {
bool setDeactivatedRxrPaddingMode(int padding = -1);
/**
* Returns the enable if data will be flipped across x or y axis (Eiger)
* @param d axis across which data is flipped
* Returns the enable if data will be flipped across x axis (Eiger)
* @returns 1 for flipped, else 0
*/
int getFlippedData(dimension d = X) const;
int getFlippedDataX() const;
/**
* Sets the enable which determines if
* data will be flipped across x or y axis (Eiger)
* @param d axis across which data is flipped
* data will be flipped across x axis (Eiger)
* @param value 0 or 1 to reset/set or -1 to get value
* @returns enable flipped data across x or y axis
* @returns enable flipped data across x axis
*/
int setFlippedData(dimension d = X, int value = -1);
int setFlippedDataX(int value = -1);
/**
* Sets all the trimbits to a particular value (Eiger)

View File

@ -1094,11 +1094,11 @@ void Detector::setActive(bool active, Positions pos) {
}
Result<bool> Detector::getBottom(Positions pos) const {
return pimpl->Parallel(&slsDetector::getFlippedData, pos, defs::X);
return pimpl->Parallel(&slsDetector::getFlippedDataX, pos);
}
void Detector::setBottom(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setFlippedData, pos, defs::X, static_cast<int>(value));
pimpl->Parallel(&slsDetector::setFlippedDataX, pos, static_cast<int>(value));
}
Result<int> Detector::getAllTrimbits(Positions pos) const {

View File

@ -276,12 +276,12 @@ void multiSlsDetector::initializeDetectorStructure() {
multi_shm()->shmversion = MULTI_SHMVERSION;
multi_shm()->numberOfDetectors = 0;
multi_shm()->multiDetectorType = GENERIC;
multi_shm()->numberOfDetector[X] = 0;
multi_shm()->numberOfDetector[Y] = 0;
multi_shm()->numberOfChannels[X] = 0;
multi_shm()->numberOfChannels[Y] = 0;
multi_shm()->maxNumberOfChannels[X] = 0;
multi_shm()->maxNumberOfChannels[Y] = 0;
multi_shm()->numberOfDetector.x = 0;
multi_shm()->numberOfDetector.y = 0;
multi_shm()->numberOfChannels.x = 0;
multi_shm()->numberOfChannels.y = 0;
multi_shm()->maxNumberOfChannels.x = 0;
multi_shm()->maxNumberOfChannels.y = 0;
multi_shm()->acquiringFlag = false;
multi_shm()->receiver_upstream = false;
}
@ -431,7 +431,7 @@ void multiSlsDetector::updateDetectorSize() {
const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels();
int maxy = multi_shm()->maxNumberOfChannels[Y];
int maxy = multi_shm()->maxNumberOfChannels.y;
if (maxy == 0) {
maxy = det_size.y * size();
}
@ -442,29 +442,26 @@ void multiSlsDetector::updateDetectorSize() {
++ndetx;
}
multi_shm()->numberOfDetector[X] = ndetx;
multi_shm()->numberOfDetector[Y] = ndety;
multi_shm()->numberOfChannels[X] = det_size.x * ndetx;
multi_shm()->numberOfChannels[Y] = det_size.y * ndety;
multi_shm()->numberOfDetector.x = ndetx;
multi_shm()->numberOfDetector.y = ndety;
multi_shm()->numberOfChannels.x = det_size.x * ndetx;
multi_shm()->numberOfChannels.y = det_size.y * ndety;
FILE_LOG(logDEBUG)
<< "\n\tNumber of Detectors in X direction:"
<< multi_shm()->numberOfDetector[X]
<< multi_shm()->numberOfDetector.x
<< "\n\tNumber of Detectors in Y direction:"
<< multi_shm()->numberOfDetector[Y]
<< multi_shm()->numberOfDetector.y
<< "\n\tNumber of Channels in X direction:"
<< multi_shm()->numberOfChannels[X]
<< multi_shm()->numberOfChannels.x
<< "\n\tNumber of Channels in Y direction:"
<< multi_shm()->numberOfChannels[Y];
<< multi_shm()->numberOfChannels.y;
for (auto &d : detectors) {
d->updateMultiSize(multi_shm()->numberOfDetector[0],
multi_shm()->numberOfDetector[1]);
d->updateMultiSize(multi_shm()->numberOfDetector);
}
multi_shm()->maxNumberOfChannels[X] = multi_shm()->numberOfChannels[X];
multi_shm()->maxNumberOfChannels[Y] = multi_shm()->numberOfChannels[Y];
multi_shm()->maxNumberOfChannels = multi_shm()->numberOfChannels;
}
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const {
@ -497,10 +494,7 @@ std::string multiSlsDetector::getDetectorTypeAsString(int detPos) {
size_t multiSlsDetector::size() const { return detectors.size(); }
slsDetectorDefs::xy multiSlsDetector::getNumberOfDetectors() const {
slsDetectorDefs::xy res;
res.x = multi_shm()->numberOfDetector[X];
res.y = multi_shm()->numberOfDetector[Y];
return res;
return multi_shm()->numberOfDetector;
}
slsDetectorDefs::xy multiSlsDetector::getNumberOfChannels(int detPos) {
@ -510,22 +504,15 @@ slsDetectorDefs::xy multiSlsDetector::getNumberOfChannels(int detPos) {
}
// multi
slsDetectorDefs::xy coord;
coord.x = multi_shm()->numberOfChannels[X];
coord.y = multi_shm()->numberOfChannels[Y];
return coord;
return multi_shm()->numberOfChannels;
}
slsDetectorDefs::xy multiSlsDetector::getMaxNumberOfChannels() const {
slsDetectorDefs::xy coord;
coord.x = multi_shm()->maxNumberOfChannels[X];
coord.y = multi_shm()->maxNumberOfChannels[Y];
return coord;
return multi_shm()->maxNumberOfChannels;
}
void multiSlsDetector::setMaxNumberOfChannels(const slsDetectorDefs::xy c) {
multi_shm()->maxNumberOfChannels[X] = c.x;
multi_shm()->maxNumberOfChannels[Y] = c.y;
multi_shm()->maxNumberOfChannels = c;
}
int multiSlsDetector::getQuad(int detPos) {
@ -2140,25 +2127,25 @@ int multiSlsDetector::setDeactivatedRxrPaddingMode(int padding, int detPos) {
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getFlippedData(dimension d, int detPos) {
int multiSlsDetector::getFlippedDataX(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getFlippedData(d);
return detectors[detPos]->getFlippedDataX();
}
// multi
auto r = serialCall(&slsDetector::getFlippedData, d);
auto r = serialCall(&slsDetector::getFlippedDataX);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setFlippedData(dimension d, int value, int detPos) {
int multiSlsDetector::setFlippedDataX(int value, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setFlippedData(d, value);
return detectors[detPos]->setFlippedDataX(value);
}
// multi
auto r = parallelCall(&slsDetector::setFlippedData, d, value);
auto r = parallelCall(&slsDetector::setFlippedDataX, value);
return sls::minusOneIfDifferent(r);
}
@ -2198,11 +2185,11 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
if (val != -1) {
Parallel(&slsDetector::enableGapPixels, {}, val);
Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {});
multi_shm()->numberOfChannels[X] = 0;
multi_shm()->numberOfChannels[Y] = 0;
multi_shm()->numberOfChannels.x = 0;
multi_shm()->numberOfChannels.y = 0;
for (auto &it : res) {
multi_shm()->numberOfChannels[X] += it.x;
multi_shm()->numberOfChannels[Y] += it.y;
multi_shm()->numberOfChannels.x += it.x;
multi_shm()->numberOfChannels.y += it.y;
}
}
return ret;
@ -2211,11 +2198,11 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos){
Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable));
Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {});
multi_shm()->numberOfChannels[X] = 0;
multi_shm()->numberOfChannels[Y] = 0;
multi_shm()->numberOfChannels.x = 0;
multi_shm()->numberOfChannels.y = 0;
for (auto &it : res) {
multi_shm()->numberOfChannels[X] += it.x;
multi_shm()->numberOfChannels[Y] += it.y;
multi_shm()->numberOfChannels.x += it.x;
multi_shm()->numberOfChannels.y += it.y;
}
}
@ -3046,14 +3033,14 @@ void multiSlsDetector::readFrameFromReceiver() {
int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, bool quadEnable) {
// eiger 4 bit mode
int nxb = multi_shm()->numberOfDetector[X] * (512 + 3); //(divided by 2 already)
int nyb = multi_shm()->numberOfDetector[Y] * (256 + 1);
int nxb = multi_shm()->numberOfDetector.x * (512 + 3); //(divided by 2 already)
int nyb = multi_shm()->numberOfDetector.y * (256 + 1);
int nchipInRow = 4;
int nxchip = multi_shm()->numberOfDetector[X] * 4;
int nychip = multi_shm()->numberOfDetector[Y] * 1;
int nxchip = multi_shm()->numberOfDetector.x * 4;
int nychip = multi_shm()->numberOfDetector.y * 1;
if (quadEnable) {
nxb = multi_shm()->numberOfDetector[X] * (256 + 1); //(divided by 2 already)
nyb = multi_shm()->numberOfDetector[Y] * (512 + 2);
nxb = multi_shm()->numberOfDetector.x * (256 + 1); //(divided by 2 already)
nyb = multi_shm()->numberOfDetector.y * (512 + 2);
nxchip /= 2;
nychip *= 2;
nchipInRow /= 2;

View File

@ -308,8 +308,8 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->controlPort = DEFAULT_PORTNO;
sls::strcpy_safe(shm()->hostname, DEFAULT_HOSTNAME);
shm()->myDetectorType = type;
shm()->multiSize[X] = 0;
shm()->multiSize[Y] = 0;
shm()->multiSize.x = 0;
shm()->multiSize.y = 0;
shm()->controlPort = DEFAULT_PORTNO;
shm()->stopPort = DEFAULT_PORTNO + 1;
sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
@ -354,8 +354,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->selectedUDPInterface = 0;
shm()->useReceiverFlag = false;
shm()->tenGigaEnable = 0;
shm()->flippedData[X] = 0;
shm()->flippedData[Y] = 0;
shm()->flippedDataX = 0;
shm()->zmqport = DEFAULT_ZMQ_CL_PORTNO +
(detId * ((shm()->myDetectorType == EIGER) ? 2 : 1));
shm()->rxZmqport = DEFAULT_ZMQ_RX_PORTNO +
@ -401,20 +400,16 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
// get the detector parameters based on type
detParameters parameters{type};
shm()->nChan[X] = parameters.nChanX;
shm()->nChan[Y] = parameters.nChanY;
shm()->nChip[X] = parameters.nChipX;
shm()->nChip[Y] = parameters.nChipY;
shm()->nChan.x = parameters.nChanX;
shm()->nChan.y = parameters.nChanY;
shm()->nChip.x = parameters.nChipX;
shm()->nChip.y = parameters.nChipY;
shm()->nDacs = parameters.nDacs;
shm()->dynamicRange = parameters.dynamicRange;
shm()->nGappixels[X] = parameters.nGappixelsX;
shm()->nGappixels[Y] = parameters.nGappixelsY;
shm()->nGappixels.x = parameters.nGappixelsX;
shm()->nGappixels.y = parameters.nGappixelsY;
// derived parameters
shm()->nChans = shm()->nChan[X] * shm()->nChan[Y];
shm()->nChips = shm()->nChip[X] * shm()->nChip[Y];
// update #nchans, as it depends on #samples, adcmask,
// update #nchan, as it depends on #samples, adcmask,
// readoutflags (ctb only)
updateNumberOfChannels();
}
@ -491,8 +486,7 @@ int slsDetector::receiveModule(sls_detector_module *myMod,
if (shm()->myDetectorType == EIGER) {
ts += client.Receive(myMod->chanregs, sizeof(int) * (myMod->nchan));
FILE_LOG(logDEBUG1)
<< "nchans= " << shm()->nChans << " nchips= " << shm()->nChips
<< "mod - nchans= " << myMod->nchan << " nchips= " << myMod->nchip
<< " nchan= " << myMod->nchan << " nchip= " << myMod->nchip
<< "received chans of size " << ts;
}
FILE_LOG(logDEBUG1) << "received module of size " << ts << " register "
@ -593,15 +587,15 @@ void slsDetector::updateNumberOfChannels() {
ndchans = 64;
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans;
}
shm()->nChans = nachans + ndchans;
FILE_LOG(logDEBUG1) << "# Total #Channels:" << shm()->nChans;
shm()->nChan.x = nachans + ndchans;
FILE_LOG(logDEBUG1) << "# Total #Channels:" << shm()->nChan.x;
}
}
slsDetectorDefs::xy slsDetector::getNumberOfChannels() const {
slsDetectorDefs::xy coord;
coord.x = (shm()->nChan[X] * shm()->nChip[X] + shm()->gappixels * shm()->nGappixels[X]);
coord.y = (shm()->nChan[Y] * shm()->nChip[Y] + shm()->gappixels * shm()->nGappixels[Y]);
coord.x = (shm()->nChan.x * shm()->nChip.x + shm()->gappixels * shm()->nGappixels.x);
coord.y = (shm()->nChan.y * shm()->nChip.y + shm()->gappixels * shm()->nGappixels.y);
return coord;
}
@ -641,9 +635,8 @@ int slsDetector::getReadNLines() {
return retval;
}
void slsDetector::updateMultiSize(int detx, int dety) {
shm()->multiSize[0] = detx;
shm()->multiSize[1] = dety;
void slsDetector::updateMultiSize(slsDetectorDefs::xy det) {
shm()->multiSize = det;
}
@ -831,7 +824,7 @@ void slsDetector::updateCachedDetectorVariables() {
if (shm()->myDetectorType == MOENCH)
setAdditionalJsonParameter("adcmask", std::to_string(u32));
// update #nchans, as it depends on #samples, adcmask,
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
updateNumberOfChannels();
}
@ -1259,7 +1252,7 @@ void slsDetector::configureMAC() {
// 2d positions to detector to put into udp header
{
int pos[2] = {0, 0};
int max = shm()->multiSize[Y] * (shm()->numUDPInterfaces);
int max = shm()->multiSize.y * (shm()->numUDPInterfaces);
// row
pos[0] = (detId % max);
// col for horiz. udp ports
@ -1340,7 +1333,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
sendToDetector(F_SET_TIMER, args, retval);
FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << retval;
shm()->timerValue[index] = retval;
// update #nchans, as it depends on #samples, adcmask,
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
if (index == ANALOG_SAMPLES || index == DIGITAL_SAMPLES) {
updateNumberOfChannels();
@ -1492,7 +1485,7 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
sendToDetector(F_SET_READOUT_FLAGS, arg, retval);
FILE_LOG(logDEBUG1) << "Readout flag: " << retval;
shm()->roFlags = retval;
// update #nchans, as it depends on #samples, adcmask,
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
if (shm()->myDetectorType == CHIPTESTBOARD) {
updateNumberOfChannels();
@ -1677,7 +1670,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
<< "\nasamples:" << (shm()->timerValue[ANALOG_SAMPLES])
<< "\ndsamples:" << (shm()->timerValue[DIGITAL_SAMPLES])
<< "\ndynamic range:" << shm()->dynamicRange
<< "\nflippeddatax:" << (shm()->flippedData[X])
<< "\nflippeddatax:" << (shm()->flippedDataX)
<< "\nactivated: " << shm()->activated
<< "\nreceiver deactivated padding: " << shm()->rxPadDeactivatedModules
<< "\nsilent Mode:" << shm()->rxSilentMode
@ -1719,7 +1712,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
shm()->timerValue[SUBFRAME_ACQUISITION_TIME]);
setTimer(SUBFRAME_DEADTIME, shm()->timerValue[SUBFRAME_DEADTIME]);
setDynamicRange(shm()->dynamicRange);
setFlippedData(X, -1);
setFlippedDataX(-1);
activate(-1);
setDeactivatedRxrPaddingMode(
static_cast<int>(shm()->rxPadDeactivatedModules));
@ -2330,7 +2323,7 @@ void slsDetector::setADCEnableMask(uint32_t mask) {
sendToDetector(F_SET_ADC_ENABLE_MASK, &arg, sizeof(arg), nullptr, 0);
shm()->adcEnableMask = mask;
// update #nchans, as it depends on #samples, adcmask,
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
updateNumberOfChannels();
@ -2477,29 +2470,24 @@ bool slsDetector::setDeactivatedRxrPaddingMode(int padding) {
return shm()->rxPadDeactivatedModules;
}
int slsDetector::getFlippedData(dimension d) const {
return shm()->flippedData[d];
int slsDetector::getFlippedDataX() const {
return shm()->flippedDataX;
}
int slsDetector::setFlippedData(dimension d, int value) {
if (d == Y) {
throw RuntimeError("Flipped across Y axis is not implemented");
}
int slsDetector::setFlippedDataX(int value) {
// replace get with shm value (write to shm right away as it is a det value,
// not rx value)
if (value > -1) {
shm()->flippedData[d] = (value > 0) ? 1 : 0;
shm()->flippedDataX = (value > 0) ? 1 : 0;
}
int args[]{static_cast<int>(d), value};
int retval = -1;
args[1] = shm()->flippedData[d];
FILE_LOG(logDEBUG1) << "Setting flipped data across axis " << d
<< " with value: " << value;
int arg = shm()->flippedDataX;
FILE_LOG(logDEBUG1) << "Setting flipped data across x axis with value: " << arg;
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, args, retval);
sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, retval);
FILE_LOG(logDEBUG1) << "Flipped data:" << retval;
}
return shm()->flippedData[d];
return shm()->flippedDataX;
}
int slsDetector::setAllTrimbits(int val) {
@ -2978,10 +2966,10 @@ void slsDetector::updateCachedReceiverVariables() const {
}
void slsDetector::sendMultiDetectorSize() {
int args[]{shm()->multiSize[0], shm()->multiSize[1]};
int args[]{shm()->multiSize.x, shm()->multiSize.y};
int retval = -1;
FILE_LOG(logDEBUG1) << "Sending multi detector size to receiver: ("
<< shm()->multiSize[0] << "," << shm()->multiSize[1]
<< shm()->multiSize.x << "," << shm()->multiSize.y
<< ")";
if (shm()->useReceiverFlag) {
sendToReceiver(F_SEND_RECEIVER_MULTIDETSIZE, args, retval);

View File

@ -122,13 +122,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer;
++i;
/*! \page test
- <b>flippeddatay [i]</b> enables/disables data being flipped across y axis. 1 enables, 0 disables. Not implemented.
*/
descrToFuncMap[i].m_pFuncName = "flippeddatay";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDetectorSize;
++i;
/* digital test and debugging */
/*! \page test
@ -3304,15 +3297,7 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
if ((!sscanf(args[1], "%d", &val)) || (val != 0 && val != 1))
return std::string("cannot scan flippeddata x mode: must be 0 or 1");
myDet->setFlippedData(X, val, detPos);
}
if (cmd == "flippeddatay") {
return std::string("Not required for this detector\n");
if ((!sscanf(args[1], "%d", &val)) || (val != 0 && val != 1))
return std::string("cannot scan flippeddata y mode: must be 0 or 1");
myDet->setFlippedData(Y, val, detPos);
myDet->setFlippedDataX(val, detPos);
}
if (cmd == "gappixels") {
@ -3341,10 +3326,7 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
} else if (cmd=="quad") {
return std::to_string(myDet->getQuad());
} else if (cmd == "flippeddatax") {
ret = myDet->getFlippedData(X, detPos);
} else if (cmd == "flippeddatay") {
return std::string("Not required for this detector\n");
ret = myDet->getFlippedData(Y, detPos);
ret = myDet->getFlippedDataX(detPos);
} else if (cmd == "gappixels") {
if (detPos >= 0) // only in multi detector level to update number of channels etc.
return std::string("Cannot execute this command from slsDetector level. Please use multiSlsDetector level.\n");
@ -3370,7 +3352,6 @@ std::string slsDetectorCommand::helpDetectorSize(int action) {
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; 0 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;
}
if (action == GET_ACTION || action == HELP_ACTION) {
@ -3379,7 +3360,6 @@ std::string slsDetectorCommand::helpDetectorSize(int action) {
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; 0 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;
}
return os.str();

View File

@ -63,10 +63,10 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
std::string getDetectorHostname() const;
/*
* Get flipped data across 'axis'
* @return if data is flipped across 'axis'
* Get flipped data across x axis
* @return if data is flipped across x axis
*/
int getFlippedData(int axis = 0) const;
int getFlippedDataX() const;
/**
* Get Gap Pixels Enable (eiger specific)
@ -390,10 +390,10 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
void setMultiDetectorSize(const int *size);
/*
* Get flipped data across 'axis'
* @return if data is flipped across 'axis'
* Get flipped data across x axis
* @return if data is flipped across x axis
*/
void setFlippedData(int axis = 0, int enable = -1);
void setFlippedDataX(int enable = -1);
/**
* Set Gap Pixels Enable (eiger specific)

View File

@ -148,16 +148,9 @@ std::string slsReceiverImplementation::getDetectorHostname() const {
return std::string(detHostname);
}
int slsReceiverImplementation::getFlippedData(int axis) const {
int slsReceiverImplementation::getFlippedDataX() const {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
switch(axis) {
case 0:
return flippedDataX;
case 1:
return 0;
default:
return -1;
}
return flippedDataX;
}
bool slsReceiverImplementation::getGapPixelsEnable() const {
@ -482,10 +475,8 @@ void slsReceiverImplementation::setMultiDetectorSize(const int *size) {
FILE_LOG(logINFO) << log_message;
}
void slsReceiverImplementation::setFlippedData(int axis, int enable) {
void slsReceiverImplementation::setFlippedDataX(int enable) {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
if (axis != 0)
return;
flippedDataX = (enable == 0) ? 0 : 1;
if (!quadEnable) {

View File

@ -976,19 +976,18 @@ int slsReceiverTCPIPInterface::set_streaming_timer(Interface &socket) {
int slsReceiverTCPIPInterface::set_flipped_data(Interface &socket) {
// TODO! Why 2 args?
memset(mess, 0, sizeof(mess));
int args[2]{0, -1};
socket.Receive(args);
auto arg = socket.Receive<int>();
if (myDetectorType != EIGER)
functionNotImplemented();
if (args[1] >= 0) {
if (arg >= 0) {
VerifyIdle(socket);
FILE_LOG(logDEBUG1) << "Setting flipped data:" << args[1];
impl()->setFlippedData(args[0], args[1]);
FILE_LOG(logDEBUG1) << "Setting flipped data:" << arg;
impl()->setFlippedDataX(arg);
}
int retval = impl()->getFlippedData(args[0]);
validate(args[1], retval, std::string("set flipped data"), DEC);
int retval = impl()->getFlippedDataX();
validate(arg, retval, std::string("set flipped data"), DEC);
FILE_LOG(logDEBUG1) << "Flipped Data:" << retval;
return socket.sendResult(retval);
}

View File

@ -7,4 +7,4 @@
#define APIGUI 0x190723
#define APIJUNGFRAU 0x190730
#define APIGOTTHARD 0x190813
#define APIEIGER 0x190814
#define APIEIGER 0x190816