Skip to content

retry refreshing a few times, let us update faster too #19

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 2 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion adafruit_magtag/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self, *, default_bg=0xFFFFFF, auto_refresh=True, debug=False):
color_bits_inverted=False,
grayscale=True,
refresh_time=1,
seconds_per_frame=5,
seconds_per_frame=1,
)
else:
self.display = board.DISPLAY
Expand Down
8 changes: 7 additions & 1 deletion adafruit_magtag/magtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"""

import gc
import time
import terminalio
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
Expand Down Expand Up @@ -327,7 +328,12 @@ def refresh(self):
"""
Refresh the display
"""
self.graphics.display.refresh()
while True:
try:
self.graphics.display.refresh()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead do time.sleep(self.graphics.display.time_to_refresh).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does time_to_refresh count down or is it the 'max seconds' to refresh

return
except RuntimeError:
time.sleep(1)

def fetch(self, refresh_url=None, timeout=10):
"""Fetch data from the url we initialized with, perfom any parsing,
Expand Down