diff --git a/index.js b/index.js index dc34395..0d2cea1 100644 --- a/index.js +++ b/index.js @@ -212,10 +212,21 @@ function createBleAgent() { server = await device.gatt.connect(); service = await server.getPrimaryService(SERVICE_UUID_PESTOBLE); characteristic_gamepad = await service.getCharacteristic(CHARACTERISTIC_UUID_GAMEPAD); + + try{ + characteristic_battery = await service.getCharacteristic(CHARACTERISTIC_UUID_TELEMETRY); + await characteristic_battery.startNotifications() + await characteristic_battery.addEventListener('characteristicvaluechanged', handleBatteryCharacteristic); + }catch{ + console.log("Pestolink version on robot is real old :(") + } + await device.addEventListener('gattserverdisconnected', robotDisconnect); - displayBleStatus('Connected'); isConnectedBLE = true; + buttonBLE.innerHTML = '❌'; + displayBleStatus('Connected', '#4dae50'); //green + } catch (error) { displayBleStatus("Error"); diff --git a/styles.css b/styles.css index 0bec520..d818ce2 100644 --- a/styles.css +++ b/styles.css @@ -112,6 +112,7 @@ body { background: grey; border-radius: 50%; user-select: none; + -webkit-user-select: none; cursor: pointer; height: 13vw; width: 13vw;