diff --git a/preload/apps/ble/__init__.py b/preload/apps/ble/__init__.py index f12562e3ac2bcafe3025b1955b20ccbced8bc744..679ea11aa3eaa96d26d2b95e0244e9dc60d112e1 100644 --- a/preload/apps/ble/__init__.py +++ b/preload/apps/ble/__init__.py @@ -4,6 +4,7 @@ import utime import buttons CONFIG_NAME = "ble.txt" +MAC_NAME = "mac.txt" ACTIVE_STRING = "active=true" INACTIVE_STRING = "active=false" @@ -14,6 +15,12 @@ def init(): f.write(INACTIVE_STRING) +def load_mac(): + if MAC_NAME in os.listdir("."): + with open(MAC_NAME) as f: + return f.read().strip() + + def triangle(disp, x, y, left): yf = 1 if left else -1 scale = 6 @@ -48,6 +55,9 @@ def headline(): disp.print("BLE", posy=0, fg=[0, 255, 255]) if is_active(): disp.print("active", posy=20, fg=[0, 255, 255]) + mac = load_mac() + if mac is not None: + disp.print(mac[9:], posy=60, fg=[0, 0, 255]) else: disp.print("inactive", posy=20, fg=[0, 255, 255])