Added RGB color mode to LED lights on Boost Move Hub and PUP Hub and Remote

This commit is contained in:
Nathan Kellenicki 2018-10-14 10:41:50 -07:00
parent 439a115e74
commit a875f1679e
2 changed files with 4 additions and 4 deletions

View File

@ -80,11 +80,11 @@ export class LPF2Hub extends Hub {
*/
public setLEDColor (color: number | boolean) {
return new Promise((resolve, reject) => {
let data = Buffer.from([0x41, 0x32, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]);
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
if (color === false) {
color = 0;
}
let data = Buffer.from([0x41, 0x32, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]);
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
data = Buffer.from([0x81, 0x32, 0x11, 0x51, 0x00, color]);
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();

View File

@ -90,11 +90,11 @@ export class PUPRemote extends LPF2Hub {
*/
public setLEDColor (color: number | boolean) {
return new Promise((resolve, reject) => {
let data = Buffer.from([0x41, 0x34, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]);
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
if (color === false) {
color = 0;
}
let data = Buffer.from([0x41, 0x34, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]);
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
data = Buffer.from([0x81, 0x34, 0x11, 0x51, 0x00, color]);
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
return resolve();