From 0fbd27d41ff49b435ae7df260bd06200b13c8433 Mon Sep 17 00:00:00 2001 From: Nathan Kellenicki Date: Mon, 11 Nov 2019 17:03:54 -0800 Subject: [PATCH] Fixed bug with retrieving hardware versions --- package-lock.json | 2 +- package.json | 2 +- src/lpf2hub.ts | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9437dbf..7661799 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "node-poweredup", - "version": "4.2.0", + "version": "4.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3ce4daf..4042932 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-poweredup", - "version": "4.2.0", + "version": "4.2.1", "description": "A Javascript module to interface with LEGO Powered Up components.", "homepage": "https://github.com/nathankellenicki/node-poweredup/", "main": "dist/node/index-node.js", diff --git a/src/lpf2hub.ts b/src/lpf2hub.ts index 9cdaa3f..35c7f0f 100644 --- a/src/lpf2hub.ts +++ b/src/lpf2hub.ts @@ -43,10 +43,11 @@ export class LPF2Hub extends Hub { if (this.type === Consts.HubType.DUPLO_TRAIN_HUB) { this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x41, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01])); } - this.emit("connect"); - resolve(); setTimeout(() => { this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x01, 0x03, 0x05])); // Request firmware version again + this._writeMessage(Consts.BLECharacteristic.LPF2_ALL, Buffer.from([0x01, 0x04, 0x05])); // Request firmware version again + this.emit("connect"); + resolve(); }, 200); }); } @@ -267,7 +268,7 @@ export class LPF2Hub extends Hub { let port = this._getPortForPortNumber(data[3]); - if (data[4] === 0x01) { + if (data[4] === 0x01 && process.env["PORT_DEBUG_INFO"]) { this._sendPortInformationRequest(data[3]); }