- trying more filtering
This commit is contained in:
parent
4b7d30754a
commit
ed2445be4f
21
lib/oven.py
21
lib/oven.py
@ -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)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user