From 2e4783f2966ee4ce0d1855ecb70559497b2a8221 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Thu, 27 Aug 2020 17:08:53 +0200 Subject: [PATCH] sort and remove duplicates before sending rxdbitlist --- slsDetectorSoftware/src/Module.cpp | 6 +++++- slsDetectorSoftware/src/Module.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 18ecf7fd5..79e407812 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -1863,7 +1863,7 @@ std::vector Module::getReceiverDbitList() const { F_GET_RECEIVER_DBIT_LIST); } -void Module::setReceiverDbitList(const std::vector &list) { +void Module::setReceiverDbitList(std::vector list) { LOG(logDEBUG1) << "Setting Receiver Dbit List"; if (list.size() > 64) { throw sls::RuntimeError("Dbit list size cannot be greater than 64\n"); @@ -1874,6 +1874,10 @@ void Module::setReceiverDbitList(const std::vector &list) { "Dbit list value must be between 0 and 63\n"); } } + std::sort(begin(list), end(list)); + auto last = std::unique(begin(list), end(list)); + list.erase(last, list.end()); + sls::StaticVector arg = list; sendToReceiver(F_SET_RECEIVER_DBIT_LIST, arg, nullptr); } diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index bc4a36d16..db392fac1 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -442,7 +442,7 @@ class Module : public virtual slsDetectorDefs { bool getExternalSampling() const; void setExternalSampling(bool value); std::vector getReceiverDbitList() const; - void setReceiverDbitList(const std::vector &list); + void setReceiverDbitList(std::vector list); int getReceiverDbitOffset() const; void setReceiverDbitOffset(int value); void setDigitalIODelay(uint64_t pinMask, int delay);