Skip to content

Commit

Permalink
flicker reduction in ntp demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Neradoc committed Feb 6, 2023
1 parent 560fcaf commit 997cf54
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ntp_simple_demo/ntp_demo_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def get_ntp_time(pool):
# insert external display init

if display:
display.auto_refresh = False
group = displayio.Group()
display.show(group)
text_area = label.Label(
Expand All @@ -78,14 +79,19 @@ def get_ntp_time(pool):
text="Hello",
)
group.append(text_area)
display.refresh()

previous_clock = ""

while True:
now = time.localtime()
clock = "{hour:02d}:{min:02d}:{seconds:02d}".format(
hour=now.tm_hour, min=now.tm_min, seconds=now.tm_sec
)
print(clock)
if display:
text_area.text = clock
if clock != previous_clock:
print(clock)
if display:
text_area.text = clock
display.refresh()
previous_clock = clock
time.sleep(0.2)

0 comments on commit 997cf54

Please sign in to comment.