mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Removed promise chains that seemed unnecessary.
This commit is contained in:
parent
6bd79369e4
commit
e6ea4d7f0c
1 changed files with 15 additions and 25 deletions
|
@ -541,10 +541,8 @@ class WeDo2 {
|
||||||
*/
|
*/
|
||||||
stopAll () {
|
stopAll () {
|
||||||
if (!this.isConnected()) return;
|
if (!this.isConnected()) return;
|
||||||
this.stopTone()
|
this.stopTone();
|
||||||
.then(() => { // TODO: Promise?
|
this.stopAllMotors();
|
||||||
this.stopAllMotors();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -678,19 +676,13 @@ class WeDo2 {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_onConnect () {
|
_onConnect () {
|
||||||
// set LED input mode to RGB
|
this.setLEDMode();
|
||||||
this.setLEDMode()
|
this.setLED(0x0000FF);
|
||||||
.then(() => { // TODO: Promise?
|
this._ble.startNotifications(
|
||||||
// set LED to blue
|
BLEService.DEVICE_SERVICE,
|
||||||
this.setLED(0x0000FF);
|
BLECharacteristic.ATTACHED_IO,
|
||||||
})
|
this._onMessage
|
||||||
.then(() => { // TODO: Promise?
|
);
|
||||||
this._ble.startNotifications(
|
|
||||||
BLEService.DEVICE_SERVICE,
|
|
||||||
BLECharacteristic.ATTACHED_IO,
|
|
||||||
this._onMessage
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -764,14 +756,12 @@ class WeDo2 {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
this.send(BLECharacteristic.INPUT_COMMAND, cmd)
|
this.send(BLECharacteristic.INPUT_COMMAND, cmd);
|
||||||
.then(() => { // TODO: Promise?
|
this._ble.startNotifications(
|
||||||
this._ble.startNotifications(
|
BLEService.IO_SERVICE,
|
||||||
BLEService.IO_SERVICE,
|
BLECharacteristic.INPUT_VALUES,
|
||||||
BLECharacteristic.INPUT_VALUES,
|
this._onMessage
|
||||||
this._onMessage
|
);
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue