From e6108d20796f7b6ac695cfb249436f4f8bfc2287 Mon Sep 17 00:00:00 2001 From: JeLuF Date: Mon, 15 Jan 2024 23:13:24 +0100 Subject: [PATCH] Fix async mode --- index.js | 8 +++----- package.json | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 7319241..25aa8fe 100644 --- a/index.js +++ b/index.js @@ -121,9 +121,9 @@ class Displaypad extends EventEmitter { this.display = new HID.HID(paths.display) this.device = new HID.HID(paths.device) - } else if (args.length == 2 && typeof args[1] === HID.HIDAsync && typeof args[2] === HID.HIDAsync) { - this.display = args[1] - this.device = args[2] + } else if (args.length == 2 && args[0] instanceof HID.HIDAsync && args[1] instanceof HID.HIDAsync) { + this.display = args[0] + this.device = args[1] } else { // Open via device path throw new Error('Not yet implemented') @@ -266,9 +266,7 @@ class Displaypad extends EventEmitter { this._keyIsPressed(11, data[47] & 0x08); this._keyIsPressed(12, data[47] & 0x10); } else if (data[0] == 0x11) { // Response to init message - console.log('Init complete') this.initializing = false - console.log('Queue length', this.queue.length) if (this.queue.length > 0) { this.#startPixelTransfer(this.queue[0].keyIndex) } diff --git a/package.json b/package.json index 2a9431c..23d4816 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mountain-displaypad", - "version": "1.1.0", + "version": "1.1.1", "description": "An npm module for interfacing with the Mountain Displaypad buttons", "main": "index.js", "typings": "index.d.ts",