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:
Eric Rosenbaum 2019-04-30 12:24:11 -04:00 committed by GitHub
commit 097fcc01a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {
// clear rotation pending promise only if not already in rotation state
this._clearRotationState(); this._clearRotationState();
}
if (value !== BoostMotorState.ON_FOR_TIME) {
// clear duration pending promise only if not already in duration state
this._clearTimeout(); this._clearTimeout();
}
this._status = value; this._status = value;
} }