Skip to content

Commit b104678

Browse files
committed
Check for hot oven when starting
1 parent 7228f66 commit b104678

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

PyPortal_EZ_Make_Oven/code.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(self, pin):
108108
with open("/profiles/" + self.config["profile"] + ".json", mode="r") as fpr:
109109
self.sprofile = json.load(fpr)
110110
fpr.close()
111-
i2c = busio.I2C(board.SCL, board.SDA, frequency=200000)
111+
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
112112
try:
113113
self.sensor = MCP9600(i2c, self.config["sensor_address"], "K")
114114
self.ontemp = self.sensor.temperature
@@ -123,6 +123,10 @@ def __init__(self, pin):
123123
self.reflow_start = 0
124124
self.beep = Beep()
125125
self.set_state("ready")
126+
if self.sensor_status:
127+
if self.sensor.temperature >= 50:
128+
self.last_state = "wait"
129+
self.set_state("wait")
126130

127131
def reset(self):
128132
self.ontime = 0
@@ -217,8 +221,7 @@ def check_state(self):
217221
checktime += 5
218222
if not checkoven:
219223
# hold oven temperature
220-
if (self.state in ("start", "preheat", "soak") and
221-
self.offtemp > self.sensor.temperature):
224+
if self.state in ("start", "preheat", "soak") and self.offtemp > self.sensor.temperature:
222225
checkoven = True
223226
self.enable(checkoven)
224227

@@ -375,7 +378,7 @@ def draw_profile(graph, profile):
375378
# draw time line (horizontal)
376379
graph.draw_line(graph.xmin, graph.ymin, graph.xmax, graph.ymin, AXIS_SIZE, 4, 1)
377380
graph.draw_line(graph.xmin, graph.ymax - AXIS_SIZE, graph.xmax, graph.ymax
378-
- AXIS_SIZE, AXIS_SIZE, 4, 1)
381+
- AXIS_SIZE, AXIS_SIZE, 4, 1)
379382
# draw time ticks
380383
tick = graph.xmin
381384
while tick < (graph.xmax - graph.xmin):
@@ -386,7 +389,7 @@ def draw_profile(graph, profile):
386389
# draw temperature line (vertical)
387390
graph.draw_line(graph.xmin, graph.ymin, graph.xmin, graph.ymax, AXIS_SIZE, 4, 1)
388391
graph.draw_line(graph.xmax - AXIS_SIZE, graph.ymin, graph.xmax - AXIS_SIZE,
389-
graph.ymax, AXIS_SIZE, 4, 1)
392+
graph.ymax, AXIS_SIZE, 4, 1)
390393
# draw temperature ticks
391394
tick = graph.ymin
392395
while tick < (graph.ymax - graph.ymin)*1.1:
@@ -497,6 +500,7 @@ def format_time(seconds):
497500
last_state = "ready"
498501
last_control = False
499502
second_timer = time.monotonic()
503+
timer = time.monotonic()
500504
while True:
501505
board.DISPLAY.refresh_soon()
502506
oven.beep.refresh() # this allows beeps less than one second in length

0 commit comments

Comments
 (0)