Merge branch 'master' of github.com:nathankellenicki/node-poweredup

This commit is contained in:
Nathan Kellenicki 2022-01-18 17:52:25 -08:00
commit 32fe39fd8c
2 changed files with 6 additions and 6 deletions

View File

@ -168,6 +168,7 @@ export class Device extends EventEmitter {
} }
public finish (message: number) { public finish (message: number) {
if((message & 0x10) === 0x10) return; // "busy/full"
this._busy = (message & 0x01) === 0x01; this._busy = (message & 0x01) === 0x01;
while(this._finishedCallbacks.length > Number(this._busy)) { while(this._finishedCallbacks.length > Number(this._busy)) {
const callback = this._finishedCallbacks.shift(); const callback = this._finishedCallbacks.shift();

View File

@ -348,14 +348,13 @@ export class LPF2Hub extends BaseHub {
private _parsePortAction (message: Buffer) { private _parsePortAction (message: Buffer) {
for (let offset = 3; offset < message.length; offset += 2) {
const device = this._getDeviceByPortId(message[offset]);
const portId = message[3]; if (device) {
const device = this._getDeviceByPortId(portId); device.finish(message[offset+1]);
}
if (device) {
device.finish(message[4]);
} }
} }