From e6ea4d7f0cc140fb85a9a61c403136ac0467f118 Mon Sep 17 00:00:00 2001 From: Evelyn Eastmond Date: Tue, 18 Sep 2018 12:08:36 -0400 Subject: [PATCH] Removed promise chains that seemed unnecessary. --- src/extensions/scratch3_wedo2/index.js | 40 ++++++++++---------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/src/extensions/scratch3_wedo2/index.js b/src/extensions/scratch3_wedo2/index.js index 2106ffd3c..c07e9a47e 100644 --- a/src/extensions/scratch3_wedo2/index.js +++ b/src/extensions/scratch3_wedo2/index.js @@ -541,10 +541,8 @@ class WeDo2 { */ stopAll () { if (!this.isConnected()) return; - this.stopTone() - .then(() => { // TODO: Promise? - this.stopAllMotors(); - }); + this.stopTone(); + this.stopAllMotors(); } /** @@ -678,19 +676,13 @@ class WeDo2 { * @private */ _onConnect () { - // set LED input mode to RGB - this.setLEDMode() - .then(() => { // TODO: Promise? - // set LED to blue - this.setLED(0x0000FF); - }) - .then(() => { // TODO: Promise? - this._ble.startNotifications( - BLEService.DEVICE_SERVICE, - BLECharacteristic.ATTACHED_IO, - this._onMessage - ); - }); + this.setLEDMode(); + this.setLED(0x0000FF); + this._ble.startNotifications( + BLEService.DEVICE_SERVICE, + BLECharacteristic.ATTACHED_IO, + this._onMessage + ); } /** @@ -764,14 +756,12 @@ class WeDo2 { true ); - this.send(BLECharacteristic.INPUT_COMMAND, cmd) - .then(() => { // TODO: Promise? - this._ble.startNotifications( - BLEService.IO_SERVICE, - BLECharacteristic.INPUT_VALUES, - this._onMessage - ); - }); + this.send(BLECharacteristic.INPUT_COMMAND, cmd); + this._ble.startNotifications( + BLEService.IO_SERVICE, + BLECharacteristic.INPUT_VALUES, + this._onMessage + ); } }