From 5fd2fc3b9b6d6d3df1455b4c2d95b665efdeeeba Mon Sep 17 00:00:00 2001 From: Jonny Ervine Date: Wed, 24 Jun 2015 10:12:48 +0800 Subject: [PATCH] modified: temp-humid-read-loop.py modified: temp-humid-read-single.py --- python_code/temp-humid-read-loop.py | 2 +- python_code/temp-humid-read-single.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python_code/temp-humid-read-loop.py b/python_code/temp-humid-read-loop.py index 710dfff..0faff1f 100755 --- a/python_code/temp-humid-read-loop.py +++ b/python_code/temp-humid-read-loop.py @@ -56,7 +56,7 @@ def sensorRead(hwtype, pin, retries, timeout, maxtemp, mintemp, tempdiff, maxhum if t and h: logging.debug('Temperature and humidity read as {0} and {1}'.format(t, h)) logging.debug('Temperature and Humidity differences allowed: {0} and {1}'.format(tempdiff, humiddiff)) - if (oldtemp != "NULL") and ((t - oldtemp < tempdiff) or (oldtemp - t < tempdiff)) and ((h - oldhumid < humiddiff) or (oldhumid - h < humiddif)): + if (oldtemp != "NULL") and ((t - oldtemp < tempdiff) or (oldtemp - t < tempdiff)) and ((h - oldhumid < humiddiff) or (oldhumid - h < humiddiff)): logging.debug('Current temperature close enough to previous temperature and previous temperature is not NULL, it is: %s', oldtemp) logging.debug('Current humidity close enough to previous humidity and previous humidity is not NULL, it is: %s', oldhumid) if (t < maxtemp) and (t > mintemp) and (h < maxhumid) and (h > minhumid): diff --git a/python_code/temp-humid-read-single.py b/python_code/temp-humid-read-single.py index d1be2eb..088c7b1 100644 --- a/python_code/temp-humid-read-single.py +++ b/python_code/temp-humid-read-single.py @@ -29,7 +29,7 @@ def sensorRead(hwtype, pin, retries, timeout, maxtemp, mintemp, tempdiff, maxhum else: if t and h: logging.debug('The temperature and humidity have been read as {0} and {1}'.format(t, h)) - if (oldtemp != "NULL") and ((t - oldtemp < tempdiff) or (oldtemp - t < tempdiff)) and ((h - oldhumid < humiddiff) or (oldhumid - h < humiddif)): + if (oldtemp != "NULL") and ((t - oldtemp < tempdiff) or (oldtemp - t < tempdiff)) and ((h - oldhumid < humiddiff) or (oldhumid - h < humiddiff)): logging.debug('Current temperature close enough to previous temperature and previous temperature is not NULL, it is: %s', oldtemp) logging.debug('Current humidity close enough to previous humidity and previous humidity is not NULL, it is: %s', oldhumid) if (t < maxtemp) and (t > mintemp) and (h < maxhumid) and (h > minhumid):