@@ -19,23 +19,23 @@ def __init__(self, is_celsius=False):
19
19
:param bool is_celsius: Temperature displayed in Celsius.
20
20
"""
21
21
# root displayio group
22
- root_group = displayio .Group (max_size = 23 )
22
+ root_group = displayio .Group ()
23
23
self .display = board .DISPLAY
24
24
self .display .show (root_group )
25
- super ().__init__ (max_size = 15 )
25
+ super ().__init__ ()
26
26
27
27
# temperature display option
28
28
self ._is_celsius = is_celsius
29
29
30
30
# create background icon group
31
- self ._icon_group = displayio .Group (max_size = 3 )
31
+ self ._icon_group = displayio .Group ()
32
32
self .display .show (self ._icon_group )
33
33
# create text object group
34
- self ._text_group = displayio .Group (max_size = 40 )
34
+ self ._text_group = displayio .Group ()
35
35
36
36
print ("Displaying splash screen" )
37
37
self ._icon_sprite = None
38
- self ._icon_file = None
38
+ self ._icon_file = None # Remove once CircuitPython 6 support is dropped
39
39
self ._cwd = cwd
40
40
self .set_icon (self ._cwd + "/images/gcp_splash.bmp" )
41
41
@@ -48,7 +48,7 @@ def __init__(self, is_celsius=False):
48
48
self ._text_group .append (header_group )
49
49
50
50
# Temperature Display
51
- temp_group = displayio .Group (scale = 2 , max_size = 3 )
51
+ temp_group = displayio .Group (scale = 2 )
52
52
temp_label = Label (font , text = "Temperature: " )
53
53
temp_label .x = (self .display .width // 2 ) // 11
54
54
temp_label .y = 55
@@ -61,7 +61,7 @@ def __init__(self, is_celsius=False):
61
61
self ._text_group .append (temp_group )
62
62
63
63
# Water Level
64
- water_group = displayio .Group (scale = 2 , max_size = 2 )
64
+ water_group = displayio .Group (scale = 2 )
65
65
self .water_level = Label (font , text = "Water Level: " )
66
66
self .water_level .x = (self .display .width // 2 ) // 11
67
67
self .water_level .y = 75
@@ -131,16 +131,19 @@ def set_icon(self, filename):
131
131
132
132
if not filename :
133
133
return # we're done, no icon desired
134
+
135
+ # CircuitPython 6 & 7 compatible
134
136
if self ._icon_file :
135
137
self ._icon_file .close ()
136
138
self ._icon_file = open (filename , "rb" )
137
139
icon = displayio .OnDiskBitmap (self ._icon_file )
138
- try :
139
- self ._icon_sprite = displayio .TileGrid (icon ,
140
- pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()))
141
- except TypeError :
142
- self ._icon_sprite = displayio .TileGrid (icon ,
143
- pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()),
144
- position = (0 ,0 ))
140
+ self ._icon_sprite = displayio .TileGrid (
141
+ icon ,
142
+ pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ())
143
+ )
144
+
145
+ # # CircuitPython 7+ compatible
146
+ # icon = displayio.OnDiskBitmap(filename)
147
+ # self._icon_sprite = displayio.TileGrid(icon, pixel_shader=icon.pixel_shader)
145
148
146
149
self ._icon_group .append (self ._icon_sprite )
0 commit comments