新增听力补偿,将有版本限制的功能,提取到配置文件,不再硬编码,优化部署文件参数

This commit is contained in:
eafonyang
2026-06-26 15:03:36 +08:00
parent 522bb602b3
commit 1e5e6f5548
11 changed files with 209 additions and 29 deletions
+28
View File
@@ -0,0 +1,28 @@
/**
* Firmware version gates for UI features.
*
* Versions are compared using `parseFirmwareVersion` (e.g. 2007 → 2.0.0.7).
* Adjust thresholds here instead of hardcoding in page components.
*/
export const FIRMWARE_FEATURE_MIN_VERSION = {
/** Boot sound: indices 710 (-35…-50 dB); legacy firmware caps at index 6. */
bootSoundExtendedSteps: 26,
/** Subwoofer LPF/HPF full-range toggles on the Effects page. */
subwooferFullRange: 2001,
/** Hearing compensation section on the Effects page. */
hearingCompensation: 2007,
} as const;
export type FirmwareFeatureKey = keyof typeof FIRMWARE_FEATURE_MIN_VERSION;
export function isFirmwareFeatureAvailable(
feature: FirmwareFeatureKey,
firmwareVersion: number,
): boolean {
return firmwareVersion >= FIRMWARE_FEATURE_MIN_VERSION[feature];
}
/** Max `bootSound` select index (06 legacy, 010 when extended steps are supported). */
export function getBootSoundMaxIndex(firmwareVersion: number): number {
return isFirmwareFeatureAvailable("bootSoundExtendedSteps", firmwareVersion) ? 10 : 6;
}