Added RGB color mode to LED lights on Boost Move Hub and PUP Hub and Remote
This commit is contained in:
parent
439a115e74
commit
a875f1679e
@ -80,11 +80,11 @@ export class LPF2Hub extends Hub {
|
|||||||
*/
|
*/
|
||||||
public setLEDColor (color: number | boolean) {
|
public setLEDColor (color: number | boolean) {
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (color === false) {
|
||||||
color = 0;
|
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]);
|
data = Buffer.from([0x81, 0x32, 0x11, 0x51, 0x00, color]);
|
||||||
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
||||||
return resolve();
|
return resolve();
|
||||||
|
@ -90,11 +90,11 @@ export class PUPRemote extends LPF2Hub {
|
|||||||
*/
|
*/
|
||||||
public setLEDColor (color: number | boolean) {
|
public setLEDColor (color: number | boolean) {
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (color === false) {
|
||||||
color = 0;
|
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]);
|
data = Buffer.from([0x81, 0x34, 0x11, 0x51, 0x00, color]);
|
||||||
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data);
|
||||||
return resolve();
|
return resolve();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user