2026-07-07 17:14:52 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Firmware version gates for UI features.
|
|
|
|
|
|
*
|
|
|
|
|
|
* Versions are compared using `parseFirmwareVersion` (e.g. 29 → 1.0.0.29).
|
|
|
|
|
|
* Adjust thresholds here instead of hardcoding in page components or API helpers.
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const FIRMWARE_FEATURE_MIN_VERSION = {
|
|
|
|
|
|
/** Boot sound: indices 7–10 (-35…-50 dB); legacy firmware caps at index 6. */
|
|
|
|
|
|
bootSoundExtendedSteps: 26,
|
|
|
|
|
|
/** Ambient LED block on System page. */
|
|
|
|
|
|
ambientLed: 28,
|
|
|
|
|
|
/** PEQ preset rename (peqRename) and reorder (peqSoft) in manage dialog. */
|
|
|
|
|
|
peqPresetRenameAndSort: 29,
|
2026-09-09 18:26:28 +08:00
|
|
|
|
/** Hearing compensation section on the Effects page. */
|
|
|
|
|
|
hearingCompensation: 30,
|
2026-07-07 17:14:52 +08:00
|
|
|
|
} 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 (0–6 legacy, 0–10 when extended steps are supported). */
|
|
|
|
|
|
export function getBootSoundMaxIndex(firmwareVersion: number): number {
|
|
|
|
|
|
return isFirmwareFeatureAvailable("bootSoundExtendedSteps", firmwareVersion) ? 10 : 6;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function supportsAmbientLed(firmwareVersion: number): boolean {
|
|
|
|
|
|
return isFirmwareFeatureAvailable("ambientLed", firmwareVersion);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function supportsPeqPresetRenameAndSort(firmwareVersion: number): boolean {
|
|
|
|
|
|
return isFirmwareFeatureAvailable("peqPresetRenameAndSort", firmwareVersion);
|
|
|
|
|
|
}
|
|
|
|
|
|
|