From c7494640162192faa1b68ca51446fe66e3371ff6 Mon Sep 17 00:00:00 2001
From: Danilo Bargen <mail@dbrgn.ch>
Date: Wed, 21 Aug 2019 19:30:51 +0200
Subject: [PATCH] ble.py: Show MAC suffix

---
 preload/apps/ble/__init__.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/preload/apps/ble/__init__.py b/preload/apps/ble/__init__.py
index f12562e3a..679ea11aa 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])
 
-- 
GitLab