fix spaces

This commit is contained in:
Martin Quarda
2025-03-25 08:11:28 +01:00
parent cee41ca595
commit c441dc7a32
9 changed files with 112 additions and 119 deletions

View File

@@ -406,4 +406,3 @@ class PN532:
_COMMAND_INDATAEXCHANGE, params=params, response_length=1
)
return response[0] == 0x00

View File

@@ -84,12 +84,12 @@ def read_nfc_loop():
# Try again if no card is available.
if uid is not None:
break
set_neopixel_color(255,255,0)
ntag_string = 'Data: '
sys.stdout.write('Reading ntag \r')
leds_on = 0
for page in range(20,40):
try:
@@ -105,7 +105,7 @@ def read_nfc_loop():
if leds_on > 7:
leds_on = 7
led_strip.write()
if ntag2xx_page is not None:
for char in ntag2xx_page:
ntag_string += chr(char)
@@ -115,11 +115,11 @@ def read_nfc_loop():
except:
sys.stdout.write('Error reading card\r')
return 1
set_neopixel_color(0,255,0)
sys.stdout.write(ntag_string + '\r')
time.sleep(3)
return 0
#print('PAGE ',page,': ',[chr(x) for x in ntag2xx_page])
@@ -138,14 +138,14 @@ def write_nfc_loop(data):
# Try again if no card is available.
if uid is not None:
break
set_neopixel_color(255,255,0)
sys.stdout.write('Erasing card\r')
for page in range(20,41):
content_erase = b'\x00\x00\x00\x00'
pn532.ntag2xx_write_block(page, content_erase)
sys.stdout.write('Writing card\r')
for page in range(20,20 + pages):
content_slice = bytearray(4)
@@ -157,7 +157,7 @@ def write_nfc_loop(data):
#content_slice.append(content[i + 4 * (page - 20)])
print(content_slice)
pn532.ntag2xx_write_block(page, content_slice)
sys.stdout.write('Write done\r')
set_neopixel_color(0,255,0)