From abef6ae4cd30260cc2f4c735e71081e28b646618 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 6 Aug 2026 11:21:08 +0200 Subject: [PATCH] refactored for future modifications for eier --- slsDetectorSoftware/src/Module.cpp | 23 +++++++++-------------- slsDetectorSoftware/src/Module.h | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 8745938dc..a8d66ed60 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -196,9 +196,7 @@ void Module::setSettings(detectorSettings isettings) { "Cannot set settings for Eiger. Use threshold energy."); } sendToDetector(F_SET_SETTINGS, isettings); - if (shm()->detType == MYTHEN3) { - updateRxAllThresholdMetadata(getAllThresholdEnergy()); - } + updateRxAllThresholdMetadata(); } int Module::getThresholdEnergy() const { @@ -419,9 +417,12 @@ void Module::setAllThresholdEnergy(std::array e_eV, } } -void Module::updateRxAllThresholdMetadata(std::array e_eV) { +void Module::updateRxAllThresholdMetadata() { if (shm()->useReceiverFlag) { - sendToReceiver(F_RECEIVER_SET_ALL_THRESHOLD, e_eV, nullptr); + if (shm()->detType == MYTHEN3) { + auto e_eV = getAllThresholdEnergy(); + sendToReceiver(F_RECEIVER_SET_ALL_THRESHOLD, e_eV, nullptr); + } } } @@ -482,9 +483,7 @@ int Module::getAllTrimbits() const { void Module::setAllTrimbits(int val) { sendToDetector(F_SET_ALL_TRIMBITS, val); - if (shm()->detType == MYTHEN3) { - updateRxAllThresholdMetadata(getAllThresholdEnergy()); - } + updateRxAllThresholdMetadata(); } std::vector Module::getTrimEn() const { @@ -792,9 +791,7 @@ void Module::setDAC(int val, dacIndex index, bool mV) { } int args[]{static_cast(index), static_cast(mV), val}; sendToDetector(F_SET_DAC, args); - if (shm()->detType == MYTHEN3) { - updateRxAllThresholdMetadata(getAllThresholdEnergy()); - } + updateRxAllThresholdMetadata(); } bool Module::getPowerChip() const { @@ -3563,9 +3560,7 @@ void Module::setModule(sls_detector_module &module, bool trimbits) { client.sendCommand(F_SET_MODULE, nullptr, 0); sendModule(&module, client); client.readReply(nullptr, 0); - if (shm()->detType == MYTHEN3) { - updateRxAllThresholdMetadata(getAllThresholdEnergy()); - } + updateRxAllThresholdMetadata(); } sls_detector_module Module::getModule() { diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 1dbeb21ae..1c22fa3f2 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -111,7 +111,7 @@ class Module : public virtual slsDetectorDefs { void setAllThresholdEnergy(std::array e_eV, detectorSettings isettings, bool trimbits); std::string getSettingsDir() const; - void updateRxAllThresholdMetadata(std::array e_eV); + void updateRxAllThresholdMetadata(); std::string setSettingsDir(const std::string &dir); void loadTrimbits(const std::string &fname); void saveTrimbits(const std::string &fname);