Repository navigation
feat(wlmouse): bump protocol to 0.68.0 and add Beast X V2 controls #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -244,9 +244,124 @@ function advanced(s: any, brand: string): Section[] { | |
| } | ||
|
|
||
| /** Brand-specific extras that were reported by drivers but had no control yet. */ | ||
| function extras(s: any): Section[] { | ||
| export function extras(s: any): Section[] { | ||
| const out: Section[] = []; | ||
|
|
||
| if (s.wlmouse && typeof s.wlmouse === "object") { | ||
| const wl = s.wlmouse; | ||
| const sensorControls: Control[] = []; | ||
| if (wl.lodMode != null) { | ||
| sensorControls.push({ | ||
| id: "wl.lodMode", | ||
| label: "Lift-off precision", | ||
| kind: "choice", | ||
| options: [{ value: "standard", label: "Standard" }, { value: "precise", label: "Precise" }], | ||
| current: wl.lodMode, | ||
| }); | ||
| } | ||
| if (typeof s.supportsSeparateDpiAxes === "boolean") { | ||
| sensorControls.push({ | ||
| id: "wl.separateAxes", | ||
| label: "Independent X/Y DPI", | ||
| kind: "toggle", | ||
| current: s.supportsSeparateDpiAxes, | ||
| }); | ||
| } | ||
| if (wl.sensorPosition) { | ||
| sensorControls.push({ | ||
| id: "wl.sensorX", | ||
| label: "Sensor position X", | ||
| kind: "number", | ||
| min: -5, | ||
| max: 5, | ||
| step: 1, | ||
| current: wl.sensorPosition.x, | ||
| }); | ||
| sensorControls.push({ | ||
| id: "wl.sensorY", | ||
| label: "Sensor position Y", | ||
| kind: "number", | ||
| min: -5, | ||
| max: 5, | ||
| step: 1, | ||
| current: wl.sensorPosition.y, | ||
| }); | ||
| } | ||
| if (wl.bhopWheel) { | ||
| sensorControls.push({ | ||
| id: "wl.bhop", | ||
| label: "BHop wheel", | ||
| kind: "toggle", | ||
| current: Boolean(wl.bhopWheel.enabled), | ||
| }); | ||
| if (wl.bhopWheel.enabled) { | ||
| sensorControls.push({ | ||
| id: "wl.bhopDir", | ||
| label: "BHop filter direction", | ||
| kind: "choice", | ||
| options: [ | ||
| { value: "both", label: "Both" }, | ||
| { value: "up", label: "Up" }, | ||
| { value: "down", label: "Down" }, | ||
| ], | ||
| current: wl.bhopWheel.direction, | ||
| }); | ||
| sensorControls.push({ | ||
| id: "wl.bhopWindow", | ||
| label: "BHop filter window", | ||
| kind: "number", | ||
| min: 0, | ||
| max: 750, | ||
| step: 10, | ||
| unit: "ms", | ||
| current: wl.bhopWheel.windowMs, | ||
| }); | ||
| } | ||
| } | ||
| if (wl.dynamicDpi) { | ||
| sensorControls.push({ | ||
| id: "wl.dynDpi", | ||
| label: "Dynamic DPI", | ||
| kind: "toggle", | ||
| current: Boolean(wl.dynamicDpi.enabled), | ||
| }); | ||
| } | ||
| if (sensorControls.length) out.push({ title: "WLMouse · Sensor & scroll", controls: sensorControls }); | ||
|
|
||
| if (wl.dongleScreen) { | ||
| const lcd = wl.dongleScreen; | ||
| out.push({ | ||
| title: "WLMouse · Dongle screen", | ||
| controls: [ | ||
| { | ||
| id: "wl.lcdEnabled", | ||
| label: "Screen effect", | ||
| kind: "toggle", | ||
| current: Boolean(lcd.enabled), | ||
| }, | ||
| { | ||
| id: "wl.lcdDefaultScreen", | ||
| label: "Default screen", | ||
| kind: "choice", | ||
| options: [ | ||
| { value: "mouse-stats", label: "Mouse stats" }, | ||
| { value: "usb-monitor", label: "USB monitor" }, | ||
| { value: "media", label: "Media" }, | ||
| ], | ||
| current: lcd.defaultScreen, | ||
| }, | ||
| { | ||
| id: "wl.lcdDoubleTap", | ||
| label: "Double-tap link", | ||
| description: "Double-tap the receiver touchscreen to open the configurator.", | ||
| kind: "toggle", | ||
| current: Boolean(lcd.doubleTapEnabled), | ||
| }, | ||
| ], | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| if (s.finalmouseIsSlx === true) { | ||
| const mode = [{ value: 0, label: "Mechanical" }, { value: 1, label: "TMR analog" }]; | ||
| const rel = [{ value: 0, label: "Normal" }, { value: 1, label: "Early" }, { value: 2, label: "Late" }]; | ||
|
|
@@ -781,6 +896,56 @@ export async function writeControl(info: HidInterfaceInfo, status: any, id: stri | |
| case "dongle.led": return callClientMethod(info, "setDongleLed", Boolean(value)); | ||
| case "dongle.incott": return callClientMethod(info, "setReceiverLed", Number(value)); | ||
| case "dongle.atk": return callClientMethod(info, "setDongleLight", Number(value)); | ||
| case "wl.lodMode": { | ||
| const mode = value === "precise" ? "precise" : "standard"; | ||
| const currentMm = status.wlmouse?.lodMm ?? 1; | ||
| const mm = mode === "standard" && ![0.7, 1, 2].includes(currentMm) ? 1 : currentMm; | ||
| await callClientMethod(info, "setLiftOffHeight", mm, mode); | ||
| if (status.wlmouse) { status.wlmouse.lodMode = mode; status.wlmouse.lodMm = mm; } | ||
| return; | ||
| } | ||
| case "wl.separateAxes": | ||
| await callClientMethod(info, "setSeparateDpiAxes", Boolean(value)); | ||
| status.supportsSeparateDpiAxes = Boolean(value); | ||
| return; | ||
| case "wl.sensorX": case "wl.sensorY": { | ||
| const cur = status.wlmouse?.sensorPosition ?? { x: 0, y: 0 }; | ||
| const x = id === "wl.sensorX" ? Math.round(Number(value)) : cur.x; | ||
| const y = id === "wl.sensorY" ? Math.round(Number(value)) : cur.y; | ||
|
Comment on lines
+913
to
+914
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Concurrent sensor-position writes can drop an axis edit.
For example, from Each position write must read the latest position and send the pair as one step per device. Serialize the read, send, and status update across live and profile writes, or read the latest confirmed position after earlier writes settle. The
|
||
| await callClientMethod(info, "setSensorPosition", x, y); | ||
| if (status.wlmouse) status.wlmouse.sensorPosition = { x, y }; | ||
| return; | ||
| } | ||
| case "wl.bhop": case "wl.bhopDir": case "wl.bhopWindow": { | ||
| const cur = status.wlmouse?.bhopWheel ?? { enabled: false, direction: "both", windowMs: 200 }; | ||
| const next = { | ||
| enabled: id === "wl.bhop" ? Boolean(value) : cur.enabled, | ||
| direction: id === "wl.bhopDir" ? String(value) : cur.direction, | ||
| windowMs: id === "wl.bhopWindow" ? Math.round(Number(value)) : cur.windowMs, | ||
| }; | ||
| await callClientMethod(info, "setBhopWheel", next); | ||
| if (status.wlmouse) status.wlmouse.bhopWheel = next; | ||
| return; | ||
| } | ||
| case "wl.dynDpi": { | ||
| const cur = status.wlmouse?.dynamicDpi ?? { enabled: false, points: [{ speed: 0, ratio: 1 }, { speed: 20, ratio: 2.62 }, { speed: 40, ratio: 4.8 }] }; | ||
| const next = { ...cur, enabled: Boolean(value) }; | ||
| await callClientMethod(info, "setDynamicDpi", next); | ||
| if (status.wlmouse) status.wlmouse.dynamicDpi = next; | ||
| return; | ||
| } | ||
| case "wl.lcdEnabled": | ||
| await callClientMethod(info, "setDongleScreenEnabled", Boolean(value)); | ||
| if (status.wlmouse?.dongleScreen) status.wlmouse.dongleScreen.enabled = Boolean(value); | ||
| return; | ||
| case "wl.lcdDefaultScreen": | ||
| await callClientMethod(info, "setDongleDefaultScreen", String(value)); | ||
| if (status.wlmouse?.dongleScreen) status.wlmouse.dongleScreen.defaultScreen = String(value); | ||
| return; | ||
| case "wl.lcdDoubleTap": | ||
| await callClientMethod(info, "setDongleDoubleTap", Boolean(value)); | ||
| if (status.wlmouse?.dongleScreen) status.wlmouse.dongleScreen.doubleTapEnabled = Boolean(value); | ||
| return; | ||
| case "gen.profile": return w.setProfile(info, Number(value)); | ||
| case "gen.powerMode": return callClientMethod(info, "setPowerMode", value); | ||
| case "perf.sleep": return w.setSleepTimeout(info, Number(value)); | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep BHop settings accessible in the game-profile editor.
If hardware BHop is disabled, this condition omits the direction and window controls. Enabling BHop in a game profile only saves an override. The profile renderer updates existing control values; it does not regenerate missing controls. The user cannot configure these settings without first enabling BHop on hardware. (raw.githubusercontent.com)
Expose direction and window whenever
wl.bhopWheelexists, or rebuild the profile layout from its effective BHop value.