Skip to content

Commit a3c26f2

Browse files
authored
Merge pull request #1637 from lesamouraipourpre/hand-wash-timer
CLUE Hand Wash Timer: Update for CP7
2 parents 550a5aa + e5f084d commit a3c26f2

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

CLUE_Hand_Wash_Timer/clue_hand_wash_timer.py

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,46 @@
1313
import pwmio
1414

1515
clue.display.brightness = 0.8
16-
clue_display = displayio.Group(max_size=4)
16+
clue_display = displayio.Group()
1717

1818
# draw the background image
19-
wash_on_file = open("wash_on.bmp", "rb")
19+
WASH_ON_FILENAME = "wash_on.bmp"
20+
21+
# CircuitPython 6 & 7 compatible
22+
wash_on_file = open(WASH_ON_FILENAME, "rb")
2023
wash_on_bmp = displayio.OnDiskBitmap(wash_on_file)
21-
wash_on_sprite = displayio.TileGrid(wash_on_bmp, pixel_shader=getattr(wash_on_bmp, 'pixel_shader', displayio.ColorConverter()))
24+
wash_on_sprite = displayio.TileGrid(
25+
wash_on_bmp,
26+
pixel_shader=getattr(wash_on_bmp, 'pixel_shader', displayio.ColorConverter())
27+
)
28+
29+
# # CircuitPython 7+ compatible
30+
# wash_on_bmp = displayio.OnDiskBitmap(WASH_ON_FILENAME)
31+
# wash_on_sprite = displayio.TileGrid(wash_on_bmp, pixel_shader=wash_on_bmp.pixel_shader)
32+
2233
clue_display.append(wash_on_sprite)
2334

2435
# draw the foreground image
25-
wash_off_file = open("wash_off.bmp", "rb")
36+
WASH_OFF_FILENAME = "wash_off.bmp"
37+
38+
# CircuitPython 6 & 7 compatible
39+
wash_off_file = open(WASH_OFF_FILENAME, "rb")
2640
wash_off_bmp = displayio.OnDiskBitmap(wash_off_file)
27-
wash_off_sprite = displayio.TileGrid(wash_off_bmp, pixel_shader=getattr(wash_off_bmp, 'pixel_shader', displayio.ColorConverter()))
41+
wash_off_sprite = displayio.TileGrid(
42+
wash_off_bmp,
43+
pixel_shader=getattr(wash_off_bmp, 'pixel_shader', displayio.ColorConverter())
44+
)
45+
46+
# # CircuitPython 7+ compatible
47+
# wash_off_bmp = displayio.OnDiskBitmap(WASH_OFF_FILENAME)
48+
# wash_off_sprite = displayio.TileGrid(wash_off_bmp, pixel_shader=wash_off_bmp.pixel_shader)
49+
2850
clue_display.append(wash_off_sprite)
2951

3052

3153
# Create text
3254
# first create the group
33-
text_group = displayio.Group(max_size=5, scale=1)
55+
text_group = displayio.Group()
3456
# Make a label
3557
title_font = bitmap_font.load_font("/font/RacingSansOne-Regular-38.bdf")
3658
title_font.load_glyphs("HandWashTimer".encode('utf-8'))
@@ -50,7 +72,7 @@
5072

5173
timer_font = bitmap_font.load_font("/font/RacingSansOne-Regular-29.bdf")
5274
timer_font.load_glyphs("0123456789ADSWabcdefghijklmnopqrstuvwxyz:!".encode('utf-8'))
53-
timer_label = label.Label(timer_font, text="Wave to start", color=0x4f3ab1, max_glyphs=15)
75+
timer_label = label.Label(timer_font, text="Wave to start", color=0x4f3ab1)
5476
timer_label.x = 24
5577
timer_label.y = 100
5678
text_group.append(timer_label)

0 commit comments

Comments
 (0)