- filtering still

This commit is contained in:
jbruce12000 2018-12-23 13:03:40 -05:00
parent ed2445be4f
commit 85dad99945

View File

@ -228,16 +228,19 @@ class TempSensorReal(TempSensor):
def run(self):
while True:
last = self.temperature
try:
temp = self.thermocouple.get()
except Exception:
log.exception("problem reading temp")
if abs(last-temp) > 5:
self.temperature = (last + temp) / 2.0
time.sleep(self.time_step)
maxtries = 5.0
sleeptime = self.time_step / maxtries
maxtemp = 0
for x in range(0,5):
try:
temp = self.thermocouple.get()
except Exception:
log.exception("problem reading temp")
if temp > maxtemp:
maxtemp = temp
time.sleep(sleeptime)
self.temperature = maxtemp
#time.sleep(self.time_step)
class TempSensorSimulate(TempSensor):