Skip to content

Commit 5105757

Browse files
authored
Merge pull request adafruit#973 from cogliano/master
EZ Make Oven: PyPortal Titano support, other enhancements
2 parents bbb1e1a + 22a06d2 commit 5105757

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

PyPortal_EZ_Make_Oven/code.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from adafruit_mcp9600 import MCP9600
1717

1818
TITLE = "EZ Make Oven Controller"
19-
VERSION = "1.0.1"
19+
VERSION = "1.1.0"
2020

2121
print(TITLE, "version ", VERSION)
2222
time.sleep(2)
@@ -248,7 +248,7 @@ def enable(self, enable):
248248
class Graph(object):
249249
def __init__(self):
250250
self.xmin = 0
251-
self.xmax = 360
251+
self.xmax = 720 # graph up to 12 minutes
252252
self.ymin = 0
253253
self.ymax = 240
254254
self.xstart = 0
@@ -303,6 +303,9 @@ def draw_line(self, x1, y1, x2, y2, size=PROFILE_SIZE, color=1, style=1):
303303

304304
def draw_graph_point(self, x, y, size=PROFILE_SIZE, color=1):
305305
""" draw point using graph coordinates """
306+
307+
# wrap around graph point when x goes out of bounds
308+
x = (x - self.xmin) % (self.xmax - self.xmin) + self.xmin
306309
xx = (self.xstart + self.width * (x - self.xmin)
307310
// (self.xmax - self.xmin))
308311
yy = (self.ystart + int(self.height * (y - self.ymin)
@@ -418,8 +421,12 @@ def format_time(seconds):
418421
oven = ReflowOvenControl(board.D4)
419422
print("melting point: ", oven.sprofile["melting_point"])
420423
font1 = bitmap_font.load_font("/fonts/OpenSans-9.bdf")
424+
font1.load_glyphs(b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:')
421425
font2 = bitmap_font.load_font("/fonts/OpenSans-12.bdf")
426+
font2.load_glyphs(b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:')
422427
font3 = bitmap_font.load_font("/fonts/OpenSans-16.bdf")
428+
font3.load_glyphs(b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:')
429+
423430

424431
label_reflow = label.Label(font1, text="", max_glyphs=10,
425432
color=LABEL_COLOR, line_spacing=0)
@@ -477,8 +484,8 @@ def format_time(seconds):
477484

478485
sgraph.xstart = 100
479486
sgraph.ystart = 4
480-
sgraph.width = 216
481-
sgraph.height = 160
487+
sgraph.width = WIDTH - sgraph.xstart - 4 # 216 for standard PyPortal
488+
sgraph.height = HEIGHT - 80 # 160 for standard PyPortal
482489
sgraph.xmin = oven.sprofile["time_range"][0]
483490
sgraph.xmax = oven.sprofile["time_range"][1]
484491
sgraph.ymin = oven.sprofile["temp_range"][0]
@@ -488,7 +495,7 @@ def format_time(seconds):
488495
draw_profile(sgraph, oven.sprofile)
489496
buttons = []
490497
if oven.sensor_status:
491-
button = Button(x=0, y=200, width=80, height=40,
498+
button = Button(x=0, y=HEIGHT-40, width=80, height=40,
492499
label="Start", label_font=font2)
493500
buttons.append(button)
494501

0 commit comments

Comments
 (0)