Files
simba-rmic-2026/client/src/lib/maintenance-preview.ts
T
sloray f7ca246b68
构建客户端 / 检查(类型 + 单元测试) (push) Canceled after 0s
构建客户端 / Linux x64(deb + AppImage) (push) Canceled after 0s
构建客户端 / Windows x64(NSIS 安装包) (push) Canceled after 0s
构建客户端 / macOS 通用(.app + .dmg) (push) Canceled after 0s
feat(match): 同步比赛计时与装甲板扣血许可
- feat(client): 增加裁判比赛计时、技术暂停与选手端局域网同步
- feat(armor): 红蓝共用通用固件,按客户端选队并显示网络连接状态
- feat(armor): 仅在对局进行中允许扣血,其他阶段保留受击闪烁
- feat(client): 将计时置于血条中间并增加开赛前五秒全屏动画
- fix(client): 修复连续血条、对手镜像和图传断连灰度遮罩
- fix(client): 统一界面中文字体并整理各页面文案
- fix(maintenance): 备份迁移装甲板分区,恢复 SDK 构建与固件打包
- refactor(repo): 按 armor、vt 和 client 整理工程与脚本,移除旧参考实现
- test: 补充线路、受击许可、回环 UDP、维护和 HUD 验证
- docs: 同步构建、协议、比赛控制和硬件验证边界

验证:前端构建与 19 项相关测试通过;核心 91 项单元测试与 2 项回环 UDP 集成测试通过;装甲板规则 25 项、线路 26 项、Tauri 51 项测试通过;独立探测器 5 项与目录回归 4 项通过。完成 C3 两组阈值实际编译、导出与 ZIP 校验,检查 900×600 / 1280×720 页面、倒计时和随包中文字体。
未执行烧录、板上运行、跨电脑广播或硬件稳定性验证。
2026-10-22 17:08:49 +08:00

23 lines
3.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 仅开发浏览器预览,展示合成设备/进度;不模拟可调用的 USB 后端。 */
import type { BundleInfo, DeviceSnapshot, FlashPlan, FlashReport } from "./maintenance";
export function maintenancePreview(stage: string) {
const partitions = [
{ name: "nvs", kind: 1, subtype: 2, offset: 0x9000, size: 0x6000, flags: 0 },
{ name: "phy_init", kind: 1, subtype: 1, offset: 0xf000, size: 0x1000, flags: 0 },
{ name: "factory", kind: 0, subtype: 0, offset: 0x10000, size: 0x200000, flags: 0 },
];
const hash = "0".repeat(64);
const device: DeviceSnapshot = { port: "PREVIEW-USB", chip: "esp32c3", revision: "v0.4", flashSize: 0x400000, flashSizeText: "4 MB", mac: "02:00:00:00:00:01", features: [], secureBoot: false, secureDownload: false, flashEncryption: false, securityFlags: 0, flashCryptCnt: 0, partitionTable: partitions, app: null, freeRanges: [], tableSha256: hash };
const bundle: BundleInfo = { firmwareKind: "armor", armorTeam: stage === "mismatch" ? 0 : null, armorThreshold: 2000, path: "PREVIEW ONLY", sourceKind: "zip", sourcePath: "PREVIEW ONLY", sourceSha256: hash, entryCount: 4, name: "合成装甲板固件", version: "预览", chip: "esp32c3", appFile: "armor-app.bin", appSha256: hash, appSize: 1084736, partitionTableFile: "partition-table.bin", partitionTableSha256: hash, bootloaderFile: "bootloader.bin", bootloaderSha256: hash, appPartitionSize: 0x200000, flashSize: "4mb", flashSizeBytes: 0x400000, flashMode: "dio", flashFrequency: "40mhz", notes: "合成数据,不可烧录" };
const plan: FlashPlan = { mode: "armor-install", confirmation: "PREVIEW ONLY", port: device.port, device, bundle, candidates: [{ offset: 0x10000, size: 0x200000 }], targetOffset: 0x10000, targetSize: 0x200000, appSize: bundle.appSize, appPartitionSize: 0x200000, currentFactoryOffset: 0x10000, currentFactorySize: 0x200000, currentTable: partitions, patchedTable: partitions, tableShaBefore: hash, tableShaAfter: hash, oldAppPreserved: false, warnings: ["C3 固定地址安装:写入 Bootloader(0x0)、分区表(0x8000)和 App(0x10000),旧 App 会被覆盖。", "先完整备份 4 MB Flash,备份失败则停止;失败后需用同一设备的完整备份恢复,仅恢复分区表无效。", "保留 NVS / PHY;通用固件在客户端绑定后按所选队伍改变灯色。"], canFlash: true };
if (stage === "migrate") {
device.partitionTable = partitions.map(entry => entry.name === "factory" ? { ...entry, size: 0x100000 } : entry);
plan.currentTable = device.partitionTable;
plan.currentFactorySize = 0x100000;
plan.warnings[2] = "现有布局需迁移:完整备份成功后初始化新布局的 NVS / PHY(0x9000–0x10000),原配置会清除;旧数据可通过完整备份恢复。";
}
const report: FlashReport = { mode: "armor-install", bootloaderVerified: true, ok: stage !== "failure", port: device.port, chip: device.chip, mac: device.mac, bundleName: bundle.name, bundleVersion: bundle.version, targetOffset: 0x10000, targetSize: 0x200000, appSize: bundle.appSize, appSha256: hash, tableShaBefore: hash, tableShaAfter: hash, attempts: [], appVerified: stage !== "failure", tableVerified: stage !== "failure", tableRestored: false, needsRollback: stage === "failure", bootOk: null, bootLog: "合成日志 / 未连接设备", backupDir: "PREVIEW ONLY", note: "合成结果,不能代表硬件验证。", error: stage === "failure" ? "合成故障:App 回读不一致。" : null, startedAt: "PREVIEW ONLY", finishedAt: "PREVIEW ONLY" };
return { device, bundle, plan, report };
}