Merge branch 'master' of github.com:nathankellenicki/node-poweredup
This commit is contained in:
commit
32fe39fd8c
@ -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();
|
||||||
|
@ -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]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user