mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Merge pull request #2160 from ericrosenbaum/bugfix/boost-clear-motor-state
BOOST extension: Always clear motor promises when setting state
This commit is contained in:
commit
097fcc01a0
1 changed files with 3 additions and 9 deletions
|
@ -431,14 +431,8 @@ class BoostMotor {
|
||||||
* @param {BoostMotorState} value - set this motor's state.
|
* @param {BoostMotorState} value - set this motor's state.
|
||||||
*/
|
*/
|
||||||
set status (value) {
|
set status (value) {
|
||||||
if (value !== BoostMotorState.ON_FOR_ROTATION) {
|
this._clearRotationState();
|
||||||
// clear rotation pending promise only if not already in rotation state
|
this._clearTimeout();
|
||||||
this._clearRotationState();
|
|
||||||
}
|
|
||||||
if (value !== BoostMotorState.ON_FOR_TIME) {
|
|
||||||
// clear duration pending promise only if not already in duration state
|
|
||||||
this._clearTimeout();
|
|
||||||
}
|
|
||||||
this._status = value;
|
this._status = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +528,7 @@ class BoostMotor {
|
||||||
BoostMotorProfile.DO_NOT_USE
|
BoostMotorProfile.DO_NOT_USE
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
this.status = BoostMotorState.ON_FOR_ROTATION;
|
this.status = BoostMotorState.ON_FOR_ROTATION;
|
||||||
this._pendingPositionDestination = this.position + (degrees * this.direction * direction);
|
this._pendingPositionDestination = this.position + (degrees * this.direction * direction);
|
||||||
this._parent.send(BoostBLE.characteristic, cmd);
|
this._parent.send(BoostBLE.characteristic, cmd);
|
||||||
|
|
Loading…
Reference in a new issue