summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-08 11:52:10 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-08 11:52:10 -0800
commitb5cd46aa3991d9e56aa0ca25125f5e7d1c1f15c2 (patch)
tree754dcb10c22c443f1e5f07833337c922cd6bb21b /parse-xml.c
parent4297d931a3da5fcfb8d8631ca9ad1be263bb22d2 (diff)
downloadsubsurface-b5cd46aa3991d9e56aa0ca25125f5e7d1c1f15c2.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c4
1 files changed, 4 insertions, 0 deletions
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)