|
17 | 17 |
|
18 | 18 | # --- Display setup ---
|
19 | 19 | matrix = Matrix(bit_depth=4)
|
20 |
| -sprite_group = displayio.Group(max_size=1) |
| 20 | +sprite_group = displayio.Group() |
21 | 21 | matrix.display.show(sprite_group)
|
22 | 22 |
|
23 | 23 | # --- Button setup ---
|
@@ -57,27 +57,34 @@ def load_image():
|
57 | 57 | while sprite_group:
|
58 | 58 | sprite_group.pop()
|
59 | 59 |
|
60 |
| - bitmap = displayio.OnDiskBitmap( |
61 |
| - open(SPRITESHEET_FOLDER + "/" + file_list[current_image], "rb") |
62 |
| - ) |
63 |
| - |
64 |
| - frame_count = int(bitmap.height / matrix.display.height) |
65 |
| - frame_duration = DEFAULT_FRAME_DURATION |
66 |
| - if file_list[current_image] in FRAME_DURATION_OVERRIDES: |
67 |
| - frame_duration = FRAME_DURATION_OVERRIDES[file_list[current_image]] |
| 60 | + filename = SPRITESHEET_FOLDER + "/" + file_list[current_image] |
68 | 61 |
|
| 62 | + # CircuitPython 6 & 7 compatible |
| 63 | + bitmap = displayio.OnDiskBitmap(open(filename, "rb")) |
69 | 64 | sprite = displayio.TileGrid(
|
70 | 65 | bitmap,
|
71 | 66 | pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter()),
|
72 |
| - width=1, |
73 |
| - height=1, |
74 | 67 | tile_width=bitmap.width,
|
75 | 68 | tile_height=matrix.display.height,
|
76 | 69 | )
|
77 | 70 |
|
| 71 | + # # CircuitPython 7+ compatible |
| 72 | + # bitmap = displayio.OnDiskBitmap(filename) |
| 73 | + # sprite = displayio.TileGrid( |
| 74 | + # bitmap, |
| 75 | + # pixel_shader=bitmap.pixel_shader, |
| 76 | + # tile_width=bitmap.width, |
| 77 | + # tile_height=matrix.display.height, |
| 78 | + # ) |
| 79 | + |
78 | 80 | sprite_group.append(sprite)
|
| 81 | + |
79 | 82 | current_frame = 0
|
80 | 83 | current_loop = 0
|
| 84 | + frame_count = int(bitmap.height / matrix.display.height) |
| 85 | + frame_duration = DEFAULT_FRAME_DURATION |
| 86 | + if file_list[current_image] in FRAME_DURATION_OVERRIDES: |
| 87 | + frame_duration = FRAME_DURATION_OVERRIDES[file_list[current_image]] |
81 | 88 |
|
82 | 89 |
|
83 | 90 | def advance_image():
|
|
0 commit comments