mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Fixing debug statements and also adding a safety check for timeoutIDs.
This commit is contained in:
parent
0e250aef37
commit
704774d6d1
6 changed files with 21 additions and 11 deletions
|
@ -624,9 +624,11 @@ class EV3 {
|
|||
};
|
||||
this._motors = [null, null, null, null];
|
||||
|
||||
if (this._pollingIntervalID) {
|
||||
window.clearInterval(this._pollingIntervalID);
|
||||
this._pollingIntervalID = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the runtime to detect whether the EV3 peripheral is connected.
|
||||
|
|
|
@ -235,7 +235,10 @@ class GdxFor {
|
|||
spinSpeedZ: 0
|
||||
};
|
||||
|
||||
if (this._timeoutID) {
|
||||
window.clearInterval(this._timeoutID);
|
||||
this._timeoutID = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -254,7 +254,10 @@ class MicroBit {
|
|||
reset() {
|
||||
console.log('MICROBIT RESET CALLED');
|
||||
|
||||
if (this._timeoutID) {
|
||||
window.clearTimeout(this._timeoutID);
|
||||
this._timeoutID = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -203,8 +203,9 @@ class BLE extends JSONRPC {
|
|||
* Disconnect the socket, and if the extension using this socket has a
|
||||
* reset callback, call it. Finally, emit an error to the runtime.
|
||||
*/
|
||||
handleDisconnectError (/* e */) {
|
||||
// log.error(`BLE error: ${JSON.stringify(e)}`);
|
||||
handleDisconnectError (e) {
|
||||
console.error(`BLE error: ${JSON.stringify(e)}`);
|
||||
console.error(e);
|
||||
console.log('BLE HANDLEDISCONNECTERROR CALLED');
|
||||
|
||||
if (!this._connected) return;
|
||||
|
|
|
@ -149,8 +149,9 @@ class BT extends JSONRPC {
|
|||
* Disconnect the socket, and if the extension using this socket has a
|
||||
* reset callback, call it. Finally, emit an error to the runtime.
|
||||
*/
|
||||
handleDisconnectError (/* e */) {
|
||||
// log.error(`BT error: ${JSON.stringify(e)}`);
|
||||
handleDisconnectError (e) {
|
||||
console.error(`BT error: ${JSON.stringify(e)}`);
|
||||
console.error(e);
|
||||
console.log('BT HANDLEDISCONNECTERROR CALLED');
|
||||
|
||||
if (!this._connected) return;
|
||||
|
|
Loading…
Reference in a new issue