mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Added disconnect-handling per new extensions-spec. Motor-commands that fail will now also cause their blocks to complete
This commit is contained in:
parent
245ba998d2
commit
32a9674b5d
1 changed files with 4 additions and 1 deletions
|
@ -570,6 +570,7 @@ class Boost {
|
||||||
*/
|
*/
|
||||||
this._rateLimiter = new RateLimiter(BLESendRateMax);
|
this._rateLimiter = new RateLimiter(BLESendRateMax);
|
||||||
|
|
||||||
|
this.disconnect = this.disconnect.bind(this);
|
||||||
this._onConnect = this._onConnect.bind(this);
|
this._onConnect = this._onConnect.bind(this);
|
||||||
this._onMessage = this._onMessage.bind(this);
|
this._onMessage = this._onMessage.bind(this);
|
||||||
}
|
}
|
||||||
|
@ -703,7 +704,7 @@ class Boost {
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
optionalServices: []
|
optionalServices: []
|
||||||
}, this._onConnect);
|
}, this._onConnect, this.disconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -921,9 +922,11 @@ class Boost {
|
||||||
var feedback = data[4];
|
var feedback = data[4];
|
||||||
switch(feedback) {
|
switch(feedback) {
|
||||||
case BoostOutputCommandFeedback.BUFFER_EMPTY_COMMAND_COMPLETED ^ BoostOutputCommandFeedback.IDLE:
|
case BoostOutputCommandFeedback.BUFFER_EMPTY_COMMAND_COMPLETED ^ BoostOutputCommandFeedback.IDLE:
|
||||||
|
case BoostOutputCommandFeedback.CURRENT_COMMAND_DISCARDED ^ BoostOutputCommandFeedback.IDLE: // Resolve even if command didn't complete successfully
|
||||||
this._motors[portID].pendingPromiseFunction();
|
this._motors[portID].pendingPromiseFunction();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
console.log(buf2hex(data))
|
||||||
console.log("Got it but didn't find a motor on: " + portID)
|
console.log("Got it but didn't find a motor on: " + portID)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue