Skip to content

Commit 036f65f

Browse files
About app: format unique ID as MAC address
1 parent 22a1666 commit 036f65f

File tree

1 file changed

+17
-14
lines changed
  • internal_filesystem/builtin/apps/com.micropythonos.about/assets

1 file changed

+17
-14
lines changed

internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def onCreate(self):
5151
self._add_label(screen, f"sys.version: {sys.version}")
5252
self._add_label(screen, f"sys.implementation: {sys.implementation}")
5353
self._add_label(screen, f"sys.byteorder: {sys.byteorder}")
54-
self._add_label(screen, f"sys.maxsize: {sys.maxsize}")
54+
self._add_label(screen, f"sys.maxsize of integer: {sys.maxsize}")
5555

5656
# MPY version info
5757
self._add_label(screen, f"{lv.SYMBOL.SETTINGS} MicroPython Version", is_header=True)
@@ -107,19 +107,22 @@ def onCreate(self):
107107
print(error)
108108
self._add_label(screen, error)
109109

110-
# Machine info
111-
try:
112-
print("Trying to find out additional board info, not available on every platform...")
113-
self._add_label(screen, f"{lv.SYMBOL.POWER} Machine Info", is_header=True)
114-
import machine
115-
self._add_label(screen, f"machine.freq: {machine.freq()}")
116-
self._add_label(screen, f"machine.unique_id(): {machine.unique_id()}")
117-
self._add_label(screen, f"machine.wake_reason(): {machine.wake_reason()}")
118-
self._add_label(screen, f"machine.reset_cause(): {machine.reset_cause()}")
119-
except Exception as e:
120-
error = f"Could not find machine info because: {e}\nIt's normal to get this error on desktop."
121-
print(error)
122-
self._add_label(screen, error)
110+
# Machine info
111+
try:
112+
print("Trying to find out additional board info, not available on every platform...")
113+
self._add_label(screen, f"{lv.SYMBOL.POWER} Machine Info", is_header=True)
114+
import machine
115+
self._add_label(screen, f"machine.freq: {machine.freq()}")
116+
# Format unique_id as MAC address (AA:BB:CC:DD:EE:FF)
117+
unique_id = machine.unique_id()
118+
mac_address = ':'.join(f'{b:02X}' for b in unique_id)
119+
self._add_label(screen, f"machine.unique_id(): {mac_address}")
120+
self._add_label(screen, f"machine.wake_reason(): {machine.wake_reason()}")
121+
self._add_label(screen, f"machine.reset_cause(): {machine.reset_cause()}")
122+
except Exception as e:
123+
error = f"Could not find machine info because: {e}\nIt's normal to get this error on desktop."
124+
print(error)
125+
self._add_label(screen, error)
123126

124127
# Freezefs info (production builds only)
125128
try:

0 commit comments

Comments
 (0)