Updated for latest Boost Move Hub firmware
This commit is contained in:
parent
ac4bcbaca0
commit
7b61b6981a
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-poweredup",
|
"name": "node-poweredup",
|
||||||
"version": "2.5.3",
|
"version": "2.6.0",
|
||||||
"description": "A Javascript module to interface with LEGO Powered Up components.",
|
"description": "A Javascript module to interface with LEGO Powered Up components.",
|
||||||
"homepage": "https://github.com/nathankellenicki/node-poweredup/",
|
"homepage": "https://github.com/nathankellenicki/node-poweredup/",
|
||||||
"main": "dist/node/index-node.js",
|
"main": "dist/node/index-node.js",
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import compareVersion from "compare-versions";
|
||||||
import { Peripheral } from "noble";
|
import { Peripheral } from "noble";
|
||||||
|
|
||||||
import { LPF2Hub } from "./lpf2hub";
|
import { LPF2Hub } from "./lpf2hub";
|
||||||
@ -38,11 +39,11 @@ export class BoostMoveHub extends LPF2Hub {
|
|||||||
super(device, autoSubscribe);
|
super(device, autoSubscribe);
|
||||||
this.type = Consts.HubType.BOOST_MOVE_HUB;
|
this.type = Consts.HubType.BOOST_MOVE_HUB;
|
||||||
this._ports = {
|
this._ports = {
|
||||||
"A": new Port("A", 55),
|
"A": new Port("A", 0),
|
||||||
"B": new Port("B", 56),
|
"B": new Port("B", 1),
|
||||||
"TILT": new Port("TILT", 58),
|
"TILT": new Port("TILT", 58),
|
||||||
"C": new Port("C", 1),
|
"C": new Port("C", 2),
|
||||||
"D": new Port("D", 2)
|
"D": new Port("D", 3)
|
||||||
};
|
};
|
||||||
this.on("attach", (port, type) => {
|
this.on("attach", (port, type) => {
|
||||||
this._combinePorts(port, type);
|
this._combinePorts(port, type);
|
||||||
@ -236,4 +237,11 @@ export class BoostMoveHub extends LPF2Hub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected _checkFirmware (version: string) {
|
||||||
|
if (compareVersion("2.0.00.0023", version) === 1) {
|
||||||
|
throw new Error(`Your Boost Move Hub's (${this.name}) firmware is out of date and unsupported by this library. Please update it via the official Powered Up app.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,7 @@ export class LPF2Hub extends Hub {
|
|||||||
if (portObj) {
|
if (portObj) {
|
||||||
Object.keys(this._ports).forEach((id) => {
|
Object.keys(this._ports).forEach((id) => {
|
||||||
if (this._ports[id].type === type && this._ports[id].value !== portObj.value && !this._virtualPorts[`${portObj.value < this._ports[id].value ? portObj.id : this._ports[id].id}${portObj.value > this._ports[id].value ? portObj.id : this._ports[id].id}`]) {
|
if (this._ports[id].type === type && this._ports[id].value !== portObj.value && !this._virtualPorts[`${portObj.value < this._ports[id].value ? portObj.id : this._ports[id].id}${portObj.value > this._ports[id].value ? portObj.id : this._ports[id].id}`]) {
|
||||||
|
debug("Combining ports", portObj.value < this._ports[id].value ? portObj.id : id, portObj.value > this._ports[id].value ? portObj.id : id);
|
||||||
this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x61, 0x01, portObj.value < this._ports[id].value ? portObj.value : this._ports[id].value, portObj.value > this._ports[id].value ? portObj.value : this._ports[id].value]));
|
this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x61, 0x01, portObj.value < this._ports[id].value ? portObj.value : this._ports[id].value, portObj.value > this._ports[id].value ? portObj.value : this._ports[id].value]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user