- trying more filtering

This commit is contained in:
jbruce12000 2018-12-23 12:46:22 -05:00
parent 4b7d30754a
commit ed2445be4f

View File

@ -227,17 +227,16 @@ class TempSensorReal(TempSensor):
def run(self):
while True:
maxtries = 10
final = 0
for x in range(0,maxtries):
try:
temp = self.thermocouple.get()
except Exception:
log.exception("problem reading temp")
if temp > final:
final = temp
if final > 0:
self.temperature = final
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)