fix(api): 修复固件版本显示格式错误
- 修改 formatFirmwareVersionDisplay 函数,支持版本号 >= 2010 的新格式显示 - 对于版本号小于 2010,保持原有 X.Y.0.Z 格式显示 - 对于版本号大于等于 2010,第三段显示两位数尾数,第四段固定为 0 - 更新 changelog,修复系统页面固件版本显示错误问题
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
|
||||
> This document records feature updates and bug fixes for the Luxsin X9 controller. Entries are listed in reverse chronological order — the newest release appears first.
|
||||
|
||||
## v2026.09.01
|
||||
|
||||
### Bug Fixes
|
||||
- Fixed the incorrect firmware version display on the System page.
|
||||
|
||||
## v2026.08.17
|
||||
|
||||
### Changes
|
||||
|
||||
@@ -477,7 +477,11 @@ export function parseFirmwareVersion(version: unknown): number {
|
||||
return Number(parts[parts.length - 1]);
|
||||
}
|
||||
|
||||
/** Display firmware version as X.Y.0.Z (e.g. 2005 → 2.0.0.5). */
|
||||
/**
|
||||
* Display firmware version.
|
||||
* n < 2010: X.Y.0.Z (e.g. 2005 → 2.0.0.5).
|
||||
* n >= 2010: third segment carries the two-digit tail (e.g. 2010 → 2.0.10.0, 2011 → 2.0.11.0).
|
||||
*/
|
||||
export function formatFirmwareVersionDisplay(version: unknown): string {
|
||||
if (version === null || version === undefined || String(version).trim() === "") {
|
||||
return "—";
|
||||
@@ -485,6 +489,10 @@ export function formatFirmwareVersionDisplay(version: unknown): string {
|
||||
const n = parseFirmwareVersion(version);
|
||||
const major = Math.floor(n / 1000);
|
||||
const minor = Math.floor((n % 1000) / 100);
|
||||
if (n >= 2010) {
|
||||
// Since 2.0.10.0 the third segment counts up (09 → 10), fourth segment stays 0.
|
||||
return `${major}.${minor}.${n % 100}.0`;
|
||||
}
|
||||
const patch = 0;
|
||||
const build = n % 10;
|
||||
return `${major}.${minor}.${patch}.${build}`;
|
||||
|
||||
Reference in New Issue
Block a user