@@ -19,23 +19,23 @@ def __init__(self, is_celsius=False):
1919 :param bool is_celsius: Temperature displayed in Celsius.
2020 """
2121 # root displayio group
22- root_group = displayio .Group (max_size = 23 )
22+ root_group = displayio .Group ()
2323 self .display = board .DISPLAY
2424 self .display .show (root_group )
25- super ().__init__ (max_size = 15 )
25+ super ().__init__ ()
2626
2727 # temperature display option
2828 self ._is_celsius = is_celsius
2929
3030 # create background icon group
31- self ._icon_group = displayio .Group (max_size = 3 )
31+ self ._icon_group = displayio .Group ()
3232 self .display .show (self ._icon_group )
3333 # create text object group
34- self ._text_group = displayio .Group (max_size = 40 )
34+ self ._text_group = displayio .Group ()
3535
3636 print ("Displaying splash screen" )
3737 self ._icon_sprite = None
38- self ._icon_file = None
38+ self ._icon_file = None # Remove once CircuitPython 6 support is dropped
3939 self ._cwd = cwd
4040 self .set_icon (self ._cwd + "/images/gcp_splash.bmp" )
4141
@@ -48,7 +48,7 @@ def __init__(self, is_celsius=False):
4848 self ._text_group .append (header_group )
4949
5050 # Temperature Display
51- temp_group = displayio .Group (scale = 2 , max_size = 3 )
51+ temp_group = displayio .Group (scale = 2 )
5252 temp_label = Label (font , text = "Temperature: " )
5353 temp_label .x = (self .display .width // 2 ) // 11
5454 temp_label .y = 55
@@ -61,7 +61,7 @@ def __init__(self, is_celsius=False):
6161 self ._text_group .append (temp_group )
6262
6363 # Water Level
64- water_group = displayio .Group (scale = 2 , max_size = 2 )
64+ water_group = displayio .Group (scale = 2 )
6565 self .water_level = Label (font , text = "Water Level: " )
6666 self .water_level .x = (self .display .width // 2 ) // 11
6767 self .water_level .y = 75
@@ -131,16 +131,19 @@ def set_icon(self, filename):
131131
132132 if not filename :
133133 return # we're done, no icon desired
134+
135+ # CircuitPython 6 & 7 compatible
134136 if self ._icon_file :
135137 self ._icon_file .close ()
136138 self ._icon_file = open (filename , "rb" )
137139 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)
145148
146149 self ._icon_group .append (self ._icon_sprite )
0 commit comments