Lights working
This commit is contained in:
parent
7e0f7b17ab
commit
7a3878ff7a
@ -182,12 +182,15 @@ export class BoostMoveHub extends LPF2Hub {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = Buffer.from([0x81, portObj.value, 0x11, 0x51, 0x00, brightness]);
|
||||
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
||||
if (time) {
|
||||
setTimeout(() => {
|
||||
const data = Buffer.from([0x81, portObj.value, 0x11, 0x51, 0x00, 0x00]);
|
||||
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
||||
return resolve();
|
||||
}, time);
|
||||
} else {
|
||||
return resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ export enum Devices {
|
||||
UNKNOWN = 0,
|
||||
BASIC_MOTOR = 1,
|
||||
TRAIN_MOTOR = 2,
|
||||
LED_LIGHTS = 8,
|
||||
BOOST_LED = 22,
|
||||
WEDO2_TILT = 34,
|
||||
WEDO2_DISTANCE = 35,
|
||||
|
@ -142,12 +142,15 @@ export class PUPHub extends LPF2Hub {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = Buffer.from([0x81, portObj.value, 0x11, 0x51, 0x00, brightness]);
|
||||
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
||||
if (time) {
|
||||
setTimeout(() => {
|
||||
const data = Buffer.from([0x81, portObj.value, 0x11, 0x51, 0x00, 0x00]);
|
||||
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
||||
return resolve();
|
||||
}, time);
|
||||
} else {
|
||||
return resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -187,12 +187,15 @@ export class WeDo2SmartHub extends Hub {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = Buffer.from([portObj.value, 0x01, 0x02, this._mapSpeed(brightness)]);
|
||||
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
||||
if (time) {
|
||||
setTimeout(() => {
|
||||
const data = Buffer.from([portObj.value, 0x01, 0x02, 0x00]);
|
||||
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
||||
return resolve();
|
||||
}, time);
|
||||
} else {
|
||||
return resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user