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>
This commit is contained in:
Dirk Hohndel 2013-03-08 11:52:10 -08:00
parent 4297d931a3
commit b5cd46aa39

View file

@ -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)