From 879ff034ed256e75f64053e11626ca08f35593a3 Mon Sep 17 00:00:00 2001
From: Giulio Gaio <giulio.gaio@elettra.eu>
Date: Fri, 5 May 2023 14:06:36 +0200
Subject: [PATCH] Fixed threshold check

---
 src/DataVampire.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/DataVampire.cpp b/src/DataVampire.cpp
index 7459191..c49a881 100644
--- a/src/DataVampire.cpp
+++ b/src/DataVampire.cpp
@@ -2089,7 +2089,7 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples,
 					for (int k = roi[0]; k <= roi[2]; k++) {
 						cache_buffer[cache_idx].databuf[cnt] = data[j * *attr_Width_read + k];
 						//cache_buffer[cache_idx].databuf[cnt] = k;
-						if ((data[j * *attr_Width_read + k] >= *attr_MinThreshold_read) || 
+						if ((data[j * *attr_Width_read + k] >= *attr_MinThreshold_read) && 
 							(data[j * *attr_Width_read + k] <= *attr_MaxThreshold_read)) 
 							cache_buffer[cache_idx].datavalid[cnt] = true;
 						else
@@ -2105,7 +2105,7 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples,
 				for (int k = roi[0]; k <= roi[1]; k++) {
 					cache_buffer[cache_idx].databuf[cnt] = data[k];
 
-					if ((data[k] >= *attr_MinThreshold_read) || (data[k] <= *attr_MaxThreshold_read)) 
+					if ((data[k] >= *attr_MinThreshold_read) && (data[k] <= *attr_MaxThreshold_read)) 
 						cache_buffer[cache_idx].datavalid[cnt] = true;
 					else
 						cache_buffer[cache_idx].datavalid[cnt] = false;
-- 
GitLab