From b960bb4710cdb65f76519137d74ec6131503b781 Mon Sep 17 00:00:00 2001 From: James Kirikland Garner Date: Sat, 24 Dec 2022 13:56:07 -0800 Subject: [PATCH] Fixed running seek on auto restart bug. --- config.py | 2 +- lib/oven.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config.py b/config.py index 1b5fd77..79ce694 100644 --- a/config.py +++ b/config.py @@ -211,7 +211,7 @@ ignore_tc_too_many_errors = False # cleaned up (deleted) by the OS on boot. # The state file is written to disk every sensor_time_wait seconds (2s by default) # and is written in the same directory as config.py. -automatic_restarts = False +automatic_restarts = True automatic_restart_window = 15 # max minutes since power outage automatic_restart_state_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ),'state.json')) diff --git a/lib/oven.py b/lib/oven.py index 20624b4..48fe985 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -339,12 +339,13 @@ class Oven(threading.Thread): startat = 0 return startat - def run_profile(self, profile, startat=0): + def run_profile(self, profile, startat=0, auto_start=False): runtime = startat * 60 - if self.state == 'IDLE': - if config.seek_start: - temp = self.board.temp_sensor.temperature() # Defined in a subclass - runtime += self.get_start_from_temperature(profile, temp) + if not auto_start: + if self.state == 'IDLE': + if config.seek_start: + temp = self.board.temp_sensor.temperature() # Defined in a subclass + runtime += self.get_start_from_temperature(profile, temp) self.reset() self.startat = startat * 60 @@ -484,7 +485,7 @@ class Oven(threading.Thread): with open(profile_path) as infile: profile_json = json.dumps(json.load(infile)) profile = Profile(profile_json) - self.run_profile(profile,startat=startat) + self.run_profile(profile,startat=startat, auto_start=True) self.cost = d["cost"] time.sleep(1) self.ovenwatcher.record(profile)