mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 15:27:13 +02:00
defaultdac upto detector side, settings is undefined when none given
This commit is contained in:
@ -1095,6 +1095,47 @@ std::string CmdProxy::DacValues(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::DefaultDac(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[dac name][value][(optional)setting]\n\tSets the default for "
|
||||
"that dac to this value.\n\t[Jungfrau][Mythen3] When settings is "
|
||||
"provided, it sets the default value only for that setting"
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() < 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
// optional settings
|
||||
if (args.size() == 2) {
|
||||
auto t = det->getDefaultDac(
|
||||
StringTo<defs::dacIndex>(args[0]),
|
||||
sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]));
|
||||
os << ToString(args) << ' ' << OutString(t) << '\n';
|
||||
} else {
|
||||
auto t = det->getDefaultDac(StringTo<defs::dacIndex>(args[0]));
|
||||
os << args[0] << ' ' << OutString(t) << '\n';
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() < 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
// optional settings
|
||||
if (args.size() == 3) {
|
||||
det->setDefaultDac(
|
||||
StringTo<defs::dacIndex>(args[0]), StringTo<int>(args[1]),
|
||||
sls::StringTo<slsDetectorDefs::detectorSettings>(args[2]));
|
||||
} else {
|
||||
det->setDefaultDac(StringTo<defs::dacIndex>(args[0]),
|
||||
StringTo<int>(args[1]));
|
||||
}
|
||||
os << ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
/* acquisition */
|
||||
|
||||
std::string CmdProxy::ReceiverStatus(int action) {
|
||||
|
@ -817,6 +817,7 @@ class CmdProxy {
|
||||
{"daclist", &CmdProxy::daclist},
|
||||
{"dacvalues", &CmdProxy::DacValues},
|
||||
{"defaultdacs", &CmdProxy::defaultdacs},
|
||||
{"defaultdac", &CmdProxy::DefaultDac},
|
||||
|
||||
/* on chip dacs */
|
||||
{"vchip_comp_fe", &CmdProxy::vchip_comp_fe},
|
||||
@ -1094,6 +1095,7 @@ class CmdProxy {
|
||||
/* dacs */
|
||||
std::string Dac(int action);
|
||||
std::string DacValues(int action);
|
||||
std::string DefaultDac(int action);
|
||||
/* acquisition */
|
||||
std::string ReceiverStatus(int action);
|
||||
std::string DetectorStatus(int action);
|
||||
|
@ -620,6 +620,43 @@ std::vector<defs::dacIndex> Detector::getDacList() const {
|
||||
return retval;
|
||||
}
|
||||
|
||||
Result<int> Detector::getDefaultDac(defs::dacIndex index, Positions pos) {
|
||||
return getDefaultDac_(index, defs::UNDEFINED, pos);
|
||||
}
|
||||
|
||||
void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||
Positions pos) {
|
||||
setDefaultDac_(index, defaultValue, defs::UNDEFINED, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDefaultDac(defs::dacIndex index,
|
||||
defs::detectorSettings sett,
|
||||
Positions pos) {
|
||||
if (sett == defs::UNDEFINED) {
|
||||
throw RuntimeError("Invalid settings given for default dac");
|
||||
}
|
||||
return getDefaultDac_(index, sett, pos);
|
||||
}
|
||||
|
||||
void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||
defs::detectorSettings sett, Positions pos) {
|
||||
if (sett == defs::UNDEFINED) {
|
||||
throw RuntimeError("Invalid settings given for default dac");
|
||||
}
|
||||
setDefaultDac_(index, defaultValue, sett, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDefaultDac_(defs::dacIndex index,
|
||||
defs::detectorSettings sett,
|
||||
Positions pos) {
|
||||
return pimpl->Parallel(&Module::getDefaultDac, pos, index, sett);
|
||||
}
|
||||
|
||||
void Detector::setDefaultDac_(defs::dacIndex index, int defaultValue,
|
||||
defs::detectorSettings sett, Positions pos) {
|
||||
pimpl->Parallel(&Module::setDefaultDac, pos, index, defaultValue, sett);
|
||||
}
|
||||
|
||||
void Detector::setDefaultDacs(Positions pos) {
|
||||
pimpl->Parallel(&Module::setDefaultDacs, pos);
|
||||
}
|
||||
|
@ -618,6 +618,16 @@ int Module::getDAC(dacIndex index, bool mV) const {
|
||||
int args[]{static_cast<int>(index), static_cast<int>(mV), GET_FLAG};
|
||||
return sendToDetector<int>(F_SET_DAC, args);
|
||||
}
|
||||
int Module::getDefaultDac(slsDetectorDefs::dacIndex index,
|
||||
slsDetectorDefs::detectorSettings sett) {
|
||||
int args[]{static_cast<int>(index), static_cast<int>(sett)};
|
||||
return sendToDetector<int>(F_GET_DEFAULT_DAC, args);
|
||||
}
|
||||
void Module::setDefaultDac(slsDetectorDefs::dacIndex index, int defaultValue,
|
||||
defs::detectorSettings sett) {
|
||||
int args[]{static_cast<int>(index), static_cast<int>(sett), defaultValue};
|
||||
return sendToDetector(F_SET_DEFAULT_DAC, args, nullptr);
|
||||
}
|
||||
|
||||
void Module::setDefaultDacs() { sendToDetector(F_SET_DEFAULT_DACS); }
|
||||
|
||||
|
@ -148,7 +148,10 @@ class Module : public virtual slsDetectorDefs {
|
||||
int getMaxClockPhaseShift(int clkIndex) const;
|
||||
int getClockFrequency(int clkIndex) const;
|
||||
void setClockFrequency(int clkIndex, int value);
|
||||
/** [Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3] */
|
||||
int getDefaultDac(slsDetectorDefs::dacIndex index,
|
||||
slsDetectorDefs::detectorSettings sett);
|
||||
void setDefaultDac(slsDetectorDefs::dacIndex index, int defaultValue,
|
||||
defs::detectorSettings sett);
|
||||
void setDefaultDacs();
|
||||
int getDAC(dacIndex index, bool mV) const;
|
||||
void setDAC(int val, dacIndex index, bool mV);
|
||||
|
Reference in New Issue
Block a user