From 018db60fbc3a2b6b1643ac62cf0e09372fc0bf7e Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Fri, 9 Aug 2024 13:45:02 +0300 Subject: [PATCH] sns: zero threshold check does not trigger report --- code/espurna/sensor.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/espurna/sensor.cpp b/code/espurna/sensor.cpp index 971b8e7b..76cb49a7 100644 --- a/code/espurna/sensor.cpp +++ b/code/espurna/sensor.cpp @@ -4219,9 +4219,6 @@ bool ready_to_report(ValuePair& out, const ValuePair& processed, const Magnitude const bool check_max_threshold { !std::isnan(magnitude.max_threshold) }; report = report || check_max_threshold; - // Figure out whether report value is zero or not - const bool check_zero_threshold { !std::isnan(magnitude.zero_threshold) }; - report = report || check_zero_threshold; if (report) { if (magnitude.filter->ready()) { @@ -4234,7 +4231,8 @@ bool ready_to_report(ValuePair& out, const ValuePair& processed, const Magnitude out = processed; } - if (check_zero_threshold && out.value < magnitude.zero_threshold) { + // Figure out whether report value should be zero or not + if (!std::isnan(magnitude.zero_threshold) && out.value < magnitude.zero_threshold) { out.value = 0.0; }