mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
Adcvpp (#566)
* added api in detector class for adcvpp, taken out of dac list
This commit is contained in:
parent
af300e0276
commit
b7cdfbb4d2
@ -14,7 +14,6 @@ pycmd = dir(Detector)
|
||||
# dacs are in general not included in the python commands and we expect to
|
||||
# set them from the specialized class or using an enum
|
||||
dacs = [
|
||||
'adcvpp',
|
||||
'iodelay',
|
||||
'list',
|
||||
'rxb_lb',
|
||||
|
@ -1585,6 +1585,14 @@ class Detector {
|
||||
*/
|
||||
void setVoltage(defs::dacIndex index, int value, Positions pos = {});
|
||||
|
||||
/**
|
||||
* [CTB][Moench] Options: [0- 4] or [1V, 1.14V, 1.33V, 1.6V, 2V]
|
||||
*/
|
||||
Result<int> getADCVpp(bool mV = false, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Moench] */
|
||||
void setADCVpp(int value, bool mV = false, Positions pos = {});
|
||||
|
||||
/** [CTB][Moench] */
|
||||
Result<uint32_t> getADCEnableMask(Positions pos = {}) const;
|
||||
|
||||
|
@ -2556,6 +2556,51 @@ std::string CmdProxy::Samples(int action) {
|
||||
}
|
||||
|
||||
/* CTB Specific */
|
||||
std::string CmdProxy::AdcVpp(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
|
||||
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
|
||||
"\n\tAdvanced User function!\n"
|
||||
<< '\n';
|
||||
return os.str();
|
||||
}
|
||||
|
||||
if (action == defs::GET_ACTION) {
|
||||
bool mV = false;
|
||||
|
||||
if (args.size() == 1) {
|
||||
if ((args[0] != "mv") && (args[0] != "mV")) {
|
||||
throw RuntimeError("Unknown argument " + args[0] +
|
||||
". Did you mean mV?");
|
||||
}
|
||||
mV = true;
|
||||
} else if (args.size() > 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getADCVpp(mV, std::vector<int>{det_id});
|
||||
os << OutString(t) << (mV ? " mV\n" : "\n");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
bool mV = false;
|
||||
if (args.size() == 2) {
|
||||
if ((args[1] != "mv") && (args[1] != "mV")) {
|
||||
throw RuntimeError("Unknown argument " + args[1] +
|
||||
". Did you mean mV?");
|
||||
}
|
||||
mV = true;
|
||||
} else if (args.size() > 2 || args.size() < 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setADCVpp(StringTo<int>(args[1]), mV,
|
||||
std::vector<int>{det_id});
|
||||
os << args[1] << (mV ? " mV\n" : "\n");
|
||||
} else {
|
||||
throw RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::SlowAdc(int action) {
|
||||
std::ostringstream os;
|
||||
|
@ -666,7 +666,6 @@ class CmdProxy {
|
||||
{"vb_cs", "dac"},
|
||||
{"vb_opa_fd", "dac"},
|
||||
{"vcom_adc2", "dac"},
|
||||
{"adcvpp", "dac"},
|
||||
{"vb_ds", "dac"},
|
||||
{"vb_comp", "dac"},
|
||||
{"vb_pixbuf", "dac"},
|
||||
@ -1018,6 +1017,7 @@ class CmdProxy {
|
||||
{"dsamples", &CmdProxy::dsamples},
|
||||
{"romode", &CmdProxy::romode},
|
||||
{"dbitclk", &CmdProxy::dbitclk},
|
||||
{"adcvpp", &CmdProxy::AdcVpp},
|
||||
{"v_a", &CmdProxy::v_a},
|
||||
{"v_b", &CmdProxy::v_b},
|
||||
{"v_c", &CmdProxy::v_c},
|
||||
@ -1190,6 +1190,7 @@ class CmdProxy {
|
||||
/* CTB/ Moench Specific */
|
||||
std::string Samples(int action);
|
||||
/* CTB Specific */
|
||||
std::string AdcVpp(int action);
|
||||
std::string SlowAdc(int action);
|
||||
std::string ReceiverDbitList(int action);
|
||||
std::string DigitalIODelay(int action);
|
||||
|
@ -1999,6 +1999,14 @@ void Detector::setVoltage(defs::dacIndex index, int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setDAC, pos, value, index, true);
|
||||
}
|
||||
|
||||
Result<int> Detector::getADCVpp(bool mV, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getDAC, pos, defs::ADC_VPP, mV);
|
||||
}
|
||||
|
||||
void Detector::setADCVpp(int value, bool mV, Positions pos) {
|
||||
pimpl->Parallel(&Module::setDAC, pos, value, defs::ADC_VPP, mV);
|
||||
}
|
||||
|
||||
Result<uint32_t> Detector::getADCEnableMask(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getADCEnableMask, pos);
|
||||
}
|
||||
|
@ -253,12 +253,6 @@ std::string GetHelpDac(std::string dac) {
|
||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||
"common mode voltage of ADC DAC bank 2.");
|
||||
}
|
||||
if (dac == "adcvpp") {
|
||||
return std::string(
|
||||
"[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
|
||||
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
|
||||
"\n\tAdvanced User function! ");
|
||||
}
|
||||
if (dac == "vb_ds") {
|
||||
return std::string(
|
||||
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
|
||||
|
@ -108,7 +108,7 @@ TEST_CASE("adcvpp", "[.cmd]") {
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getDAC(defs::ADC_VPP, false);
|
||||
auto prev_val = det.getADCVpp(false);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("adcvpp", {"1"}, -1, PUT, oss);
|
||||
@ -125,7 +125,7 @@ TEST_CASE("adcvpp", "[.cmd]") {
|
||||
REQUIRE(oss.str() == "dac adcvpp 1140 mV\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setDAC(defs::ADC_VPP, prev_val[i], false, {i});
|
||||
det.setADCVpp(prev_val[i], false, {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("dac adcvpp", {}, -1, GET));
|
||||
|
@ -490,8 +490,6 @@ std::string ToString(const defs::dacIndex s) {
|
||||
return std::string("vipre_cds");
|
||||
case defs::IBIAS_SFP:
|
||||
return std::string("ibias_sfp");
|
||||
case defs::ADC_VPP:
|
||||
return std::string("adcvpp");
|
||||
case defs::TRIMBIT_SCAN:
|
||||
return std::string("trimbits");
|
||||
case defs::HIGH_VOLTAGE:
|
||||
@ -953,8 +951,6 @@ template <> defs::dacIndex StringTo(const std::string &s) {
|
||||
return defs::VIPRE_CDS;
|
||||
if (s == "ibias_sfp")
|
||||
return defs::IBIAS_SFP;
|
||||
if (s == "adcvpp")
|
||||
return defs::ADC_VPP;
|
||||
if (s == "trimbits")
|
||||
return defs::TRIMBIT_SCAN;
|
||||
if (s == "highvoltage")
|
||||
|
Loading…
x
Reference in New Issue
Block a user