Skip to content

Commit 8f3bdf9

Browse files
authored
Updated reconnect
Reconnect is now async so failed reconnection will be catchable
1 parent 6a2d5fa commit 8f3bdf9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

godice.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,15 @@ class GoDice {
245245
* Request for the die battery, that should follow by corresponding "BatteryLevel" event (response).
246246
*/
247247
getBatteryLevel() {
248-
console.log(this)
248+
console.debug(this)
249249
this.sendMessage([this.messageIdentifiers.BATTERY_LEVEL]);
250250
}
251251

252252
/**
253253
* Request for the die color, that should follow by corresponding "DiceColor" event (response).
254254
*/
255255
getDiceColor() {
256-
console.log(this)
256+
console.debug(this)
257257
this.sendMessage([this.messageIdentifiers.DICE_COLOUR]);
258258
}
259259

@@ -284,13 +284,13 @@ class GoDice {
284284
/**
285285
* Attempts to reconnect to the device incase of disconnect
286286
*/
287-
attemptReconnect() {
287+
async attemptReconnect() {
288288
if (this.bluetoothDevice) {
289289
// This object's device exists
290290
if (this.bluetoothDevice.gatt.connected) {
291291
console.debug(this.GlobalDeviceId + "'s Bluetooth device is already connected")
292292
} else {
293-
this.connectDeviceAndCacheCharacteristics()
293+
await this.connectDeviceAndCacheCharacteristics()
294294
}
295295
}
296296
}

0 commit comments

Comments
 (0)