From c3741bc462bde96acb14d2d857d91e1f770f868f Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 6 Aug 2026 11:08:47 +0200 Subject: [PATCH] update rx master file for all threshold energies(m3) when setting dac directly, custom trimbits, setting settings, trimbits etc --- slsDetectorSoftware/src/Module.cpp | 16 ++++++++++++++++ slsDetectorSoftware/src/Module.h | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 80860ef8a..8f4a8dfe6 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -197,6 +197,9 @@ void Module::setSettings(detectorSettings isettings) { "Cannot set settings for Eiger. Use threshold energy."); } sendToDetector(F_SET_SETTINGS, isettings); + if (shm()->detType == MYTHEN3) { + updateRxAllThresholdMetadata(getAllThresholdEnergy()); + } } int Module::getThresholdEnergy() const { @@ -267,6 +270,8 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings, } } + + void Module::setAllThresholdEnergy(std::array e_eV, detectorSettings isettings, bool trimbits) { if (shm()->detType != MYTHEN3) { @@ -415,7 +420,9 @@ void Module::setAllThresholdEnergy(std::array e_eV, throw RuntimeError("setThresholdEnergyAndSettings: Could not set " "settings in Module"); } +} +void Module::updateRxAllThresholdMetadata(std::array e_eV) { if (shm()->useReceiverFlag) { sendToReceiver(F_RECEIVER_SET_ALL_THRESHOLD, e_eV, nullptr); } @@ -478,6 +485,9 @@ int Module::getAllTrimbits() const { void Module::setAllTrimbits(int val) { sendToDetector(F_SET_ALL_TRIMBITS, val); + if (shm()->detType == MYTHEN3) { + updateRxAllThresholdMetadata(getAllThresholdEnergy()); + } } std::vector Module::getTrimEn() const { @@ -805,6 +815,9 @@ void Module::resetToDefaultDacs(const bool hardReset) { 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()); + } } bool Module::getPowerChip() const { @@ -3605,6 +3618,9 @@ void Module::setModule(sls_detector_module &module, bool trimbits) { throw DetectorError("Module " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } + if (shm()->detType == MYTHEN3) { + updateRxAllThresholdMetadata(getAllThresholdEnergy()); + } } sls_detector_module Module::getModule() { diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 51b522ead..06ec6db14 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -109,7 +109,8 @@ class Module : public virtual slsDetectorDefs { bool trimbits); void setAllThresholdEnergy(std::array e_eV, detectorSettings isettings, bool trimbits); - std::string getSettingsDir() const; + std::string getSettingsDir() const; + void updateRxAllThresholdMetadata(std::array e_eV); std::string setSettingsDir(const std::string &dir); void loadTrimbits(const std::string &fname); void saveTrimbits(const std::string &fname);