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 () {
|
disconnect () {
|
||||||
|
console.log('BOOST DISCONNECT CALLED');
|
||||||
if (this._ble) {
|
if (this._ble) {
|
||||||
this._ble.disconnect();
|
this._ble.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset all the state and timeout/interval ids.
|
* Reset all the state and timeout/interval ids.
|
||||||
*/
|
*/
|
||||||
reset () {
|
reset () {
|
||||||
|
console.log('BOOST RESET CALLED');
|
||||||
this._ports = [];
|
this._ports = [];
|
||||||
this._motors = [];
|
this._motors = [];
|
||||||
this._sensors = {
|
this._sensors = {
|
||||||
|
|
|
@ -72,6 +72,8 @@ class BLE extends JSONRPC {
|
||||||
* Close the websocket.
|
* Close the websocket.
|
||||||
*/
|
*/
|
||||||
disconnect () {
|
disconnect () {
|
||||||
|
console.log('BLE DISCONNECT CALLED');
|
||||||
|
|
||||||
if (this._connected) {
|
if (this._connected) {
|
||||||
this._connected = false;
|
this._connected = false;
|
||||||
}
|
}
|
||||||
|
@ -205,6 +207,7 @@ class BLE extends JSONRPC {
|
||||||
// log.error(`BLE error: ${JSON.stringify(e)}`);
|
// log.error(`BLE error: ${JSON.stringify(e)}`);
|
||||||
|
|
||||||
if (!this._connected) return;
|
if (!this._connected) return;
|
||||||
|
console.log('BLE HANDLEDISCONNECTERROR CALLED');
|
||||||
|
|
||||||
this.disconnect();
|
this.disconnect();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue