Skip to content

Commit 3b1b115

Browse files
committed
pyportal smart thermometer station cp7 updates
1 parent bd7536a commit 3b1b115

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

PyPortal_Smart_Thermometer/thermometer_helper.py

+16-15
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ def __init__(self, celsius=True, usa_date=True):
2020
:param bool usa_date: Use mon/day/year date-time formatting.
2121
"""
2222
# root displayio group
23-
root_group = displayio.Group(max_size=20)
23+
root_group = displayio.Group()
2424
board.DISPLAY.show(root_group)
25-
super().__init__(max_size=20)
25+
super().__init__()
2626

2727
self._celsius = celsius
2828
self._usa_date = usa_date
2929

3030
# create background icon group
31-
self._icon_group = displayio.Group(max_size=1)
31+
self._icon_group = displayio.Group()
3232
board.DISPLAY.show(self._icon_group)
3333
# create text object group
34-
self._text_group = displayio.Group(max_size=6)
34+
self._text_group = displayio.Group()
3535

3636
self._icon_sprite = None
3737
self._icon_file = None
@@ -58,22 +58,22 @@ def __init__(self, celsius=True, usa_date=True):
5858
self.subtitle_text.y = 35
5959
self._text_group.append(self.subtitle_text)
6060

61-
self.temp_text = Label(self.c_font, max_glyphs=8)
61+
self.temp_text = Label(self.c_font)
6262
self.temp_text.x = 25
6363
self.temp_text.y = 110
6464
self._text_group.append(self.temp_text)
6565

66-
self.time_text = Label(self.info_font, max_glyphs=40)
66+
self.time_text = Label(self.info_font)
6767
self.time_text.x = 240
6868
self.time_text.y = 150
6969
self._text_group.append(self.time_text)
7070

71-
self.date_text = Label(self.info_font, max_glyphs=40)
71+
self.date_text = Label(self.info_font)
7272
self.date_text.x = 30
7373
self.date_text.y = 160
7474
self._text_group.append(self.date_text)
7575

76-
self.io_status_text = Label(self.info_font, max_glyphs=40)
76+
self.io_status_text = Label(self.info_font)
7777
self.io_status_text.x = 100
7878
self.io_status_text.y = 220
7979
self._text_group.append(self.io_status_text)
@@ -130,14 +130,15 @@ def set_icon(self, filename):
130130
return # we're done, no icon desired
131131
if self._icon_file:
132132
self._icon_file.close()
133+
134+
# CircuitPython 6 & 7 compatible
133135
self._icon_file = open(filename, "rb")
134136
icon = displayio.OnDiskBitmap(self._icon_file)
135-
try:
136-
self._icon_sprite = displayio.TileGrid(icon,
137-
pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()))
138-
except TypeError:
139-
self._icon_sprite = displayio.TileGrid(icon,
140-
pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()),
141-
position=(0,0))
137+
self._icon_sprite = displayio.TileGrid(icon,
138+
pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()))
139+
140+
# # CircuitPython 7+ compatible
141+
# icon = displayio.OnDiskBitmap(filename)
142+
# self._icon_sprite = displayio.TileGrid(icon, pixel_shader=icon.pixel_shader)
142143

143144
self._icon_group.append(self._icon_sprite)

0 commit comments

Comments
 (0)