Skip to content

Commit 37dffc1

Browse files
authored
Merge pull request #1762 from lesamouraipourpre/hallowing-tour-guide
HalloWing Tour Guide: Update for CP7
2 parents 9f7b2b1 + 7d735d0 commit 37dffc1

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

HalloWing_Tour_Guide/code.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# Turn on the basic GGA and RMC info (what you typically want)
3030
gps.send_command(b'PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0')
3131

32-
# Set update rate to once a second (1hz) which is what you typically want.
32+
# Set update rate to once a second (1Hz) which is what you typically want.
3333
gps.send_command(b'PMTK220,1000')
3434

3535
switch_io = DigitalInOut(board.SENSE)
@@ -38,7 +38,7 @@
3838

3939
switch = Debouncer(switch_io)
4040

41-
audio = audioio.AudioOut(board.A0)
41+
audio = audioio.AudioOut(board.SPEAKER)
4242

4343
backlight = DigitalInOut(board.TFT_BACKLIGHT)
4444
backlight.direction = Direction.OUTPUT
@@ -60,19 +60,27 @@ def play_wave(filename):
6060
pass
6161

6262
def show_image(filename):
63-
image_file = None
63+
# CircuitPython 6 & 7 compatible
6464
try:
6565
image_file = open(filename, "rb")
6666
except OSError:
6767
image_file = open("missing.bmp", "rb")
6868
odb = displayio.OnDiskBitmap(image_file)
69-
face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0, 0))
69+
face = displayio.TileGrid(
70+
odb,
71+
pixel_shader=getattr(odb, 'pixel_shader', displayio.ColorConverter())
72+
)
73+
74+
# # CircuitPython 7+ compatible
75+
# try:
76+
# odb = displayio.OnDiskBitmap(filename)
77+
# except (OSError, ValueError):
78+
# odb = displayio.OnDiskBitmap("missing.bmp")
79+
# face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)
80+
7081
backlight.value = False
7182
splash.append(face)
72-
try:
73-
board.DISPLAY.refresh(target_frames_per_second=60)
74-
except AttributeError:
75-
board.DISPLAY.wait_for_frame()
83+
board.DISPLAY.refresh(target_frames_per_second=60)
7684
backlight.value = True
7785

7886

0 commit comments

Comments
 (0)