Merge branch 'refactor' of github.com:slsdetectorgroup/slsDetectorPackage into refactor

This commit is contained in:
Erik Frojdh
2018-10-30 14:46:19 +01:00
84 changed files with 8252 additions and 14747 deletions

View File

@ -8,6 +8,8 @@
#include "slsDetector.h"
#include "sls_detector_exceptions.h"
#include "utilities.h"
#include "detectorData.h"
#include <iomanip>
#include <iostream>
@ -2107,19 +2109,9 @@ int multiSlsDetector::writeAdcRegister(int addr, int val, int detPos) {
return detectors[detPos]->writeAdcRegister(addr, val);
}
// multi
auto r = parallelCall(&slsDetector::writeAdcRegister, addr, val);
if (sls::allEqual(r))
return r.front();
// can't have different values
FILE_LOG(logERROR)
<< "Error: Different Values for function writeAdcRegister "
"(write 0x"
<< std::hex << val << " to addr 0x" << std::hex << addr << std::dec
<< ")";
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
return -1;
// multi
auto r = parallelCall(&slsDetector::writeAdcRegister, addr, val);
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
}
int multiSlsDetector::activate(int const enable, int detPos) {
@ -2356,62 +2348,50 @@ int multiSlsDetector::setAutoComparatorDisableMode(int ival, int detPos) {
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::getChanRegs(double *retval, bool fromDetector,
int detPos) {
int multiSlsDetector::getChanRegs(double* retval, int detPos) {
int offset = 0;
std::vector<int> r;
for (auto &d : detectors) {
int nch = d->getTotalNumberOfChannels();
double result[nch];
r.push_back(d->getChanRegs(result, fromDetector));
memcpy(retval + offset, result, nch * sizeof(double));
}
return sls::minusOneIfDifferent(r);
int offset = 0;
std::vector<int> r;
for (auto& d : detectors) {
int nch = d->getTotalNumberOfChannels();
double result[nch];
r.push_back(d->getChanRegs(result));
memcpy(retval + offset, result, nch * sizeof(double));
}
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::calibratePedestal(int frames, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->calibratePedestal(frames);
}
// multi
auto r = parallelCall(&slsDetector::calibratePedestal, frames);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setRateCorrection(int t, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setRateCorrection(t);
}
int multiSlsDetector::setRateCorrection(int64_t t, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setRateCorrection(t);
}
// multi
auto r = parallelCall(&slsDetector::setRateCorrection, t);
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
}
int multiSlsDetector::getRateCorrection(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getRateCorrection();
}
int64_t multiSlsDetector::getRateCorrection(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getRateCorrection();
}
// multi
auto r = parallelCall(&slsDetector::getRateCorrection);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::printReceiverConfiguration(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->printReceiverConfiguration();
}
void multiSlsDetector::printReceiverConfiguration(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->printReceiverConfiguration();
}
// multi
auto r = parallelCall(&slsDetector::printReceiverConfiguration);
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
// multi
for (auto& d : detectors)
d->printReceiverConfiguration();
}
int multiSlsDetector::setReceiverOnline(int off, int detPos) {
@ -3768,4 +3748,4 @@ bool multiSlsDetector::isDetectorIndexOutOfBounds(int detPos) {
return true;
}
return false;
}
}

View File

@ -7,9 +7,10 @@
* @short This is the base class for multi detector system functionalities
* @author Anna Bergamaschi
*/
#include "error_defs.h"
#include "sls_detector_defs.h"
#include "error_defs.h"
#include "logger.h"
class slsDetector;
class SharedMemory;
@ -230,21 +231,6 @@ class multiSlsDetector : public virtual slsDetectorDefs,
*/
int64_t getId(idMode mode, int detPos = -1);
/**
* Get sls detector object from position in detectors array
* @param detPos -1 for all detectors in list or specific detector position
* @returns pointer to sls detector object
*/
// slsDetector* getSlsDetector(int detPos = -1);
/**
* Accessing the sls detector from the multi list using position
* @param detPos -1 for all detectors in list or specific detector position
* @returns slsDetector object
*/
// slsDetector *operator()(int detPos = -1) const;
// slsDetector* operator[](int detPos) const;
/**
* Free shared memory from the command line
* avoiding creating the constructor classes and mapping
@ -1192,48 +1178,36 @@ class multiSlsDetector : public virtual slsDetectorDefs,
*/
int setAutoComparatorDisableMode(int ival = -1, int detPos = -1);
/**
* Returns the trimbits from the detector's shared memmory (Mythen, Eiger)
* @param retval is the array with the trimbits
* @param fromDetector is true if the trimbits shared memory have to be
* uploaded from detector
* @param detPos -1 for all detectors in list or specific detector position
* @returns total number of channels for the detector
*/
int getChanRegs(double *retval, bool fromDetector, int detPos = -1);
/**
* Returns the trimbits from the detector's shared memmory (Mythen, Eiger)
* @param retval is the array with the trimbits
* @param detPos -1 for all detectors in list or specific detector position
* @returns total number of channels for the detector
*/
int getChanRegs(double* retval, int detPos = -1);
/**
* Calibrate Pedestal (ChipTestBoard)
* Starts acquisition, calibrates pedestal and writes to fpga
* @param frames number of frames
* @param detPos -1 for all detectors in list or specific detector position
* @returns number of frames
*/
int calibratePedestal(int frames = 0, int detPos = -1);
/**
* Set Rate correction ( Eiger)
* @param t dead time in ns - if 0 disable correction,
* if >0 set dead time to t, if < 0 set deadtime to default dead time
* for current settings
* @param detPos -1 for all detectors in list or specific detector position
* @returns 0 if rate correction disabled, >0 otherwise
*/
int setRateCorrection(int64_t t = 0, int detPos = -1);
/**
* Set Rate correction ( Eiger)
* @param t dead time in ns - if 0 disable correction,
* if >0 set dead time to t, if < 0 set deadtime to default dead time
* for current settings
* @param detPos -1 for all detectors in list or specific detector position
* @returns 0 if rate correction disabled, >0 otherwise
*/
int setRateCorrection(int t = 0, int detPos = -1);
/**
* Get rate correction ( Eiger)
* @param detPos -1 for all detectors in list or specific detector position
* @returns 0 if rate correction disabled, > 0 otherwise (ns)
*/
int64_t getRateCorrection(int detPos = -1);
/**
* Get rate correction ( Eiger)
* @param detPos -1 for all detectors in list or specific detector position
* @returns 0 if rate correction disabled, > 0 otherwise (ns)
*/
int getRateCorrection(int detPos = -1);
/**
* Prints receiver configuration
* @param detPos -1 for all detectors in list or specific detector position
* @returns OK or FAIL
*/
int printReceiverConfiguration(int detPos = -1);
/**
* Prints receiver configuration
* @param detPos -1 for all detectors in list or specific detector position
*/
void printReceiverConfiguration(int detPos = -1);
/**
* Sets up receiver socket if online and sets the flag

View File

@ -1,6 +1,7 @@
#include "SharedMemory.h"
#include "sls_detector_exceptions.h"
#include "ansi.h"
#include "logger.h"
#include <iostream>
#include <stdio.h> // printf
@ -51,15 +52,13 @@ void* SharedMemory::CreateSharedMemory(size_t sz){
// create
fd = shm_open(name.c_str(), O_CREAT | O_TRUNC | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
if (fd < 0) {
cprintf(RED, "Error: Create shared memory %s failed: %s\n",
name.c_str(), strerror(errno));
FILE_LOG(logERROR) << "Create shared memory " << name << " failed: " << strerror(errno);
throw SharedMemoryException();
}
// resize
if (ftruncate(fd, sz) < 0) {
cprintf(RED, "Error: Create shared memory %s failed at ftruncate: %s\n",
name.c_str(), strerror(errno));
FILE_LOG(logERROR) << "Create shared memory " << name << " failed at ftruncate: " << strerror(errno);
close(fd);
RemoveSharedMemory();
throw SharedMemoryException();
@ -67,7 +66,7 @@ void* SharedMemory::CreateSharedMemory(size_t sz){
// map
void* addr = MapSharedMemory(sz);
printf("Shared memory created %s \n", name.c_str());
FILE_LOG(logINFO) << "Shared memory created " << name;
return addr;
}
@ -75,8 +74,7 @@ void* SharedMemory::OpenSharedMemory(size_t sz){
// open
fd = shm_open(name.c_str(), O_RDWR, 0);
if (fd < 0) {
cprintf(RED, "Error: Open existing shared memory %s failed: %s\n",
name.c_str(), strerror(errno));
FILE_LOG(logERROR) << "Open existing shared memory " << name << " failed: " << strerror(errno);
throw SharedMemoryException();
}
@ -86,8 +84,7 @@ void* SharedMemory::OpenSharedMemory(size_t sz){
void SharedMemory::UnmapSharedMemory(void* addr) {
if (munmap(addr, shmSize) < 0) {
cprintf(RED, "Error: Unmapping shared memory %s failed: %s\n",
name.c_str(), strerror(errno));
FILE_LOG(logERROR) << "Unmapping shared memory " << name << " failed: " << strerror(errno);
close(fd);
throw SharedMemoryException();
}
@ -98,19 +95,17 @@ void SharedMemory::RemoveSharedMemory() {
// silent exit if shm did not exist anyway
if (errno == ENOENT)
return;
cprintf(RED, "Error: Free Shared Memory %s Failed: %s\n",
name.c_str(), strerror(errno));
FILE_LOG(logERROR) << "Free Shared Memory " << name << " Failed: " << strerror(errno);
throw SharedMemoryException();
}
printf("Shared memory deleted %s \n", name.c_str());
FILE_LOG(logINFO) << "Shared memory deleted " << name;
}
void* SharedMemory::MapSharedMemory(size_t sz) {
void* addr = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (addr == MAP_FAILED) {
cprintf(RED, "Error: Mapping shared memory %s failed: %s\n",
name.c_str(), strerror(errno));
FILE_LOG(logERROR) << "Mapping shared memory " << name << " failed: " << strerror(errno);
close(fd);
throw SharedMemoryException();
}
@ -138,10 +133,9 @@ std::string SharedMemory::ConstructSharedMemoryName(int multiId, int slsId) {
std::string temp = ss.str();
if (temp.length() > NAME_MAX) {
cprintf(RED, "Error: Shared memory initialization failed. "
"%s has %lu characters. \n"
"Maximum is %d. Change the environment variable %s\n",
temp.c_str(), temp.length(), NAME_MAX, SHM_ENV_NAME);
FILE_LOG(logERROR) << "Shared memory initialization failed. " <<
temp << " has " << temp.length() << " characters. \n"
"Maximum is " << NAME_MAX << ". Change the environment variable " << SHM_ENV_NAME;
throw SharedMemoryException();
}
return temp;
@ -152,8 +146,8 @@ int SharedMemory::VerifySizeMatch(size_t expectedSize) {
struct stat sb;
// could not fstat
if (fstat(fd, &sb) < 0) {
cprintf(RED, "Error: Could not verify existing shared memory %s size match "
"(could not fstat): %s\n", name.c_str(), strerror(errno));
FILE_LOG(logERROR) << "Could not verify existing shared memory " << name << " size match "
"(could not fstat): " << strerror(errno);
close(fd);
throw SharedMemoryException();
}
@ -161,11 +155,8 @@ int SharedMemory::VerifySizeMatch(size_t expectedSize) {
//size does not match
long unsigned int sz = (long unsigned int)sb.st_size;
if (sz != expectedSize) {
cprintf(RED, "Warning: Existing shared memory %s size does not match.\n",
name.c_str());
#ifdef VERBOSE
cprintf(RED, " Expected %ld, found %ld\n", expectedSize, sz);
#endif
FILE_LOG(logERROR) << "Existing shared memory " << name << " size does not match";
FILE_LOG(logDEBUG1) << "Expected " << expectedSize << ", found " << sz;
throw SharedMemoryException();
return 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,8 @@
#include "sls_detector_defs.h"
#include "error_defs.h"
#include "logger.h"
#include "math.h"
class multiSlsDetector;
@ -32,8 +34,6 @@ typedef struct detParameterList {
int nChipY;
int nDacs;
int nAdcs;
int nGain;
int nOffset;
int dynamicRange;
int nGappixelsX;
int nGappixelsY;
@ -112,12 +112,6 @@ private:
/** number of adcs per module */
int nAdcs;
/** number of extra gain values*/
int nGain;
/** number of extra offset values */
int nOffset;
/** dynamic range of the detector data */
int dynamicRange;
@ -158,18 +152,9 @@ private:
/** memory offsets for the adc arrays */
int adcoff;
/** memory offsets for the chip register arrays */
int chipoff;
/** memory offsets for the channel register arrays -trimbits*/
int chanoff;
/** memory offsets for the gain register arrays */
int gainoff;
/** memory offsets for the offset register arrays -trimbits*/
int offsetoff;
/** ip address/hostname of the receiver for client control via TCP */
char receiver_hostname[MAX_STR_LENGTH];
@ -622,12 +607,10 @@ public:
* Writes a trim/settings file for module number
* the values will be read from the current detector structure
* @param fname name of the file to be written
* @param iodelay io delay (detector specific)
* @param tau tau (detector specific)
* @returns OK or FAIL if the file could not be written
* \sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
*/
int writeSettingsFile(std::string fname, int iodelay, int tau);
int writeSettingsFile(std::string fname);
/**
* Get detector settings
@ -1073,11 +1056,11 @@ public:
/**
* Gets counter memory block in detector (Gotthard)
* @param arg counter memory block from detector
* @param image counter memory block from detector
* @param startACQ 1 to start acquisition afterwards, else 0
* @returns OK or FAIL
*/
int getCounterBlock(short int arg[],int startACQ=0);
int getCounterBlock(short int image[],int startACQ=0);
/**
* Resets counter in detector
@ -1276,30 +1259,22 @@ public:
/**
* Returns the trimbits from the detector's shared memmory (Mythen, Eiger)
* Returns the trimbits from the detector's shared memmory (Eiger)
* @param retval is the array with the trimbits
* @param fromDetector is true if the trimbits shared memory have to be
* uploaded from detector
* @returns total number of channels for the detector
*/
int getChanRegs(double* retval,bool fromDetector);
int getChanRegs(double* retval);
/**
* Configure Module (Eiger)
* Called for loading trimbits and settings settings to the detector
* @param module module to be set - must contain correct module number and
* also channel and chip registers
* @param iodelay iodelay (detector specific)
* @param tau tau (detector specific)
* @param e_eV threashold in eV (detector specific)
* @param gainval pointer to extra gain values
* @param offsetval pointer to extra offset values
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
* @returns current register value
* @returns ok or fail
* \sa ::sls_detector_module
*/
int setModule(sls_detector_module module, int iodelay, int tau, int e_eV,
int* gainval=0, int* offsetval=0, int tb=1);
int setModule(sls_detector_module module, int tb = 1);
/**
@ -1308,14 +1283,6 @@ public:
*/
sls_detector_module *getModule();
/**
* Calibrate Pedestal (ChipTestBoard)
* Starts acquisition, calibrates pedestal and writes to fpga
* @param frames number of frames
* @returns number of frames
*/
int calibratePedestal(int frames = 0);
/**
* Set Rate correction (Mythen, Eiger)
* @param t dead time in ns - if 0 disable correction,
@ -1323,19 +1290,19 @@ public:
* for current settings
* @returns 0 if rate correction disabled, >0 otherwise
*/
int setRateCorrection(int t=0);
int setRateCorrection(int64_t t = 0);
/**
* Get rate correction Eiger)
* @returns 0 if rate correction disabled, > 0 otherwise
*/
int getRateCorrection();
int64_t getRateCorrection();
/**
* Prints receiver configuration
* @returns OK or FAIL
* #param level print level
*/
int printReceiverConfiguration();
void printReceiverConfiguration(TLogLevel level = logINFO);
/**
* Checks if receiver is online and set flag
@ -1521,12 +1488,6 @@ public:
*/
int getFramesCaughtByReceiver();
/**
* Gets the number of frames caught by any one receiver (to avoid using threadpool)
* @returns number of frames caught by any one receiver (master receiver if exists)
*/
int getFramesCaughtByAnyReceiver();
/**
* Gets the current frame index of receiver
* @returns current frame index of receiver
@ -1573,13 +1534,6 @@ public:
*/
int setReceiverStreamingTimer(int time_in_ms=500);
/**
* Enable data streaming to client
* @param enable 0 to disable, 1 to enable, -1 to get the value
* @returns data streaming to client enable
*/
int enableDataStreamingToClient(int enable=-1);
/**
* Enable or disable streaming data from receiver to client
* @param enable 0 to disable 1 to enable -1 to only get the value
@ -1796,42 +1750,6 @@ private:
*/
int setUDPConnection();
/**
* reads a calibration file
* @param fname file to be read
* @param gain reference to the gain variable
* @param offset reference to the offset variable
* @returns OK if successful, else FAIL or -1
*/
static int readCalibrationFile(std::string fname, double &gain, double &offset);
/**
* writes a calibration file
* @param fname file to be written
* @param gain
* @param offset
* @returns OK if successful, else FAIL or -1
*/
static int writeCalibrationFile(std::string fname, double gain, double offset);
/**
* reads a calibration file
* @param fname file to be read
* @param gain reference to the gain variable
* @param offset reference to the offset variable
* @returns OK if successful, else FAIL or -1
*/
static int readCalibrationFile(std::string fname, int *gain, int *offset);
/**
* writes a calibration file
* @param fname file to be written
* @param gain reference to the gain variable
* @param offset reference to the offset variable
* @returns OK if successful, else FAIL or -1
*/
static int writeCalibrationFile(std::string fname, int *gain, int *offset);
/*
* Template function to do linear interpolation between two points (Eiger only)
*/
@ -1860,28 +1778,21 @@ private:
/**
* reads a trim/settings file
* @param fname name of the file to be read
* @param iodelay io delay (detector specific)
* @param tau tau (detector specific)
* @param myMod pointer to the module structure which has to be set. <BR>
* If it is NULL a new module structure will be created
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
* @returns the pointer to myMod or NULL if reading the file failed
*/
sls_detector_module* readSettingsFile(std::string fname,
int& iodelay, int& tau,
sls_detector_module* myMod=NULL, int tb=1);
sls_detector_module* readSettingsFile(std::string fname, sls_detector_module* myMod=NULL, int tb=1);
/**
* writes a trim/settings file
* @param fname name of the file to be written
* @param mod module structure which has to be written to file
* @param iodelay io delay (detector specific)
* @param tau tau (detector specific)
* @returns OK or FAIL if the file could not be written
*/
int writeSettingsFile(std::string fname,
sls_detector_module mod, int iodelay, int tau);
int writeSettingsFile(std::string fname, sls_detector_module mod);
/** slsDetector Id or position in the detectors list */
@ -1893,6 +1804,12 @@ private:
/** Shared memory structure */
sharedSlsDetector *thisDetector;
/** control socket interface */
ClientInterface *thisDetectorControl;
/** stop socket interface */
ClientInterface *thisDetectorStop;
/** receiver interface */
ClientInterface *thisReceiver;
@ -1914,17 +1831,8 @@ private:
/** pointer to adc valuse in shared memory */
int *adcs;
/** pointer to chip registers in shared memory */
int *chipregs;
/** pointer to channal registers in shared memory */
int *chanregs;
/** pointer to gain values in shared memory */
int *gain;
/** pointer to offset values in shared memory */
int *offset;
};
#endif

View File

@ -143,6 +143,13 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
++i;
/*! \page test
- <b>firmwaretest</b> performs the firmware test. Cannot set! Jungfrau only. Only get!
*/
descrToFuncMap[i].m_pFuncName="firmwaretest"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
++i;
/*! \page test
- <b>reg [addr] [val]</b> ??? writes to an register \c addr with \c value in hexadecimal format.
*/
@ -917,14 +924,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
++i;
/*! \page settings
- <b>pedestal [i]</b> starts acquisition for i frames, calculates pedestal and writes back to fpga. Used in GOTTHARD only. Only put! \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="pedestal"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
++i;
/* pots */
/*! \page settings
@ -2155,7 +2154,7 @@ string slsDetectorCommand::cmdData(int narg, char *args[], int action, int detPo
#ifdef VERBOSE
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
#endif
int b;
//int b;
if (action==PUT_ACTION) {
return string("cannot set");
} else if (action==HELP_ACTION) {
@ -2718,16 +2717,16 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action, int d
if (action==HELP_ACTION) {
return helpRateCorr(action);
}
int fval;
int64_t ival;
char answer[1000];
myDet->setOnline(ONLINE_FLAG, detPos);
if (action==PUT_ACTION) {
sscanf(args[1],"%d",&fval);
myDet->setRateCorrection(fval, detPos);
sscanf(args[1], "%ld",&ival);
myDet->setRateCorrection(ival, detPos);
}
sprintf(answer,"%d",myDet->getRateCorrection(detPos));
sprintf(answer,"%ld",myDet->getRateCorrection(detPos));
return string(answer);
}
@ -3542,15 +3541,6 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action, int d
}
sprintf(ans,"%d",myDet->setAllTrimbits(-1, detPos));
return ans;
} else if (cmd=="pedestal") {
if (action==GET_ACTION)
return string("cannot get");
if (sscanf(args[1],"%d",&val)){
sprintf(ans,"%d",myDet->calibratePedestal(val, detPos));
return string(ans);
}else
return string("cannot parse frame number")+cmd;
}
return string("unknown settings command ")+cmd;
@ -3567,8 +3557,6 @@ string slsDetectorCommand::helpSettings(int action) {
os << "thresholdnotb eV [sett]\n sets the detector threshold in eV without loading trimbits. If sett is provided for eiger, uses settings sett"<< std::endl;
os << "trimbits fname\n loads the trimfile fname to the detector. If no extension is specified, the serial number of each module will be attached."<< std::endl;
os << "trimval i \n sets all the trimbits to i" << std::endl;
os << "pedestal i \n starts acquisition for i frames, calculates pedestal and writes back to fpga."<< std::endl;
}
if (action==GET_ACTION || action==HELP_ACTION) {
os << "settings \n gets the settings of the detector"<< std::endl;
@ -3706,7 +3694,14 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action, int d
if (cmd=="bustest"){
if (action==PUT_ACTION)
return string("cannot set ")+cmd;
sprintf(answer,"0x%x",myDet->digitalTest(DETECTOR_BUS_TEST));
sprintf(answer,"%d",myDet->digitalTest(DETECTOR_BUS_TEST));
return string(answer);
}
else if (cmd=="firmwaretest"){
if (action==PUT_ACTION)
return string("cannot set ")+cmd;
sprintf(answer,"%d",myDet->digitalTest(DETECTOR_FIRMWARE_TEST));
return string(answer);
}
@ -3716,7 +3711,7 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action, int d
int ival=-1;
if (sscanf(args[1],"%d",&ival)) {
if((ival==0)||(ival==1)){
sprintf(answer,"0x%x",myDet->digitalTest(DIGITAL_BIT_TEST,ival, detPos));
sprintf(answer,"%d",myDet->digitalTest(DIGITAL_BIT_TEST,ival, detPos));
return string(answer);
}
else
@ -3737,6 +3732,7 @@ string slsDetectorCommand::helpDigiTest(int action) {
if (action==GET_ACTION || action==HELP_ACTION) {
os << "digibittest:i \t performs digital test of the module i. Returns 0 if succeeded, otherwise error mask.Gotthard only."<< std::endl;
os << "bustest \t performs test of the bus interface between FPGA and embedded Linux system. Can last up to a few minutes. Jungfrau only."<< std::endl;
os << "firmwaretest \t performs the firmware test. Jungfrau only." << std::endl;
}
return os.str();
}
@ -4912,7 +4908,8 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action,
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
if (action==PUT_ACTION)
return string("cannot put");
return string(""+myDet->printReceiverConfiguration(detPos));
myDet->printReceiverConfiguration(detPos);
return string("");
}else if (cmd=="parameters") {
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
if (action==PUT_ACTION) {