From f223be9209793524747452d84f761770e1c7b531 Mon Sep 17 00:00:00 2001 From: bton Date: Wed, 17 Apr 2024 19:46:43 +0200 Subject: [PATCH] display in NFC_Reader --- NFC_Reader.py | 4 ++-- oled.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NFC_Reader.py b/NFC_Reader.py index 9db376e..339f9d2 100644 --- a/NFC_Reader.py +++ b/NFC_Reader.py @@ -3,7 +3,7 @@ import nfc import subprocess import requests import oled -from threading import Thread +import subprocess url="http://172.16.1.105/api/" @@ -21,7 +21,7 @@ def onTagSense(tag): response = requests.post(f"{url}tag_id", data={"id":id}) try: if response.json()["mode"] == "balance" or response.json()["mode"] == "message": - # subprocess? Thread(target=oled.Balance, args=(response.json()["username"], response.json()["balance"])).run() + subprocess.run(oled.balance(response.json()["user"], responese.json()["balance"])) return True except: None diff --git a/oled.py b/oled.py index 1cc6ac9..07b5c5e 100644 --- a/oled.py +++ b/oled.py @@ -10,7 +10,7 @@ def clear(): display.fill(0) display.show() -async def Balance(user_name, balance): +async def balance(user_name, balance): await clear() display.text(str(user_name), 50, 0, (255,255,255), size=1) display.text(str(balance), 0, 15, (255,255,255), size=2) @@ -18,7 +18,7 @@ async def Balance(user_name, balance): await time.sleep(5) await clear() -def Error(code): +def error(code): clear() display.text("!!!!ERROR!!!!", 50, 0 (255,255,255), size=2) display.text(str(code), 50, 10, (255,255,255), size=2)