Skip to content

Commit

Permalink
sns: zero threshold check does not trigger report
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Aug 9, 2024
1 parent fc8ef5a commit 018db60
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions code/espurna/sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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;
}

Expand Down

0 comments on commit 018db60

Please sign in to comment.