]> git.itanic.dy.fi Git - rrdd/commit
onewire_parser: Make step changes pass glitch detection
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Thu, 26 Jan 2017 18:28:32 +0000 (20:28 +0200)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sun, 29 Jan 2017 14:41:38 +0000 (16:41 +0200)
commit80930aa3448564d27a93ad178e18cd2f044a78b3
tree2add43b42a18a246f9d2c8a254171ec42e9b1af2
parentc8f7a45a0aa73418ebbb3cf8aca40b67a7572fdc
onewire_parser: Make step changes pass glitch detection

The glitch detection code does not recognize step changes at
all. Currently it re-reads the temperature values until maximum glitch
threshold (two reads) and then just uses the last data. This is not
ideal on noisy lines as the last data might be a glitch itself.

Improve the logic so that after considering for a glitch, we compare
two consequent readings and see if the delta between those two is less
than the glitch threshold. If it is less, we consider the data
good. This is needed in case the temperature is changing quickly and
we don't get two identical values, but almost same.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
onewire_parser.c