From ec69daf53906ca00741eb198882754fe3e4847af Mon Sep 17 00:00:00 2001 From: James Carr Date: Fri, 23 Jul 2021 11:32:03 +0100 Subject: [PATCH 1/2] Remove max_size usage with displayio.Group Remove max_glyphs usage with Display_Text Label --- CircuitPython_Pyloton/pyloton.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CircuitPython_Pyloton/pyloton.py b/CircuitPython_Pyloton/pyloton.py index ab9381508..f9482f8f8 100644 --- a/CircuitPython_Pyloton/pyloton.py +++ b/CircuitPython_Pyloton/pyloton.py @@ -129,7 +129,7 @@ def __init__(self, ble, display, circ, heart=True, speed=True, cad=True, ams=Tru self.start = time.time() - self.splash = displayio.Group(max_size=25) + self.splash = displayio.Group() self.loading_group = displayio.Group() self._load_fonts() @@ -140,9 +140,9 @@ def __init__(self, ble, display, circ, heart=True, speed=True, cad=True, ams=Tru self.text_group = displayio.Group() self.status = label.Label(font=self.arial12, x=10, y=200, - text='', color=self.YELLOW, max_glyphs=30) + text='', color=self.YELLOW) self.status1 = label.Label(font=self.arial12, x=10, y=220, - text='', color=self.YELLOW, max_glyphs=30) + text='', color=self.YELLOW) self.text_group.append(self.status) self.text_group.append(self.status1) @@ -413,7 +413,7 @@ def _label_maker(self, text, x, y, font=None): """ if not font: font = self.arial24 - return label.Label(font=font, x=x, y=y, text=text, color=self.WHITE, max_glyphs=30) + return label.Label(font=font, x=x, y=y, text=text, color=self.WHITE) def _get_y(self): From 9fce12733e58d435ddfb416bb975a2bb8bc77efb Mon Sep 17 00:00:00 2001 From: James Carr Date: Fri, 23 Jul 2021 12:12:03 +0100 Subject: [PATCH 2/2] Update OnDiskBitmap usage to take a filename string in CP7 --- CircuitPython_Pyloton/pyloton.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CircuitPython_Pyloton/pyloton.py b/CircuitPython_Pyloton/pyloton.py index f9482f8f8..a3c70f257 100644 --- a/CircuitPython_Pyloton/pyloton.py +++ b/CircuitPython_Pyloton/pyloton.py @@ -154,7 +154,11 @@ def show_splash(self): """ if self.debug: return - with open('blinka-pyloton.bmp', 'rb') as bitmap_file: + + blinka_bitmap = "blinka-pyloton.bmp" + + # Compatible with CircuitPython 6 & 7 + with open(blinka_bitmap, 'rb') as bitmap_file: bitmap1 = displayio.OnDiskBitmap(bitmap_file) tile_grid = displayio.TileGrid(bitmap1, pixel_shader=getattr(bitmap1, 'pixel_shader', displayio.ColorConverter())) self.loading_group.append(tile_grid) @@ -165,6 +169,16 @@ def show_splash(self): self.loading_group.append(rect) self.loading_group.append(status_heading) + # # Compatible with CircuitPython 7+ + # bitmap1 = displayio.OnDiskBitmap(blinka_bitmap) + # tile_grid = displayio.TileGrid(bitmap1, pixel_shader=bitmap1.pixel_shader) + # self.loading_group.append(tile_grid) + # self.display.show(self.loading_group) + # status_heading = label.Label(font=self.arial16, x=80, y=175, + # text="Status", color=self.YELLOW) + # rect = Rect(0, 165, 240, 75, fill=self.PURPLE) + # self.loading_group.append(rect) + # self.loading_group.append(status_heading) def _load_fonts(self): """