Skip to content
Open
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
12 changes: 9 additions & 3 deletions adafruit_magtag/magtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"""

import gc
import time
from time import sleep

import board
from adafruit_portalbase import PortalBase
Expand Down Expand Up @@ -194,16 +194,22 @@ def fetch(
self.refresh()
return values

def refresh(self) -> None:
def refresh(self, blocking=True) -> None:
"""
Refresh the display

:param blocking: Wait to return until the display refresh is complete.
Defaults to True

"""
while True:
try:
self.graphics.display.refresh()
while blocking and board.DISPLAY.busy:
sleep(1)
return
except RuntimeError:
time.sleep(1)
sleep(1)

def remove_all_text(self, auto_refresh=True, clear_font_cache=False):
"""Remove all added text and labels.
Expand Down