From b5cd46aa3991d9e56aa0ca25125f5e7d1c1f15c2 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 8 Mar 2013 11:52:10 -0800 Subject: Sanity check on temperature values The range is still very wide (as we get both air and water temperatures), but it will at least eliminate some completely bogus outliers. Signed-off-by: Dirk Hohndel --- parse-xml.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parse-xml.c b/parse-xml.c index 923df367c..94ade6243 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -354,6 +354,10 @@ static void temperature(char *buffer, void *_temperature) default: printf("Strange temperature reading %s\n", buffer); } + /* temperatures outside -40C .. +70C should be ignored */ + if (temperature->mkelvin < ZERO_C_IN_MKELVIN - 40000 || + temperature->mkelvin > ZERO_C_IN_MKELVIN + 70000) + temperature->mkelvin = 0; } static void sampletime(char *buffer, void *_time) -- cgit v1.2.3-70-g09d2