mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
master file option, adcdisable changed to adcenable
This commit is contained in:
@ -3500,6 +3500,22 @@ int multiSlsDetector::getFileWrite(int detPos) const{
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setMasterFileWrite(bool value, int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setMasterFileWrite(value);
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::setMasterFileWrite, value);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getMasterFileWrite(int detPos) const{
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getMasterFileWrite();
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::getMasterFileWrite);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setFileOverWrite(bool enable, int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setFileOverWrite(enable);
|
||||
|
@ -390,6 +390,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
break;
|
||||
}
|
||||
shm()->rxFileWrite = true;
|
||||
shm()->rxMasterFileWrite = true;
|
||||
shm()->rxFileOverWrite = true;
|
||||
|
||||
// get the detector parameters based on type
|
||||
@ -1873,6 +1874,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
<< "\nr_discardpolicy:" << shm()->rxFrameDiscardMode
|
||||
<< "\nr_padding:" << shm()->rxFramePadding
|
||||
<< "\nwrite enable:" << shm()->rxFileWrite
|
||||
<< "\nmaster write enable:" << shm()->rxMasterFileWrite
|
||||
<< "\noverwrite enable:" << shm()->rxFileOverWrite
|
||||
<< "\nframe index needed:"
|
||||
<< ((shm()->timerValue[FRAME_NUMBER] *
|
||||
@ -1912,6 +1914,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
setReceiverFramesDiscardPolicy(shm()->rxFrameDiscardMode);
|
||||
setPartialFramesPadding(shm()->rxFramePadding);
|
||||
setFileWrite(shm()->rxFileWrite);
|
||||
setMasterFileWrite(shm()->rxMasterFileWrite);
|
||||
setFileOverWrite(shm()->rxFileOverWrite);
|
||||
setTimer(FRAME_PERIOD, shm()->timerValue[FRAME_PERIOD]);
|
||||
setTimer(FRAME_NUMBER, shm()->timerValue[FRAME_NUMBER]);
|
||||
@ -3236,6 +3239,10 @@ int slsDetector::updateCachedReceiverVariables() const {
|
||||
n += receiver.receiveData(&i32, sizeof(i32));
|
||||
shm()->rxFileWrite = static_cast<bool>(i32);
|
||||
|
||||
// master file write enable
|
||||
n += receiver.receiveData(&i32, sizeof(i32));
|
||||
shm()->rxMasterFileWrite = static_cast<bool>(i32);
|
||||
|
||||
// file overwrite enable
|
||||
n += receiver.receiveData(&i32, sizeof(i32));
|
||||
shm()->rxFileOverWrite = static_cast<bool>(i32);
|
||||
@ -3508,6 +3515,20 @@ bool slsDetector::setFileWrite(bool value) {
|
||||
|
||||
bool slsDetector::getFileWrite() const { return shm()->rxFileWrite; }
|
||||
|
||||
bool slsDetector::setMasterFileWrite(bool value) {
|
||||
int arg = static_cast<int>(value);
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Sending enable master file write to receiver: " << arg;
|
||||
if (shm()->rxOnlineFlag == ONLINE_FLAG) {
|
||||
sendToReceiver(F_ENABLE_RECEIVER_MASTER_FILE_WRITE, arg, retval);
|
||||
FILE_LOG(logDEBUG1) << "Receiver master file write enable: " << retval;
|
||||
shm()->rxMasterFileWrite = static_cast<bool>(retval);
|
||||
}
|
||||
return getMasterFileWrite();
|
||||
}
|
||||
|
||||
bool slsDetector::getMasterFileWrite() const { return shm()->rxMasterFileWrite; }
|
||||
|
||||
bool slsDetector::setFileOverWrite(bool value) {
|
||||
int arg = static_cast<int>(value);
|
||||
int retval = -1;
|
||||
|
@ -1541,12 +1541,19 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
/*! \page output
|
||||
- <b>fileformat</b> sets/gets the file format for data in receiver. Options: [binary, hdf5]. \c Returns \c (string)
|
||||
- <b>fileformat [i]</b> sets/gets the file format for data in receiver. Options: [binary, hdf5]. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "fileformat";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdFileName;
|
||||
++i;
|
||||
|
||||
/*! \page output
|
||||
- <b>masterfile [i]</b> sets/gets the master file write enable in receiver. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "masterfile";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdEnablefwrite;
|
||||
++i;
|
||||
|
||||
/* communication configuration */
|
||||
|
||||
/*! \page network Network
|
||||
@ -1921,9 +1928,9 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
/*! \page prototype
|
||||
- <b>adcdisable [mask]</b> Sets/gets ADC disable mask (8 digits hex format)
|
||||
- <b>adcenable [mask]</b> Sets/gets ADC enable mask (8 digits hex format)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "adcdisable";
|
||||
descrToFuncMap[i].m_pFuncName = "adcenable";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||
++i;
|
||||
|
||||
@ -2599,22 +2606,41 @@ std::string slsDetectorCommand::cmdEnablefwrite(int narg, char *args[], int acti
|
||||
if (action == HELP_ACTION) {
|
||||
return helpEnablefwrite(action);
|
||||
}
|
||||
if (action == PUT_ACTION) {
|
||||
if (sscanf(args[1], "%d", &i))
|
||||
myDet->setFileWrite(i, detPos);
|
||||
else
|
||||
return std::string("could not decode enable file write");
|
||||
if (cmd == "enablefwrite") {
|
||||
if (action == PUT_ACTION) {
|
||||
if (sscanf(args[1], "%d", &i))
|
||||
myDet->setFileWrite(i, detPos);
|
||||
else
|
||||
return std::string("could not decode enable file write");
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getFileWrite(detPos));
|
||||
return std::string(ans);
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getFileWrite(detPos));
|
||||
return std::string(ans);
|
||||
|
||||
else if (cmd == "masterfile") {
|
||||
if (action == PUT_ACTION) {
|
||||
if (sscanf(args[1], "%d", &i))
|
||||
myDet->setMasterFileWrite(i, detPos);
|
||||
else
|
||||
return std::string("could not decode master file enable");
|
||||
}
|
||||
sprintf(ans, "%d", myDet->getMasterFileWrite(detPos));
|
||||
return std::string(ans);
|
||||
}
|
||||
|
||||
else return std::string("unknown command " + cmd);
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpEnablefwrite(int action) {
|
||||
std::ostringstream os;
|
||||
if (action == GET_ACTION || action == HELP_ACTION)
|
||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||
os << std::string("enablefwrite \t When Enabled writes the data into the file\n");
|
||||
if (action == PUT_ACTION || action == HELP_ACTION)
|
||||
os << std::string("enablefwrite i \t should be 1 or 0 or -1\n");
|
||||
os << std::string("masterfile \t When Enabled writes the master file\n");
|
||||
}
|
||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||
os << std::string("enablefwrite i \t should be 1 or 0\n");
|
||||
os << std::string("masterfile i \t sets the master file write enable. should be 1 or 0\n");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@ -5172,7 +5198,7 @@ std::string slsDetectorCommand::helpPattern(int action) {
|
||||
os << "patmask m \t sets the 64 bit mask (hex) applied to every pattern. Only the bits from patsetbit are selected to mask for the corresponding bit value from m mask" << std::endl;
|
||||
os << "patsetbit m \t selects bits (hex) of the 64 bits that the patmask will be applied to every pattern. Only the bits from m mask are selected to mask for the corresponding bit value from patmask." << std::endl;
|
||||
os << "adcinvert mask\t sets the adcinversion mask (hex)" << std::endl;
|
||||
os << "adcdisable mask\t sets the adcdisable mask (hex)" << std::endl;
|
||||
os << "adcenable mask\t sets the adcenable mask (hex)" << std::endl;
|
||||
}
|
||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||
os << "pattern \t cannot get" << std::endl;
|
||||
@ -5196,7 +5222,7 @@ std::string slsDetectorCommand::helpPattern(int action) {
|
||||
os << "patsetbit \t gets 64 bit mask (hex) of the selected bits that the patmask will be applied to every pattern. " << std::endl;
|
||||
os << "adcinvert \t returns the adcinversion mask " << std::endl;
|
||||
|
||||
os << "adcdisable \t returns the adcdisable mask " << std::endl;
|
||||
os << "adcenable \t returns the adcenable mask " << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
@ -5552,24 +5578,19 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
|
||||
}
|
||||
|
||||
os << std::hex << myDet->readRegister(123, detPos) << std::dec ; //0x7b
|
||||
} else if (cmd == "adcdisable") {
|
||||
} else if (cmd == "adcenable") {
|
||||
|
||||
if (action == PUT_ACTION) {
|
||||
uint32_t adcEnableMask = 0;
|
||||
if (sscanf(args[1], "%x", &adcEnableMask))
|
||||
;
|
||||
else
|
||||
return std::string("Could not scan adcdisable reg ") + std::string(args[1]);
|
||||
return std::string("Could not scan adcenable reg ") + std::string(args[1]);
|
||||
|
||||
// get enable mask from enable mask
|
||||
adcEnableMask ^= BIT32_MASK;
|
||||
myDet->setADCEnableMask(adcEnableMask, detPos);
|
||||
}
|
||||
|
||||
uint32_t retval = myDet->getADCEnableMask(detPos);
|
||||
// get disable mask
|
||||
retval ^= BIT32_MASK;
|
||||
os << std::hex << retval << std::dec;
|
||||
os << std::hex << myDet->getADCEnableMask(detPos) << std::dec;
|
||||
}
|
||||
|
||||
else
|
||||
|
Reference in New Issue
Block a user