add more status reporting over UART

meow
Elia Marcinkiewicz 2023-07-28 22:05:28 +02:00
parent 2805613b50
commit c98c975bcf
1 changed files with 3 additions and 0 deletions

View File

@ -36,16 +36,19 @@ while rf is not None:
if c == 4:
break
hash=hashlib.sha256(str("{0:#0{1}x}".format(int(buf),10)+":"+card[6:8]+card[4:6]+card[2:4]+card[0:2])[2:].encode()).digest().hex()
print('Card hash: {0}'.format(hash))
f = open("hashes")
for user in f:
if(user.strip() == hash):
success = True
if(success):
print('Known hash, opening door')
uart.write("FH")
door.value(1)
utime.sleep(2)
door.value(0)
else:
print('Unknown hash, ignoring')
uart.write("FS")
utime.sleep(2)
buf=''