Merge pull request #2115 from knandersen/bugfix/2108

Fix #2108 by making setMotorPower() and setMotorDirection() yield for a tick
This commit is contained in:
Kevin Nørby Andersen 2019-04-15 18:41:28 -04:00 committed by GitHub
commit 1c8dfea382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1756,6 +1756,7 @@ class Scratch3BoostBlocks {
* @param {object} args - the block's arguments. * @param {object} args - the block's arguments.
* @property {MotorID} MOTOR_ID - the motor(s) to be affected. * @property {MotorID} MOTOR_ID - the motor(s) to be affected.
* @property {int} POWER - the new power level for the motor(s). * @property {int} POWER - the new power level for the motor(s).
* @return {Promise} - returns a promise to make sure the block yields.
*/ */
setMotorPower (args) { setMotorPower (args) {
// TODO: cast args.MOTOR_ID? // TODO: cast args.MOTOR_ID?
@ -1778,6 +1779,7 @@ class Scratch3BoostBlocks {
} }
} }
}); });
return Promise.resolve();
} }
/** /**
@ -1786,6 +1788,7 @@ class Scratch3BoostBlocks {
* @param {object} args - the block's arguments. * @param {object} args - the block's arguments.
* @property {MotorID} MOTOR_ID - the motor(s) to be affected. * @property {MotorID} MOTOR_ID - the motor(s) to be affected.
* @property {MotorDirection} MOTOR_DIRECTION - the new direction for the motor(s). * @property {MotorDirection} MOTOR_DIRECTION - the new direction for the motor(s).
* @return {Promise} - returns a promise to make sure the block yields.
*/ */
setMotorDirection (args) { setMotorDirection (args) {
// TODO: cast args.MOTOR_ID? // TODO: cast args.MOTOR_ID?
@ -1824,6 +1827,7 @@ class Scratch3BoostBlocks {
} }
} }
}); });
return Promise.resolve();
} }
/** /**