From b75b8027a18297c22da55b587c9dad73a4a46467 Mon Sep 17 00:00:00 2001
From: Eric Rosenbaum <eric.rosenbaum@gmail.com>
Date: Tue, 30 Apr 2019 11:37:10 -0400
Subject: [PATCH] Always clear motor promises when setting state

---
 src/extensions/scratch3_boost/index.js | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/extensions/scratch3_boost/index.js b/src/extensions/scratch3_boost/index.js
index 3ac374a09..c59d2b55a 100644
--- a/src/extensions/scratch3_boost/index.js
+++ b/src/extensions/scratch3_boost/index.js
@@ -431,14 +431,8 @@ class BoostMotor {
      * @param {BoostMotorState} value - set this motor's state.
      */
     set status (value) {
-        if (value !== BoostMotorState.ON_FOR_ROTATION) {
-            // clear rotation pending promise only if not already in rotation state
-            this._clearRotationState();
-        }
-        if (value !== BoostMotorState.ON_FOR_TIME) {
-            // clear duration pending promise only if not already in duration state
-            this._clearTimeout();
-        }
+        this._clearRotationState();
+        this._clearTimeout();
         this._status = value;
     }
 
@@ -534,7 +528,7 @@ class BoostMotor {
                 BoostMotorProfile.DO_NOT_USE
             ]
         );
-        
+
         this.status = BoostMotorState.ON_FOR_ROTATION;
         this._pendingPositionDestination = this.position + (degrees * this.direction * direction);
         this._parent.send(BoostBLE.characteristic, cmd);