Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions HalloWing_Tour_Guide/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# Turn on the basic GGA and RMC info (what you typically want)
gps.send_command(b'PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0')

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

switch_io = DigitalInOut(board.SENSE)
Expand All @@ -38,7 +38,7 @@

switch = Debouncer(switch_io)

audio = audioio.AudioOut(board.A0)
audio = audioio.AudioOut(board.SPEAKER)

backlight = DigitalInOut(board.TFT_BACKLIGHT)
backlight.direction = Direction.OUTPUT
Expand All @@ -60,19 +60,27 @@ def play_wave(filename):
pass

def show_image(filename):
image_file = None
# CircuitPython 6 & 7 compatible
try:
image_file = open(filename, "rb")
except OSError:
image_file = open("missing.bmp", "rb")
odb = displayio.OnDiskBitmap(image_file)
face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0, 0))
face = displayio.TileGrid(
odb,
pixel_shader=getattr(odb, 'pixel_shader', displayio.ColorConverter())
)

# # CircuitPython 7+ compatible
# try:
# odb = displayio.OnDiskBitmap(filename)
# except (OSError, ValueError):
# odb = displayio.OnDiskBitmap("missing.bmp")
# face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)

backlight.value = False
splash.append(face)
try:
board.DISPLAY.refresh(target_frames_per_second=60)
except AttributeError:
board.DISPLAY.wait_for_frame()
board.DISPLAY.refresh(target_frames_per_second=60)
backlight.value = True


Expand Down