16
16
from adafruit_mcp9600 import MCP9600
17
17
18
18
TITLE = "EZ Make Oven Controller"
19
- VERSION = "1.0.1 "
19
+ VERSION = "1.1.0 "
20
20
21
21
print (TITLE , "version " , VERSION )
22
22
time .sleep (2 )
@@ -248,7 +248,7 @@ def enable(self, enable):
248
248
class Graph (object ):
249
249
def __init__ (self ):
250
250
self .xmin = 0
251
- self .xmax = 360
251
+ self .xmax = 720 # graph up to 12 minutes
252
252
self .ymin = 0
253
253
self .ymax = 240
254
254
self .xstart = 0
@@ -303,6 +303,9 @@ def draw_line(self, x1, y1, x2, y2, size=PROFILE_SIZE, color=1, style=1):
303
303
304
304
def draw_graph_point (self , x , y , size = PROFILE_SIZE , color = 1 ):
305
305
""" 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
306
309
xx = (self .xstart + self .width * (x - self .xmin )
307
310
// (self .xmax - self .xmin ))
308
311
yy = (self .ystart + int (self .height * (y - self .ymin )
@@ -418,8 +421,12 @@ def format_time(seconds):
418
421
oven = ReflowOvenControl (board .D4 )
419
422
print ("melting point: " , oven .sprofile ["melting_point" ])
420
423
font1 = bitmap_font .load_font ("/fonts/OpenSans-9.bdf" )
424
+ font1 .load_glyphs (b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:' )
421
425
font2 = bitmap_font .load_font ("/fonts/OpenSans-12.bdf" )
426
+ font2 .load_glyphs (b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:' )
422
427
font3 = bitmap_font .load_font ("/fonts/OpenSans-16.bdf" )
428
+ font3 .load_glyphs (b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:' )
429
+
423
430
424
431
label_reflow = label .Label (font1 , text = "" , max_glyphs = 10 ,
425
432
color = LABEL_COLOR , line_spacing = 0 )
@@ -477,8 +484,8 @@ def format_time(seconds):
477
484
478
485
sgraph .xstart = 100
479
486
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
482
489
sgraph .xmin = oven .sprofile ["time_range" ][0 ]
483
490
sgraph .xmax = oven .sprofile ["time_range" ][1 ]
484
491
sgraph .ymin = oven .sprofile ["temp_range" ][0 ]
@@ -488,7 +495,7 @@ def format_time(seconds):
488
495
draw_profile (sgraph , oven .sprofile )
489
496
buttons = []
490
497
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 ,
492
499
label = "Start" , label_font = font2 )
493
500
buttons .append (button )
494
501
0 commit comments