|
12 | 12 | import audioio |
13 | 13 | import audiocore |
14 | 14 | # Setup LED and PIR pins |
15 | | -LED_PIN = board.D13 # Pin number for the board's built in LED. |
| 15 | +LED_PIN = board.LED # Pin number for the board's built in LED. |
16 | 16 | PIR_PIN = board.SENSE # Pin port connected to PIR sensor output wire. |
17 | 17 | # Setup digital input for PIR sensor: |
18 | 18 | pir = digitalio.DigitalInOut(PIR_PIN) |
@@ -94,16 +94,21 @@ def blink(count, speed): |
94 | 94 | "trap_set.bmp"] |
95 | 95 | # Function for displaying images on HalloWing TFT screen |
96 | 96 | def show_image(filename): |
| 97 | + # CircuitPython 6 & 7 compatible |
97 | 98 | image_file = open(filename, "rb") |
98 | 99 | odb = displayio.OnDiskBitmap(image_file) |
99 | | - face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0, 0)) |
| 100 | + face = displayio.TileGrid( |
| 101 | + odb, |
| 102 | + pixel_shader=getattr(odb, 'pixel_shader', displayio.ColorConverter()) |
| 103 | + ) |
| 104 | + |
| 105 | + # # CircuitPython 7+ compatible |
| 106 | + # odb = displayio.OnDiskBitmap(filename) |
| 107 | + # face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader) |
| 108 | + |
100 | 109 | backlight.duty_cycle = 0 |
101 | 110 | splash.append(face) |
102 | | - # Wait for the image to load. |
103 | | - try: |
104 | | - board.DISPLAY.refresh(target_frames_per_second=60) |
105 | | - except AttributeError: |
106 | | - board.DISPLAY.wait_for_frame() |
| 111 | + board.DISPLAY.refresh(target_frames_per_second=60) |
107 | 112 | backlight.duty_cycle = max_brightness |
108 | 113 |
|
109 | 114 | beep(1) # startup beep |
|
0 commit comments