Repository navigation
feat(wlmouse): add Beast X V2 controls and dongle screen UI #1812
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8449,6 +8449,165 @@ export function applyLunaFuryWheelGuard(guard: { enabled: boolean; windowMs: num | |
| }); | ||
| } | ||
|
|
||
| export function applyWLMouseLodMode(mode: "standard" | "precise"): void { | ||
| const wl = latestDeviceStatus?.wlmouse; | ||
| if (!wl || wl.lodMm == null) return; | ||
| const mm = mode === "standard" && ![0.7, 1, 2].includes(wl.lodMm) ? 1 : wl.lodMm; | ||
| stageChange({ | ||
| key: "wlmouse-lod-mode", | ||
| label: `LOD ${mode} (${mm} mm)`, | ||
| command: "Change lift-off precision mode", | ||
| progress: "Changing lift-off precision mode…", | ||
| preview: (status) => { if (status.wlmouse) { status.wlmouse.lodMode = mode; status.wlmouse.lodMm = mm; } }, | ||
| apply: async () => { | ||
| const client = activeSettingsClient() as { setLiftOffHeight?: (mm: number, mode: "standard" | "precise") => Promise<unknown> } | null; | ||
| if (typeof client?.setLiftOffHeight !== "function") throw new Error("This mouse does not support lift-off precision mode."); | ||
| await client.setLiftOffHeight(mm, mode); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function applyWLMouseBhopWheel(settings: { enabled: boolean; direction: "both" | "up" | "down"; windowMs: number }): void { | ||
| if (!latestDeviceStatus?.wlmouse?.bhopWheel) return; | ||
| stageChange({ | ||
| key: "wlmouse-bhop-wheel", | ||
| label: `BHop wheel ${settings.enabled ? `${settings.direction} ${settings.windowMs} ms` : "off"}`, | ||
| command: "Change BHop wheel settings", | ||
| progress: "Changing BHop wheel settings…", | ||
| preview: (status) => { if (status.wlmouse) status.wlmouse.bhopWheel = { ...settings }; }, | ||
| apply: () => callClientMethod("setBhopWheel", "BHop wheel", settings), | ||
| }); | ||
| } | ||
|
|
||
| export function applyWLMouseSensorPosition(position: { x: number; y: number }): void { | ||
| if (!latestDeviceStatus?.wlmouse?.sensorPosition) return; | ||
| stageChange({ | ||
| key: "wlmouse-sensor-position", | ||
| label: `Sensor position (${position.x}, ${position.y})`, | ||
| command: "Change sensor position", | ||
| progress: "Changing sensor position…", | ||
| preview: (status) => { if (status.wlmouse) status.wlmouse.sensorPosition = { ...position }; }, | ||
| apply: async () => { | ||
| const client = activeSettingsClient() as { setSensorPosition?: (x: number, y: number) => Promise<unknown> } | null; | ||
| if (typeof client?.setSensorPosition !== "function") throw new Error("This mouse does not support sensor position."); | ||
| await client.setSensorPosition(position.x, position.y); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function applyWLMouseDynamicDpi(settings: { enabled: boolean; points: Array<{ speed: number; ratio: number }> }): void { | ||
| if (!latestDeviceStatus?.wlmouse?.dynamicDpi) return; | ||
| const next = { enabled: settings.enabled, points: settings.points.map((point) => ({ ...point })) }; | ||
| stageChange({ | ||
| key: "wlmouse-dynamic-dpi", | ||
| label: `Dynamic DPI ${next.enabled ? "on" : "off"}`, | ||
| command: "Change Dynamic DPI curve", | ||
| progress: "Changing Dynamic DPI curve…", | ||
| preview: (status) => { if (status.wlmouse) status.wlmouse.dynamicDpi = structuredClone(next); }, | ||
| apply: () => callClientMethod("setDynamicDpi", "Dynamic DPI", next), | ||
| }); | ||
| } | ||
|
|
||
| export function applyWLMouseDongleScreenEnabled(enabled: boolean): void { | ||
| if (!latestDeviceStatus?.wlmouse?.dongleScreen) return; | ||
| stageChange({ | ||
| key: "wlmouse-dongle-screen-enabled", | ||
| label: `Dongle screen ${enabled ? "on" : "off"}`, | ||
| command: "Toggle dongle screen", | ||
| progress: "Updating dongle screen…", | ||
| preview: (status) => { if (status.wlmouse?.dongleScreen) status.wlmouse.dongleScreen.enabled = enabled; }, | ||
| apply: () => callClientMethod("setDongleScreenEnabled", "dongle screen", enabled), | ||
| }); | ||
| } | ||
|
|
||
| export function applyWLMouseDongleDefaultScreen(screen: "mouse-stats" | "usb-monitor" | "media"): void { | ||
| if (!latestDeviceStatus?.wlmouse?.dongleScreen) return; | ||
| stageChange({ | ||
| key: "wlmouse-dongle-default-screen", | ||
| label: `Default screen ${screen}`, | ||
| command: "Change dongle default screen", | ||
| progress: "Updating dongle default screen…", | ||
| preview: (status) => { if (status.wlmouse?.dongleScreen) status.wlmouse.dongleScreen.defaultScreen = screen; }, | ||
| apply: () => callClientMethod("setDongleDefaultScreen", "dongle default screen", screen), | ||
| }); | ||
| } | ||
|
|
||
| export function applyWLMouseDongleDoubleTap(enabled: boolean): void { | ||
| if (!latestDeviceStatus?.wlmouse?.dongleScreen) return; | ||
| stageChange({ | ||
| key: "wlmouse-dongle-double-tap", | ||
| label: `Dongle double-tap ${enabled ? "on" : "off"}`, | ||
| command: "Toggle dongle touchscreen double-tap", | ||
| progress: "Updating dongle double-tap…", | ||
| preview: (status) => { if (status.wlmouse?.dongleScreen) status.wlmouse.dongleScreen.doubleTapEnabled = enabled; }, | ||
| apply: () => callClientMethod("setDongleDoubleTap", "dongle double-tap", enabled), | ||
| }); | ||
| } | ||
|
|
||
| export async function uploadWLMouseDongleImages( | ||
| images: Array<{ width: number; height: number; format: "gif" | "jpeg" | "png" | "rgb565"; data: Uint8Array }>, | ||
| ): Promise<void> { | ||
| await callClientMethod("uploadDongleImages", "dongle screen images", images); | ||
|
Contributor
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. Dongle image uploads can interleave with other device commands.
Hold
|
||
| } | ||
|
|
||
| export async function deleteWLMouseDongleImages(): Promise<void> { | ||
| const client = activeSettingsClient() as { deleteDongleImages?: () => Promise<void> } | null; | ||
| if (typeof client?.deleteDongleImages !== "function") throw new Error("This receiver does not support dongle screen images."); | ||
| await client.deleteDongleImages(); | ||
| } | ||
|
|
||
| export async function loadWLMouseMacros(): Promise<Array<{ slot: number; name: string; events: Array<Record<string, unknown>> } | null>> { | ||
| const client = activeSettingsClient() as { readMacros?: () => Promise<Array<{ slot: number; name: string; events: Array<Record<string, unknown>> } | null>> } | null; | ||
| if (typeof client?.readMacros !== "function") return []; | ||
| return await client.readMacros(); | ||
| } | ||
|
|
||
| export async function saveWLMouseMacro( | ||
| slot: number, | ||
| name: string, | ||
| events: Array<Record<string, unknown>>, | ||
| ): Promise<void> { | ||
| const client = activeSettingsClient() as { saveMacro?: (slot: number, name: string, events: Array<Record<string, unknown>>) => Promise<unknown> } | null; | ||
| if (typeof client?.saveMacro !== "function") throw new Error("This mouse does not support onboard macros."); | ||
| await client.saveMacro(slot, name, events); | ||
|
Contributor
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. Block immediate macro writes during game-profile editing.
Reject these operations during a draft, and disable or omit their controls there. Keep device-page macro writes available. Also applies to: 8576-8576
|
||
| } | ||
|
|
||
| export async function deleteWLMouseMacro(slot: number): Promise<void> { | ||
| await callClientMethod("deleteMacro", "onboard macro", slot); | ||
| } | ||
|
|
||
| export function stageWLMouseResetProfile(): void { | ||
| if (!latestDeviceStatus?.wlmouse) return; | ||
| stageChange({ | ||
| key: "wlmouse-reset-profile", | ||
| label: "Reset active profile", | ||
| command: "Reset active profile", | ||
| progress: "Resetting active profile…", | ||
| preview: () => {}, | ||
|
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. 🟠 High Neither reset handler reaches the device: its no-op 🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
Contributor
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. Remove the empty previews from both reset commands. Both previews leave Omit the previews. Commands without previews bypass this comparison and remain excluded from game-profile drafts. Based on learnings, commands whose effects cannot be represented in Also applies to: 8602-8602
|
||
| apply: async () => { | ||
| const client = activeSettingsClient() as { resetProfile?: () => Promise<void> } | null; | ||
| if (typeof client?.resetProfile !== "function") throw new Error("This mouse does not support profile reset."); | ||
| await client.resetProfile(); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function stageWLMouseFactoryReset(): void { | ||
| if (!latestDeviceStatus?.wlmouse) return; | ||
| stageChange({ | ||
| key: "wlmouse-factory-reset", | ||
| label: "Factory reset", | ||
| command: "Factory reset", | ||
| progress: "Resetting device…", | ||
| preview: () => {}, | ||
| apply: async () => { | ||
| const client = activeSettingsClient() as { factoryReset?: () => Promise<void> } | null; | ||
| if (typeof client?.factoryReset !== "function") throw new Error("This mouse does not support factory reset."); | ||
| await client.factoryReset(); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| function startAutomaticRefresh(): void { | ||
| if (refreshTimer !== null) window.clearInterval(refreshTimer); | ||
| const client = activeSettingsClient(); | ||
|
|
||
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.
🟠 High
device/controller.ts:8455Selecting
Preciseafter staging a 1.5 mm height change writes the stale hardware value of 1 mm, so the latersetLiftOffHeight(1, "precise")overwrites the staged height.applyWLMouseLodModereadslatestDeviceStatus.wlmouse.lodMmand stages under a separate key; route height and mode changes through one shared staged write so the pending height is preserved.🚀 Reply "fix it for me" or copy this AI Prompt for your agent: