From 237e6b0275c60b94ebe9957d19e0e8bcc1c67807 Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Tue, 2 Dec 2025 18:01:24 +0100 Subject: [PATCH] Handle multiple devices with empty address by falling back on uuid --- core/serial_noble.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/serial_noble.js b/core/serial_noble.js index a432982..e6a2f3a 100644 --- a/core/serial_noble.js +++ b/core/serial_noble.js @@ -107,17 +107,18 @@ return; } if (!dev.advertisement) return; + var path = dev.address || dev.uuid; for (var i in newDevices) - if (newDevices[i].path == dev.address) return; // already seen it - var name = dev.advertisement.localName || dev.address; + if (newDevices[i].path == path) return; // already seen it + var name = dev.advertisement.localName || path; var hasUartService = dev.advertisement.serviceUuids && dev.advertisement.serviceUuids.map(s => s.replaceAll('-', '')).indexOf(NORDIC_SERVICE)>=0; if (hasUartService || Espruino.Core.Utils.isRecognisedBluetoothDevice(name, dev.address)) { - console.log("Noble: Found UART device:", name, dev.address); - newDevices.push({ path: dev.address, description: name, type: "bluetooth", rssi: dev.rssi }); - btDevices[dev.address] = dev; - } else console.log("Noble: Found device:", name, dev.address); + console.log("Noble: Found UART device:", name, path); + newDevices.push({ path: path, description: name, type: "bluetooth", rssi: dev.rssi }); + btDevices[path] = dev; + } else console.log("Noble: Found device:", name, path); }); // if we didn't initialise for whatever reason, keep going anyway