From 65b0f867324dd634a29a09acdd896099c834b1ea Mon Sep 17 00:00:00 2001 From: Tomas Krejci Date: Tue, 28 May 2024 18:57:20 +0200 Subject: [PATCH] up device id --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 468b50a..d901048 100644 --- a/main.py +++ b/main.py @@ -14,6 +14,10 @@ else: from pyb import Pin, LED import uasyncio as asyncio +device_id = "" +for b in machine.unique_id(): + device_id += "{:02X}".format(b) +# device_id_hex = int(device_id) #### BLE UART ### import ble_uart @@ -26,7 +30,7 @@ def print_handler(): ble = bluetooth.BLE() -uart = ble_uart.Ble_uart(ble, on_rx=print_handler, name="OpenLaserTag Device") +uart = ble_uart.Ble_uart(ble, on_rx=print_handler, name=print("LaserTag")) #### OLT IR RX imports ### import ustruct @@ -151,6 +155,8 @@ async def cb(byte1, byte2, byte3, packet): async def main(proto): logger.debug("main start") + print(f"Device ID: {device_id}") + ### alive check ### asyncio.create_task(alive_check())