From 9ff5b99fa0e68cd7bfaae1a5956465a1fdd70073 Mon Sep 17 00:00:00 2001 From: MangaValk Date: Wed, 28 Oct 2026 23:14:21 +0100 Subject: [PATCH] Add frame rate limit setting Lets the frame rate be capped at 30, 15 or 10 fps to find out whether the occasional random-colour flashes on single keys depend on the update rate. Co-Authored-By: Claude Opus 5.5 --- README.md | 3 ++- Womier_K87_EVision.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a8ffcd4..e98078b 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ product ID or have a K87 layout, so the keyboard is ignored without this plugin. Copy `Womier_K87_EVision.js` to `%USERPROFILE%\Documents\WhirlwindFX\Plugins\` and restart SignalRGB. The device settings have a "Key test" option (column or row sweep) to check the LED map, -and "Low frame-rate mode" in case the keyboard drops frames at full speed. +"Low frame-rate mode" in case the keyboard drops frames at full speed, and a "Frame rate limit" +(Unlimited / 30 / 15 / 10 fps). Known issue: single keys occasionally flash a random colour for a moment. ## Protocol diff --git a/Womier_K87_EVision.js b/Womier_K87_EVision.js index b608cbb..5abdf87 100644 --- a/Womier_K87_EVision.js +++ b/Womier_K87_EVision.js @@ -17,6 +17,7 @@ LightingMode:readonly forcedColor:readonly lowFPS:readonly keyTest:readonly +frameLimit:readonly */ export function ControllableParameters() { return [ @@ -24,6 +25,7 @@ export function ControllableParameters() { {property:"LightingMode", group:"lighting", label:"Lighting Mode", description: "Determines where the device's RGB comes from. Canvas will pull from the active Effect, while Forced will override it to a specific color", type:"combobox", values:["Canvas", "Forced"], default:"Canvas"}, {property:"forcedColor", group:"lighting", label:"Forced Color", description: "The color used when 'Forced' Lighting Mode is enabled", min:"0", max:"360", type:"color", default:"#009bde"}, {property:"lowFPS", group:"lighting", label:"Low frame-rate mode", description: "Sends smaller packets with pauses in between, can improve stability", type:"boolean", default:false}, + {property:"frameLimit", group:"lighting", label:"Frame rate limit", description: "Maximum frames per second sent to the keyboard", type:"combobox", values:["Unlimited", "30", "15", "10"], default:"Unlimited"}, {property:"keyTest", group:"lighting", label:"Key test", description: "Sweeps a white line across the keys to check the LED map", type:"combobox", values:["Off", "Column sweep", "Row sweep"], default:"Off"}, ]; } @@ -67,7 +69,18 @@ export function Initialize() { device.setControllableLeds(vLedNames, vLedPositions); } +let lastFrameTime = 0; + export function Render() { + // The keyboard falls back to its own effect after about a second without frames, + // so the lowest limit (10 fps) still keeps it under plugin control + const now = Date.now(); + + if (frameLimit !== "Unlimited" && now - lastFrameTime < 1000 / parseInt(frameLimit)) { + return; + } + + lastFrameTime = now; sendColors(); }