Skip to content

Updated code to work on CP 4 and 5 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2019
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
20 changes: 14 additions & 6 deletions adafruit_pyoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,11 @@ def display_card(self, card_num):
self._display_background_for(card)
self.backlight_fade(1.0)
self._display_text_for(card)

board.DISPLAY.refresh_soon()
board.DISPLAY.wait_for_frame()
try:
board.DISPLAY.refresh(target_frames_per_second=60)
except AttributeError:
board.DISPLAY.refresh_soon()
board.DISPLAY.wait_for_frame()

self._play_sound_for(card)

Expand Down Expand Up @@ -302,7 +304,10 @@ def play_sound(self, filename, *, wait_to_finish=True, loop=False):
return # nothing more to do, just stopped
filename = self._gamedirectory+"/"+filename
print("Playing sound", filename)
board.DISPLAY.wait_for_frame()
try:
board.DISPLAY.refresh(target_frames_per_second=60)
except AttributeError:
board.DISPLAY.wait_for_frame()
try:
self._wavfile = open(filename, "rb")
except OSError:
Expand Down Expand Up @@ -369,8 +374,11 @@ def set_background(self, filename, *, with_fade=True):
x=0, y=0)
self._background_group.append(self._background_sprite)
if with_fade:
board.DISPLAY.refresh_soon()
board.DISPLAY.wait_for_frame()
try:
board.DISPLAY.refresh(target_frames_per_second=60)
except AttributeError:
board.DISPLAY.refresh_soon()
board.DISPLAY.wait_for_frame()
self.backlight_fade(1.0)

def backlight_fade(self, to_light):
Expand Down