From 405f6ff56aae7b32baf226350e70681f3832e9a5 Mon Sep 17 00:00:00 2001 From: DEERSTUDIO101 <181780870+DEERSTUDIO101@users.noreply.github.com> Date: Thu, 8 Oct 2026 22:58:51 +0200 Subject: [PATCH 1/2] fix(polling): keep unavailable rates unselected in the control panel --- src/app/cards/PerformanceCards.tsx | 3 ++- src/app/ui.tsx | 13 +++---------- src/device/controller.ts | 5 +++-- src/preview-fixtures.ts | 30 ++++++++++++++++++++++++++++++ src/preview-modes.ts | 4 ++++ src/ui/polling-rate.test.ts | 21 +++++++++++++++++++++ src/ui/polling-rate.ts | 13 +++++++++++++ 7 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 src/ui/polling-rate.test.ts create mode 100644 src/ui/polling-rate.ts diff --git a/src/app/cards/PerformanceCards.tsx b/src/app/cards/PerformanceCards.tsx index f6163020..42a28eb3 100644 --- a/src/app/cards/PerformanceCards.tsx +++ b/src/app/cards/PerformanceCards.tsx @@ -7,6 +7,7 @@ import { } from "@openmouse/protocol/drivers/logitech/onboard-profiles"; import * as control from "../../device/controller"; import { isNoirKsnakeStatus } from "../../device/noir.ts"; +import { pollingRateText } from "../../ui/polling-rate"; import { isNativeAttackSharkX11, RATE_STEPS_HZ } from "../../device/controller"; import type { ControlSnapshot, LiftOffLevel } from "../../device/types"; import { t, tp } from "../../i18n"; @@ -64,7 +65,7 @@ export function PollingCard({ snapshot }: { snapshot: ControlSnapshot }): ReactN {note} {!perProfile ? ( - {status.pollingRateHz.toLocaleString()} Hz + {pollingRateText(status.pollingRateHz)} Hz ) : null} diff --git a/src/app/ui.tsx b/src/app/ui.tsx index 71ee026d..0a07dee6 100644 --- a/src/app/ui.tsx +++ b/src/app/ui.tsx @@ -2,6 +2,7 @@ import { useEffect, useId, useRef, useState, type ReactNode } from "react"; import { Check, ChevronDown, Minus, Plus } from "lucide-react"; import type { MouseStatus } from "@openmouse/protocol/drivers/mouse-types"; import { batteryFillWidth, batteryIconState, batteryLevel } from "../ui/battery-icon"; +import { selectedPollingStep } from "../ui/polling-rate"; import { t } from "../i18n"; import type { InterfaceLocale } from "../interface-preferences"; @@ -384,22 +385,14 @@ export function RateSlider({ bubble?: boolean; }): ReactNode { if (options.length === 0) return