Skip to content

Commit

Permalink
Fix async mode
Browse files Browse the repository at this point in the history
  • Loading branch information
JeLuF committed Jan 15, 2024
1 parent 30837dd commit e6108d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit e6108d2

Please sign in to comment.