NFC animation

This commit is contained in:
Peter D. Gray 2023-12-20 08:03:35 -05:00
parent e8d593e467
commit c4ffe25603
No known key found for this signature in database
GPG Key ID: A2DCD558C2BE5D7C
5 changed files with 16 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

File diff suppressed because one or more lines are too long

View File

@ -215,7 +215,7 @@ class Display:
def image(self, x, y, name):
# display a graphics image, immediately
w,h, data = getattr(Graphics, name)
if x == None:
if x is None:
x = max(0, (WIDTH - w) // 2)
self.gpu.take_spi()
self.dis.show_zpixels(x, y, w, h, data)

View File

@ -308,7 +308,8 @@ class NFCHandler:
await self.setup_gpio()
if dis.has_lcd:
pass # TODO
dis.real_clear() # bugfix
dis.text(None, -2, 'Tap phone to screen, or CANCEL.', dark=True)
else:
from graphics_mk4 import Graphics
frames = [getattr(Graphics, 'mk4_nfc_%d'%i) for i in range(1, 5)]
@ -323,13 +324,14 @@ class NFCHandler:
first = True
while 1:
phase = (phase + 1) % 4
dis.clear()
if dis.has_lcd:
dis.text(None, 4, 'NFC animation fr#%d' % phase)
phase = (phase + 1) % 2
dis.image(None, 59, 'nfc_%d' % phase)
else:
dis.clear()
phase = (phase + 1) % 4
dis.icon(0, 8, frames[phase])
dis.show()
dis.show()
# wait for key or 250ms animation delay
try: