From 6a032087ce6b686f6499cce9e0e011ef86276d52 Mon Sep 17 00:00:00 2001 From: Evelyn Eastmond Date: Thu, 6 Jun 2019 15:46:45 -0400 Subject: [PATCH] Fixing up BOOST reset and disconnect behavior splitting. --- src/extensions/scratch3_boost/index.js | 6 +++++- src/io/ble.js | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/extensions/scratch3_boost/index.js b/src/extensions/scratch3_boost/index.js index c5ea7784f..44b48fec3 100644 --- a/src/extensions/scratch3_boost/index.js +++ b/src/extensions/scratch3_boost/index.js @@ -823,18 +823,22 @@ class Boost { } /** - * Disconnects from the current BLE socket. + * Disconnects from the current BLE socket and resets state. */ disconnect () { + console.log('BOOST DISCONNECT CALLED'); if (this._ble) { this._ble.disconnect(); } + + this.reset(); } /** * Reset all the state and timeout/interval ids. */ reset () { + console.log('BOOST RESET CALLED'); this._ports = []; this._motors = []; this._sensors = { diff --git a/src/io/ble.js b/src/io/ble.js index e95490b36..acadeec7d 100644 --- a/src/io/ble.js +++ b/src/io/ble.js @@ -72,6 +72,8 @@ class BLE extends JSONRPC { * Close the websocket. */ disconnect () { + console.log('BLE DISCONNECT CALLED'); + if (this._connected) { this._connected = false; } @@ -205,6 +207,7 @@ class BLE extends JSONRPC { // log.error(`BLE error: ${JSON.stringify(e)}`); if (!this._connected) return; + console.log('BLE HANDLEDISCONNECTERROR CALLED'); this.disconnect();