From d395421a535bf6d2ce820007be754f41a18c6b69 Mon Sep 17 00:00:00 2001 From: Ian Honohan Date: Mon, 31 Jan 2022 11:49:25 -0800 Subject: [PATCH] Filter out a timed out command based only on the rollingcounter --- src/Device.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Device.js b/src/Device.js index 02742cf4..02347bb8 100644 --- a/src/Device.js +++ b/src/Device.js @@ -397,7 +397,9 @@ export default class Device extends EventEmitter { }); setTimeout(() => { this.writeQueue = this.writeQueue.filter( - q => q.command === command[4] && q.rollingCounter !== command[2], + // Filter out the command that timed out, using its unique rollingcounter, + // under the assumption that we don't have 256+ commands queued. + q => q.rollingCounter !== command[2], ); reject( new Error(