From 377e27e9daa05431254953ac1a7fa9af401500a0 Mon Sep 17 00:00:00 2001 From: benkrasnow <32074649+benkrasnow@users.noreply.github.com> Date: Sat, 9 Jun 2018 16:22:40 -0700 Subject: [PATCH] Update oven.py --- lib/oven.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/oven.py b/lib/oven.py index 9f7316d..c5097ab 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -133,6 +133,9 @@ class Oven (threading.Thread): self.reset() else: temperature_count = 0 + + #Capture the last temperature value. This must be done before set_heat, since there is a sleep in there now. + last_temp = self.temp_sensor.temperature self.set_heat(pid) @@ -151,8 +154,7 @@ class Oven (threading.Thread): if self.runtime >= self.totaltime: self.reset() - #Capture the last temperature value - last_temp = self.temp_sensor.temperature + if pid > 0: time.sleep(self.time_step * (1 - pid)) else: