From 667028037dd40f294bc279979bb1554035de6b00 Mon Sep 17 00:00:00 2001 From: girlglock <178796756+girlglock@users.noreply.github.com> Date: Sun, 19 Apr 2026 08:38:40 +0200 Subject: [PATCH 1/3] add actuated to active_keys pushes --- AnalogSense.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/AnalogSense.js b/AnalogSense.js index c90c240..0ad8df6 100644 --- a/AnalogSense.js +++ b/AnalogSense.js @@ -334,7 +334,7 @@ class AsProvider const active_keys = []; for (const [scancode, value] of Object.entries(this.buffer)) { - active_keys.push({ scancode, value }); + active_keys.push({ scancode, value, actuated: null }); } return active_keys; } @@ -361,7 +361,7 @@ class AsProviderWootingV1 extends AsProvider const scancode = (event.data.getUint8(i++) << 8) | event.data.getUint8(i++); if (scancode == 0) break; const value = event.data.getUint8(i++); - active_keys.push({ scancode, value: value / 255 }); + active_keys.push({ scancode, value: value / 255, actuated: null }); } handler(active_keys); }; @@ -396,6 +396,7 @@ class AsProviderWootingV2 extends AsProvider const packed = data.getUint8(i + 2); const value_hi = data.getUint8(i + 3); + const actuated = packed & 0x1; const keyNamespace = (packed >> 2) & 0xf; const value_lo = (packed >> 6) & 0x3; @@ -405,7 +406,7 @@ class AsProviderWootingV2 extends AsProvider if (scancode === 0) break; if (value === 0) continue; - active_keys.push({ scancode, value: value / 1023 }); + active_keys.push({ scancode, value: value / 1023, actuated }); } handler(active_keys); }; @@ -442,7 +443,8 @@ class AsProviderRazerHuntsman extends AsProvider const value = event.data.getUint8(i++); active_keys.push({ scancode: analogsense.razerScancodeToHidScancode(scancode), - value: value / 255 + value: value / 255, + actuated: null }); } handler(active_keys); @@ -483,7 +485,8 @@ class AsProviderRazerHuntsmanV3 extends AsProvider i++; // unclear, might be something like "priority." active_keys.push({ scancode: analogsense.razerScancodeToHidScancode(scancode), - value: value / 255 + value: value / 255, + actuated: null }); } handler(active_keys); @@ -575,7 +578,8 @@ class AsProviderDrunkdeer extends AsProvider { this.active_keys.push({ scancode: analogsense.drunkdeerIndexToHidScancode((n * (64 - 5)) + (i - 4)), - value: value / 40 + value: value / 40, + actuated: null }); } } From cf50e435c644d5d552d1adb73c35d2b79f2aecf5 Mon Sep 17 00:00:00 2001 From: girlglock <178796756+girlglock@users.noreply.github.com> Date: Sun, 19 Apr 2026 08:39:01 +0200 Subject: [PATCH 2/3] showcase actuation state in the demo --- demo.html | 1 + 1 file changed, 1 insertion(+) diff --git a/demo.html b/demo.html index 33e61c8..ddeaeda 100644 --- a/demo.html +++ b/demo.html @@ -48,6 +48,7 @@

const bar = document.createElement("div"); bar.className = "progress-bar"; bar.style.width = (key.value * 100) + "%"; + bar.style.backgroundColor = key.actuated ? "#7e28bf" : ""; bar.textContent = analogsense.scancodeToString(key.scancode); div.appendChild(bar); } From ca064feec07d2a4d0400062a1f9af86924bcad40 Mon Sep 17 00:00:00 2001 From: girlglock <178796756+girlglock@users.noreply.github.com> Date: Sun, 19 Apr 2026 08:39:07 +0200 Subject: [PATCH 3/3] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 770ecaa..293717f 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Once loaded, the following global functions become available: - `analogsense.scancodeToString(scancode: number): string` A device instance has the following members: -- `startListening(handler: function)` +- `startListening(handler: function)` - `stopListening()` - `getProductName(): string` - `forget()`