1616from adafruit_mcp9600 import MCP9600
1717
1818TITLE = "EZ Make Oven Controller"
19- VERSION = "1.0.1 "
19+ VERSION = "1.1.0 "
2020
2121print (TITLE , "version " , VERSION )
2222time .sleep (2 )
@@ -248,7 +248,7 @@ def enable(self, enable):
248248class 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):
418421oven = ReflowOvenControl (board .D4 )
419422print ("melting point: " , oven .sprofile ["melting_point" ])
420423font1 = bitmap_font .load_font ("/fonts/OpenSans-9.bdf" )
424+ font1 .load_glyphs (b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:' )
421425font2 = bitmap_font .load_font ("/fonts/OpenSans-12.bdf" )
426+ font2 .load_glyphs (b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:' )
422427font3 = bitmap_font .load_font ("/fonts/OpenSans-16.bdf" )
428+ font3 .load_glyphs (b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/:' )
429+
423430
424431label_reflow = label .Label (font1 , text = "" , max_glyphs = 10 ,
425432 color = LABEL_COLOR , line_spacing = 0 )
@@ -477,8 +484,8 @@ def format_time(seconds):
477484
478485sgraph .xstart = 100
479486sgraph .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
482489sgraph .xmin = oven .sprofile ["time_range" ][0 ]
483490sgraph .xmax = oven .sprofile ["time_range" ][1 ]
484491sgraph .ymin = oven .sprofile ["temp_range" ][0 ]
@@ -488,7 +495,7 @@ def format_time(seconds):
488495draw_profile (sgraph , oven .sprofile )
489496buttons = []
490497if 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