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 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-28 23:14:21 +01:00
1 parent c38d8de942
commit 9ff5b99fa0
2 files changed
+15 -1

No files matched your search

+2 -1
View File
@@ -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
+13
View File
@@ -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();
}