fixing divide by zero bug when thermocouple read fails five times in a

row
pull/20/head^2^2
Jason Bruce 2021-04-29 15:08:53 -04:00
rodzic e16aab8e66
commit 775eb0a0f2
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -128,7 +128,8 @@ class TempSensorReal(TempSensor):
except Exception:
log.exception("problem reading temp")
time.sleep(sleeptime)
self.temperature = sum(temps)/len(temps)
if len(temps) > 0:
self.temperature = sum(temps)/len(temps)
class Oven(threading.Thread):
'''parent oven class. this has all the common code