mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -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
|
@ -840,7 +840,7 @@ class Boost {
|
||||||
*/
|
*/
|
||||||
reset () {
|
reset () {
|
||||||
console.log('BOOST RESET CALLED');
|
console.log('BOOST RESET CALLED');
|
||||||
|
|
||||||
this._ports = [];
|
this._ports = [];
|
||||||
this._motors = [];
|
this._motors = [];
|
||||||
this._sensors = {
|
this._sensors = {
|
||||||
|
|
|
@ -614,7 +614,7 @@ class EV3 {
|
||||||
*/
|
*/
|
||||||
reset() {
|
reset() {
|
||||||
console.log('EV3 RESET CALLED');
|
console.log('EV3 RESET CALLED');
|
||||||
|
|
||||||
this._sensorPorts = [];
|
this._sensorPorts = [];
|
||||||
this._motorPorts = [];
|
this._motorPorts = [];
|
||||||
this._sensors = {
|
this._sensors = {
|
||||||
|
@ -624,8 +624,10 @@ class EV3 {
|
||||||
};
|
};
|
||||||
this._motors = [null, null, null, null];
|
this._motors = [null, null, null, null];
|
||||||
|
|
||||||
window.clearInterval(this._pollingIntervalID);
|
if (this._pollingIntervalID) {
|
||||||
this._pollingIntervalID = null;
|
window.clearInterval(this._pollingIntervalID);
|
||||||
|
this._pollingIntervalID = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -224,7 +224,7 @@ class GdxFor {
|
||||||
*/
|
*/
|
||||||
reset () {
|
reset () {
|
||||||
console.log('GDXFOR RESET CALLED');
|
console.log('GDXFOR RESET CALLED');
|
||||||
|
|
||||||
this._sensors = {
|
this._sensors = {
|
||||||
force: 0,
|
force: 0,
|
||||||
accelerationX: 0,
|
accelerationX: 0,
|
||||||
|
@ -235,7 +235,10 @@ class GdxFor {
|
||||||
spinSpeedZ: 0
|
spinSpeedZ: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
window.clearInterval(this._timeoutID);
|
if (this._timeoutID) {
|
||||||
|
window.clearInterval(this._timeoutID);
|
||||||
|
this._timeoutID = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -254,7 +254,10 @@ class MicroBit {
|
||||||
reset() {
|
reset() {
|
||||||
console.log('MICROBIT RESET CALLED');
|
console.log('MICROBIT RESET CALLED');
|
||||||
|
|
||||||
window.clearTimeout(this._timeoutID);
|
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
|
* Disconnect the socket, and if the extension using this socket has a
|
||||||
* reset callback, call it. Finally, emit an error to the runtime.
|
* reset callback, call it. Finally, emit an error to the runtime.
|
||||||
*/
|
*/
|
||||||
handleDisconnectError (/* e */) {
|
handleDisconnectError (e) {
|
||||||
// log.error(`BLE error: ${JSON.stringify(e)}`);
|
console.error(`BLE error: ${JSON.stringify(e)}`);
|
||||||
|
console.error(e);
|
||||||
console.log('BLE HANDLEDISCONNECTERROR CALLED');
|
console.log('BLE HANDLEDISCONNECTERROR CALLED');
|
||||||
|
|
||||||
if (!this._connected) return;
|
if (!this._connected) return;
|
||||||
|
|
|
@ -149,8 +149,9 @@ class BT extends JSONRPC {
|
||||||
* Disconnect the socket, and if the extension using this socket has a
|
* Disconnect the socket, and if the extension using this socket has a
|
||||||
* reset callback, call it. Finally, emit an error to the runtime.
|
* reset callback, call it. Finally, emit an error to the runtime.
|
||||||
*/
|
*/
|
||||||
handleDisconnectError (/* e */) {
|
handleDisconnectError (e) {
|
||||||
// log.error(`BT error: ${JSON.stringify(e)}`);
|
console.error(`BT error: ${JSON.stringify(e)}`);
|
||||||
|
console.error(e);
|
||||||
console.log('BT HANDLEDISCONNECTERROR CALLED');
|
console.log('BT HANDLEDISCONNECTERROR CALLED');
|
||||||
|
|
||||||
if (!this._connected) return;
|
if (!this._connected) return;
|
||||||
|
|
Loading…
Reference in a new issue