Skip to content

Commit

Permalink
Merge pull request #19 from ladyada/main
Browse files Browse the repository at this point in the history
retry refreshing a few times, let us update faster too
  • Loading branch information
ladyada authored Nov 23, 2020
2 parents e53e1bb + 2d907f4 commit 056ad75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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()
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

0 comments on commit 056ad75

Please sign in to comment.