Skip to content

Commit 997cf54

Browse files
committed
flicker reduction in ntp demo
1 parent 560fcaf commit 997cf54

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ntp_simple_demo/ntp_demo_native.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def get_ntp_time(pool):
6464
# insert external display init
6565

6666
if display:
67+
display.auto_refresh = False
6768
group = displayio.Group()
6869
display.show(group)
6970
text_area = label.Label(
@@ -78,14 +79,19 @@ def get_ntp_time(pool):
7879
text="Hello",
7980
)
8081
group.append(text_area)
82+
display.refresh()
8183

84+
previous_clock = ""
8285

8386
while True:
8487
now = time.localtime()
8588
clock = "{hour:02d}:{min:02d}:{seconds:02d}".format(
8689
hour=now.tm_hour, min=now.tm_min, seconds=now.tm_sec
8790
)
88-
print(clock)
89-
if display:
90-
text_area.text = clock
91+
if clock != previous_clock:
92+
print(clock)
93+
if display:
94+
text_area.text = clock
95+
display.refresh()
96+
previous_clock = clock
9197
time.sleep(0.2)

0 commit comments

Comments
 (0)