mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
Merge branch 'developer' into rxctb
This commit is contained in:
@ -163,10 +163,10 @@ bool multiSlsDetector::isAcquireReady() {
|
||||
FILE_LOG(logWARNING) << "Acquire has already started. "
|
||||
"If previous acquisition terminated unexpectedly, "
|
||||
"reset busy flag to restart.(sls_detector_put busy 0)";
|
||||
return FAIL;
|
||||
return FAIL != 0u;
|
||||
}
|
||||
multi_shm()->acquiringFlag = true;
|
||||
return OK;
|
||||
return OK != 0u;
|
||||
}
|
||||
|
||||
int multiSlsDetector::checkDetectorVersionCompatibility(int detPos) {
|
||||
@ -352,11 +352,11 @@ std::string multiSlsDetector::exec(const char *cmd) {
|
||||
char buffer[bufsize];
|
||||
std::string result = "";
|
||||
FILE *pipe = popen(cmd, "r");
|
||||
if (!pipe) {
|
||||
if (pipe == nullptr) {
|
||||
throw RuntimeError("Could not open pipe");
|
||||
}
|
||||
try {
|
||||
while (!feof(pipe)) {
|
||||
while (feof(pipe) == 0) {
|
||||
if (fgets(buffer, bufsize, pipe) != nullptr) {
|
||||
result += buffer;
|
||||
}
|
||||
@ -379,7 +379,7 @@ void multiSlsDetector::setHostname(const char *name, int detPos) {
|
||||
|
||||
// multi
|
||||
// this check is there only to allow the previous detsizechan command
|
||||
if (multi_shm()->numberOfDetectors) {
|
||||
if (multi_shm()->numberOfDetectors != 0) {
|
||||
FILE_LOG(logWARNING) << "There are already detector(s) in shared memory."
|
||||
"Freeing Shared memory now.";
|
||||
freeSharedMemory();
|
||||
@ -430,7 +430,7 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
||||
multi_shm()->numberOfChannels += detectors[pos]->getTotalNumberOfChannels();
|
||||
|
||||
detectors[pos]->setHostname(hostname);
|
||||
detectors[pos]->setOnline(true);
|
||||
detectors[pos]->setOnline(1);
|
||||
}
|
||||
|
||||
void multiSlsDetector::addSlsDetector(std::unique_ptr<slsDetector> det){
|
||||
@ -800,9 +800,9 @@ int multiSlsDetector::writeConfigurationFile(const std::string &fname) {
|
||||
++iline;
|
||||
|
||||
// single detector configuration
|
||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
||||
for (auto & detector : detectors) {
|
||||
outfile << std::endl;
|
||||
ret1 = detectors[idet]->writeConfigurationFile(outfile, this);
|
||||
ret1 = detector->writeConfigurationFile(outfile, this);
|
||||
if (ret1 == FAIL) {
|
||||
ret = FAIL;
|
||||
}
|
||||
@ -1720,11 +1720,11 @@ int multiSlsDetector::setNumberofUDPInterfaces(int n, int detPos) {
|
||||
auto r = parallelCall(&slsDetector::setNumberofUDPInterfaces,n);
|
||||
|
||||
// redo the zmq sockets
|
||||
if (previouslyClientStreaming) {
|
||||
if (previouslyClientStreaming != 0) {
|
||||
enableDataStreamingToClient(0);
|
||||
enableDataStreamingToClient(1);
|
||||
}
|
||||
if (previouslyReceiverStreaming) {
|
||||
if (previouslyReceiverStreaming != 0) {
|
||||
enableDataStreamingFromReceiver(0);
|
||||
enableDataStreamingFromReceiver(1);
|
||||
}
|
||||
@ -1792,7 +1792,7 @@ void multiSlsDetector::setClientDataStreamingInPort(int i, int detPos) {
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingToClient(0);
|
||||
enableDataStreamingToClient(1);
|
||||
}
|
||||
@ -1832,7 +1832,7 @@ void multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingFromReceiver(0, detPos);
|
||||
enableDataStreamingFromReceiver(1, detPos);
|
||||
}
|
||||
@ -1851,7 +1851,7 @@ int multiSlsDetector::getReceiverStreamingPort(int detPos) {
|
||||
}
|
||||
|
||||
void multiSlsDetector::setClientDataStreamingInIP(const std::string &ip, int detPos) {
|
||||
if (ip.length()) {
|
||||
if (ip.length() != 0u) {
|
||||
int prev_streaming = enableDataStreamingToClient(-1);
|
||||
|
||||
// single
|
||||
@ -1865,7 +1865,7 @@ void multiSlsDetector::setClientDataStreamingInIP(const std::string &ip, int det
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingToClient(0);
|
||||
enableDataStreamingToClient(1);
|
||||
}
|
||||
@ -1884,7 +1884,7 @@ std::string multiSlsDetector::getClientStreamingIP(int detPos) {
|
||||
}
|
||||
|
||||
void multiSlsDetector::setReceiverDataStreamingOutIP(const std::string &ip, int detPos) {
|
||||
if (ip.length()) {
|
||||
if (ip.length() != 0u) {
|
||||
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
|
||||
|
||||
// single
|
||||
@ -1898,7 +1898,7 @@ void multiSlsDetector::setReceiverDataStreamingOutIP(const std::string &ip, int
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingFromReceiver(0, detPos);
|
||||
enableDataStreamingFromReceiver(1, detPos);
|
||||
}
|
||||
@ -1973,7 +1973,7 @@ std::string multiSlsDetector::getAdditionalJsonParameter(const std::string &key,
|
||||
}
|
||||
|
||||
int multiSlsDetector::setDetectorMinMaxEnergyThreshold(const int index, int value, int detPos) {
|
||||
std::string parameter = (index ? "emax" : "emin");
|
||||
std::string parameter = (index != 0 ? "emax" : "emin");
|
||||
|
||||
std::string result;
|
||||
if (value < 0) {
|
||||
@ -2315,8 +2315,8 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
// get each detector's roi array
|
||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
||||
temp = detectors[idet]->getROI(index);
|
||||
if (temp) {
|
||||
if (index) {
|
||||
if (temp != nullptr) {
|
||||
if (index != 0) {
|
||||
FILE_LOG(logINFO) << "detector " << idet << ":";
|
||||
}
|
||||
for (int j = 0; j < index; ++j) {
|
||||
@ -2334,7 +2334,7 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
}
|
||||
|
||||
// empty roi
|
||||
if (!n) {
|
||||
if (n == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -2582,7 +2582,7 @@ int multiSlsDetector::activate(int const enable, int detPos) {
|
||||
int multiSlsDetector::setDeactivatedRxrPaddingMode(int padding, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setDeactivatedRxrPaddingMode(padding);
|
||||
return static_cast<int>(detectors[detPos]->setDeactivatedRxrPaddingMode(padding));
|
||||
}
|
||||
|
||||
// multi
|
||||
@ -3024,14 +3024,14 @@ multiSlsDetector::setReceiverFramesDiscardPolicy(frameDiscardPolicy f, int detPo
|
||||
|
||||
int multiSlsDetector::setPartialFramesPadding(bool padding, int detPos) {
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->setPartialFramesPadding(padding);
|
||||
return static_cast<int>(detectors[detPos]->setPartialFramesPadding(padding));
|
||||
auto r = parallelCall(&slsDetector::setPartialFramesPadding, padding);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getPartialFramesPadding(int detPos) const {
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->getPartialFramesPadding();
|
||||
return static_cast<int>(detectors[detPos]->getPartialFramesPadding());
|
||||
auto r = parallelCall(&slsDetector::getPartialFramesPadding);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
@ -3152,7 +3152,7 @@ int multiSlsDetector::getFramesCaughtByReceiver(int detPos) {
|
||||
auto r = parallelCall(&slsDetector::getFramesCaughtByReceiver);
|
||||
|
||||
// prevent divide by all or do not take avg when -1 for "did not connect"
|
||||
if ((!detectors.size()) || (sls::anyEqualTo(r, -1))) {
|
||||
if ((detectors.empty()) || (sls::anyEqualTo(r, -1))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3170,7 +3170,7 @@ int multiSlsDetector::getReceiverCurrentFrameIndex(int detPos) {
|
||||
auto r = parallelCall(&slsDetector::getReceiverCurrentFrameIndex);
|
||||
|
||||
// prevent divide by all or do not take avg when -1 for "did not connect"
|
||||
if ((!detectors.size()) || (sls::anyEqualTo(r, -1))) {
|
||||
if ((detectors.empty()) || (sls::anyEqualTo(r, -1))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3242,7 +3242,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
if (getDetectorTypeAsEnum() == EIGER) {
|
||||
eiger = true;
|
||||
nX *= 2;
|
||||
gappixelsenable = detectors[0]->enableGapPixels(-1) >= 1 ? true : false;
|
||||
gappixelsenable = detectors[0]->enableGapPixels(-1) > 0;
|
||||
}
|
||||
if (getNumberofUDPInterfaces() == 2) {
|
||||
nY *= 2;
|
||||
@ -3251,7 +3251,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
bool runningList[zmqSocket.size()], connectList[zmqSocket.size()];
|
||||
int numRunning = 0;
|
||||
for (size_t i = 0; i < zmqSocket.size(); ++i) {
|
||||
if (!zmqSocket[i]->Connect()) {
|
||||
if (zmqSocket[i]->Connect() == 0) {
|
||||
connectList[i] = true;
|
||||
runningList[i] = true;
|
||||
++numRunning;
|
||||
@ -3300,8 +3300,8 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
// HEADER
|
||||
{
|
||||
rapidjson::Document doc;
|
||||
if (!zmqSocket[isocket]->ReceiveHeader(isocket, doc,
|
||||
SLS_DETECTOR_JSON_HEADER_VERSION)) {
|
||||
if (zmqSocket[isocket]->ReceiveHeader(isocket, doc,
|
||||
SLS_DETECTOR_JSON_HEADER_VERSION) == 0) {
|
||||
// parse error, version error or end of acquisition for
|
||||
// socket
|
||||
runningList[isocket] = false;
|
||||
@ -3372,7 +3372,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
<< "\n\tsingledetrowoffset: " << singledetrowoffset
|
||||
<< "\n\trowoffset: " << rowoffset;
|
||||
|
||||
if (eiger && flippedDataX) {
|
||||
if (eiger && (flippedDataX != 0u)) {
|
||||
for (uint32_t i = 0; i < nPixelsY; ++i) {
|
||||
memcpy(((char *)multiframe) +
|
||||
((yoffset + (nPixelsY - 1 - i)) * rowoffset) + xoffset,
|
||||
@ -3412,7 +3412,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
}
|
||||
|
||||
// all done
|
||||
if (!numRunning) {
|
||||
if (numRunning == 0) {
|
||||
// let main thread know that all dummy packets have been received
|
||||
//(also from external process),
|
||||
// main thread can now proceed to measurement finished call back
|
||||
@ -3475,7 +3475,7 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage) {
|
||||
memcpy(dst, src, b1chipx);
|
||||
src += b1chipx;
|
||||
dst += b1chipx;
|
||||
if ((col + 1) % 4) {
|
||||
if (((col + 1) % 4) != 0) {
|
||||
++dst;
|
||||
}
|
||||
}
|
||||
@ -3495,7 +3495,7 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage) {
|
||||
dst += b1chipx;
|
||||
mod = (col + 1) % 4;
|
||||
// copy gap pixel(chip 0, 1, 2)
|
||||
if (mod) {
|
||||
if (mod != 0) {
|
||||
// neighbouring gap pixels to left
|
||||
temp = (*((uint8_t *)(dst - 1)));
|
||||
g1 = ((temp & 0xF) / 2);
|
||||
@ -3569,7 +3569,7 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage) {
|
||||
|
||||
int multiSlsDetector::setFileWrite(bool value, int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setFileWrite(value);
|
||||
return static_cast<int>(detectors[detPos]->setFileWrite(value));
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::setFileWrite, value);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3577,7 +3577,7 @@ int multiSlsDetector::setFileWrite(bool value, int detPos) {
|
||||
|
||||
int multiSlsDetector::getFileWrite(int detPos) const{
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getFileWrite();
|
||||
return static_cast<int>(detectors[detPos]->getFileWrite());
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::getFileWrite);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3585,7 +3585,7 @@ int multiSlsDetector::getFileWrite(int detPos) const{
|
||||
|
||||
int multiSlsDetector::setMasterFileWrite(bool value, int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setMasterFileWrite(value);
|
||||
return static_cast<int>(detectors[detPos]->setMasterFileWrite(value));
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::setMasterFileWrite, value);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3593,7 +3593,7 @@ int multiSlsDetector::setMasterFileWrite(bool value, int detPos) {
|
||||
|
||||
int multiSlsDetector::getMasterFileWrite(int detPos) const{
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getMasterFileWrite();
|
||||
return static_cast<int>(detectors[detPos]->getMasterFileWrite());
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::getMasterFileWrite);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3601,7 +3601,7 @@ int multiSlsDetector::getMasterFileWrite(int detPos) const{
|
||||
|
||||
int multiSlsDetector::setFileOverWrite(bool enable, int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setFileOverWrite(enable);
|
||||
return static_cast<int>(detectors[detPos]->setFileOverWrite(enable));
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::setFileOverWrite, enable);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3609,7 +3609,7 @@ int multiSlsDetector::setFileOverWrite(bool enable, int detPos) {
|
||||
|
||||
int multiSlsDetector::getFileOverWrite(int detPos) const {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getFileOverWrite();
|
||||
return static_cast<int>(detectors[detPos]->getFileOverWrite());
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::getFileOverWrite);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
@ -3640,7 +3640,7 @@ int multiSlsDetector::setReceiverStreamingTimer(int time_in_ms, int detPos) {
|
||||
int multiSlsDetector::enableDataStreamingToClient(int enable) {
|
||||
if (enable >= 0) {
|
||||
// destroy data threads
|
||||
if (!enable) {
|
||||
if (enable == 0) {
|
||||
createReceivingDataSockets(true);
|
||||
// create data threads
|
||||
} else {
|
||||
@ -3649,13 +3649,13 @@ int multiSlsDetector::enableDataStreamingToClient(int enable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return client_downstream;
|
||||
return static_cast<int>(client_downstream);
|
||||
}
|
||||
|
||||
int multiSlsDetector::enableDataStreamingFromReceiver(int enable, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->enableDataStreamingFromReceiver(enable);
|
||||
return static_cast<int>(detectors[detPos]->enableDataStreamingFromReceiver(enable));
|
||||
}
|
||||
|
||||
// multi
|
||||
@ -3688,7 +3688,7 @@ int multiSlsDetector::setReceiverFifoDepth(int i, int detPos) {
|
||||
int multiSlsDetector::setReceiverSilentMode(int i, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setReceiverSilentMode(i);
|
||||
return static_cast<int>(detectors[detPos]->setReceiverSilentMode(i));
|
||||
}
|
||||
|
||||
// multi
|
||||
@ -3707,7 +3707,7 @@ int multiSlsDetector::setPattern(const std::string &fname, int detPos) {
|
||||
} else {
|
||||
int addr{0};
|
||||
uint64_t word{0};
|
||||
while (fread(&word, sizeof(word), 1, fd)) {
|
||||
while (fread(&word, sizeof(word), 1, fd) != 0u) {
|
||||
serialCall(&slsDetector::setPatternWord, addr, word);
|
||||
++addr;
|
||||
}
|
||||
@ -4072,7 +4072,7 @@ void multiSlsDetector::registerDataCallback(int (*userCallback)(detectorData *,
|
||||
int multiSlsDetector::setTotalProgress() {
|
||||
int nf = 1, nc = 1, ns = 1, nm = 1;
|
||||
|
||||
if (multi_shm()->timerValue[FRAME_NUMBER]) {
|
||||
if (multi_shm()->timerValue[FRAME_NUMBER] != 0) {
|
||||
nf = multi_shm()->timerValue[FRAME_NUMBER];
|
||||
}
|
||||
|
||||
@ -4118,7 +4118,7 @@ void multiSlsDetector::setCurrentProgress(int i) {
|
||||
|
||||
int multiSlsDetector::acquire() {
|
||||
// ensure acquire isnt started multiple times by same client
|
||||
if (isAcquireReady() == FAIL) {
|
||||
if (static_cast<int>(isAcquireReady()) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -4165,7 +4165,7 @@ int multiSlsDetector::acquire() {
|
||||
|
||||
// loop through measurements
|
||||
for (int im = 0; im < nm; ++im) {
|
||||
if (multi_shm()->stoppedFlag) {
|
||||
if (multi_shm()->stoppedFlag != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4190,7 +4190,7 @@ int multiSlsDetector::acquire() {
|
||||
if (stopReceiver() == FAIL) {
|
||||
multi_shm()->stoppedFlag = 1;
|
||||
} else {
|
||||
if (dataReady) {
|
||||
if (dataReady != nullptr) {
|
||||
sem_wait(&sem_endRTAcquisition); // waits for receiver's
|
||||
}
|
||||
// external process to be
|
||||
@ -4200,10 +4200,10 @@ int multiSlsDetector::acquire() {
|
||||
int findex = 0;
|
||||
findex = incrementFileIndex();
|
||||
|
||||
if (measurement_finished) {
|
||||
if (measurement_finished != nullptr) {
|
||||
measurement_finished(im, findex, measFinished_p);
|
||||
}
|
||||
if (multi_shm()->stoppedFlag) {
|
||||
if (multi_shm()->stoppedFlag != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4214,11 +4214,11 @@ int multiSlsDetector::acquire() {
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
dataProcessingThread.join();
|
||||
|
||||
if (progress_call) {
|
||||
if (progress_call != nullptr) {
|
||||
progress_call(getCurrentProgress(), pProgressCallArg);
|
||||
}
|
||||
|
||||
if (acquisition_finished) {
|
||||
if (acquisition_finished != nullptr) {
|
||||
acquisition_finished(getCurrentProgress(), getRunStatus(), acqFinished_p);
|
||||
}
|
||||
|
||||
@ -4246,7 +4246,7 @@ void multiSlsDetector::processData() {
|
||||
if (setReceiverOnline() == OFFLINE_FLAG) {
|
||||
return;
|
||||
} else {
|
||||
if (dataReady) {
|
||||
if (dataReady != nullptr) {
|
||||
readFrameFromReceiver();
|
||||
}
|
||||
// only update progress
|
||||
@ -4278,7 +4278,6 @@ void multiSlsDetector::processData() {
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool multiSlsDetector::getJoinThreadFlag() const {
|
||||
@ -4310,7 +4309,7 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
// check if it exists
|
||||
|
||||
struct stat st;
|
||||
if (stat(fname.c_str(), &st)) {
|
||||
if (stat(fname.c_str(), &st) != 0) {
|
||||
throw RuntimeError("Program FPGA: Programming file does not exist");
|
||||
}
|
||||
|
||||
@ -4364,10 +4363,10 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
throw RuntimeError("Could not convert programming file. EOF before end of flash");
|
||||
}
|
||||
}
|
||||
if (fclose(src)) {
|
||||
if (fclose(src) != 0) {
|
||||
throw RuntimeError("Program FPGA: Could not close source file");
|
||||
}
|
||||
if (close(dst)) {
|
||||
if (close(dst) != 0) {
|
||||
throw RuntimeError("Program FPGA: Could not close destination file");
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "File has been converted to " << destfname;
|
||||
@ -4377,7 +4376,7 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
if (fp == nullptr) {
|
||||
throw RuntimeError("Program FPGA: Could not open rawbin file");
|
||||
}
|
||||
if (fseek(fp, 0, SEEK_END)) {
|
||||
if (fseek(fp, 0, SEEK_END) != 0) {
|
||||
throw RuntimeError("Program FPGA: Seek error in rawbin file");
|
||||
}
|
||||
filesize = ftell(fp);
|
||||
@ -4391,7 +4390,7 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
throw RuntimeError("Program FPGA: Could not read rawbin file");
|
||||
}
|
||||
|
||||
if (fclose(fp)) {
|
||||
if (fclose(fp) != 0) {
|
||||
throw RuntimeError("Program FPGA: Could not close destination file after converting");
|
||||
}
|
||||
unlink(destfname); // delete temporary file
|
||||
|
@ -590,13 +590,13 @@ void slsDetector::updateTotalNumberOfChannels() {
|
||||
int adatabytes = 0, ddatabytes = 0;
|
||||
// analog channels (normal, analog/digital readout)
|
||||
if (shm()->roFlags == slsDetectorDefs::NORMAL_READOUT ||
|
||||
shm()->roFlags & slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
((shm()->roFlags & slsDetectorDefs::ANALOG_AND_DIGITAL) != 0)) {
|
||||
uint32_t mask = shm()->adcEnableMask;
|
||||
if (mask == BIT32_MASK) {
|
||||
nachans = 32;
|
||||
} else {
|
||||
for (int ich = 0; ich < 32; ++ich) {
|
||||
if (mask & (1 << ich))
|
||||
if ((mask & (1 << ich)) != 0u)
|
||||
++nachans;
|
||||
}
|
||||
}
|
||||
@ -608,7 +608,7 @@ void slsDetector::updateTotalNumberOfChannels() {
|
||||
|
||||
// digital channels (ctb only, digital, analog/digital readout)
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD &&
|
||||
((shm()->roFlags & DIGITAL_ONLY) || (shm()->roFlags & ANALOG_AND_DIGITAL))) {
|
||||
(((shm()->roFlags & DIGITAL_ONLY) != 0) || ((shm()->roFlags & ANALOG_AND_DIGITAL) != 0))) {
|
||||
ndchans = 64;
|
||||
ddatabytes = (sizeof(uint64_t) * shm()->timerValue[DIGITAL_SAMPLES]);
|
||||
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans
|
||||
@ -1481,10 +1481,10 @@ int slsDetector::configureMAC() {
|
||||
ret = client.sendCommandThenRead(fnum, args, sizeof(args), retvals,
|
||||
sizeof(retvals));
|
||||
|
||||
//TODO!(Erik) Send as int already from detector
|
||||
uint64_t detector_mac = 0;
|
||||
uint32_t detector_ip = 0;
|
||||
sscanf(retvals[0], "%lx",
|
||||
&detector_mac); // TODO! (Erik) send mac and ip as int
|
||||
sscanf(retvals[0], "%lx", &detector_mac);
|
||||
sscanf(retvals[1], "%x", &detector_ip);
|
||||
detector_ip = __builtin_bswap32(detector_ip);
|
||||
|
||||
@ -3114,7 +3114,7 @@ int slsDetector::resetFPGA() {
|
||||
|
||||
int slsDetector::copyDetectorServer(const std::string &fname,
|
||||
const std::string &hostname) {
|
||||
char args[][MAX_STR_LENGTH]{};
|
||||
char args[2][MAX_STR_LENGTH]{};
|
||||
sls::strcpy_safe(args[0], fname.c_str());
|
||||
sls::strcpy_safe(args[1], hostname.c_str());
|
||||
FILE_LOG(logINFO) << "Sending detector server " << args[0] << " from host "
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
/*! \mainpage Introduction
|
||||
/*! \page CLI Command line interface
|
||||
|
||||
|
||||
This program is intended to control the SLS detectors via command line interface.
|
||||
This is the only way to access all possible functionality of the detectors, however it is often recommendable to avoid changing the most advanced settings, rather leaving the task to configuration files, as when using the GUI or the API provided.
|
||||
@ -55,16 +56,16 @@ the same multi detector id for both detectors as they have a different shared me
|
||||
For additional questions concerning the indexing of the detector, please refer to the SLS Detectors FAQ documentation.
|
||||
|
||||
The commands are sudivided into different pages depending on their functionalities:
|
||||
- \ref acquisition "Acquisition": commands to start/stop the acquisition and retrieve data
|
||||
- \ref config "Configuration": commands to configure the detector
|
||||
- \ref timing "Timing": commands to configure the detector timing
|
||||
- \ref data "Data postprocessing": commands to process the data
|
||||
- \ref settings "Settings": commands to define detector settings/threshold.
|
||||
- \ref output "Output": commands to define output file destination and format
|
||||
- \ref network "Network": commands to setup the network between client, detector and receiver
|
||||
- \ref receiver "Receiver": commands to configure the receiver
|
||||
- \ref prototype "Chip Test Board / Moench": commands specific for the chiptest board or moench
|
||||
- \ref test "Developer": commands to be used only for software debugging. Avoid using them!
|
||||
- \subpage acquisition "Acquisition": commands to start/stop the acquisition and retrieve data
|
||||
- \subpage config "Configuration": commands to configure the detector
|
||||
- \subpage timing "Timing": commands to configure the detector timing
|
||||
- \subpage data "Data postprocessing": commands to process the data
|
||||
- \subpage settings "Settings": commands to define detector settings/threshold.
|
||||
- \subpage output "Output": commands to define output file destination and format
|
||||
- \subpage network "Network": commands to setup the network between client, detector and receiver
|
||||
- \subpage receiver "Receiver": commands to configure the receiver
|
||||
- \subpage prototype "Chip Test Board / Moench": commands specific for the chiptest board or moench
|
||||
- \subpage test "Developer": commands to be used only for software debugging. Avoid using them!
|
||||
|
||||
*/
|
||||
|
||||
@ -2159,11 +2160,6 @@ std::string slsDetectorCommand::executeLine(int narg, char *args[], int action,
|
||||
return cmdUnknown(narg, args, action, detPos);
|
||||
}
|
||||
|
||||
/*! \page advanced Advanced Usage
|
||||
This page is for advanced users.
|
||||
Make sure you have first read \ref intro "the introduction".
|
||||
*/
|
||||
|
||||
std::string slsDetectorCommand::cmdUnknown(int narg, char *args[], int action, int detPos) {
|
||||
return std::string("Unknown command ") + std::string(args[0]) + std::string("\n") + helpLine(0, args, action, detPos);
|
||||
}
|
||||
|
Reference in New Issue
Block a user