From 88649a00b6ad5968ca8c14be5bc626d86b71aca4 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil <33750417+thattil@users.noreply.github.com> Date: Thu, 12 May 2022 11:41:05 +0200 Subject: [PATCH] M3vtrim min (#454) * Remove the vtrim min 600 check when setting threshold energy. vth1-3:200 - 2400, others 0-2800 * compile fix --- slsDetectorSoftware/src/Module.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 9e860e37f..2a7429c8f 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -407,12 +407,18 @@ void Module::setAllThresholdEnergy(std::array e_eV, // check dacs out_of_range = false; - for (auto dac : {M_VTRIM, M_VTH1, M_VTH2, M_VTH3}) { - if (myMod.dacs[dac] < 600) { - myMod.dacs[dac] = 600; + for (int i = 0; i != myMod.ndac; ++i) { + int dacMin = 0; + int dacMax = 2800; + if (i == M_VTH1 || i == M_VTH2 || i == M_VTH3) { + dacMin = 200; + dacMax = 2400; + } + if (myMod.dacs[i] < dacMin) { + myMod.dacs[i] = dacMin; out_of_range = true; - } else if (myMod.dacs[dac] > 2400) { - myMod.dacs[dac] = 2400; + } else if (myMod.dacs[i] > dacMax) { + myMod.dacs[i] = dacMax; out_of_range = true; } }