mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Fixing up BOOST reset and disconnect behavior splitting.
This commit is contained in:
parent
56fdd45242
commit
6a032087ce
2 changed files with 8 additions and 1 deletions
|
@ -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 = {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue