修改交管和信号交互插件加载时机

This commit is contained in:
ykkokluo
2026-08-25 08:59:00 +08:00
parent 134c7480b3
commit c5c1578696
25 changed files with 589 additions and 73 deletions
@@ -35,15 +35,14 @@ const NAV_SCENE: Record<string, string> = {
laser: 'scene.qrlidar'
}
function toLauncherSceneIds(kinds: string[]): string[] {
function toLauncherSceneIds(kinds: string[], scenarios: string[] = []): string[] {
const result: string[] = []
for (const k of kinds) {
const id = NAV_SCENE[k] ?? `scene.${k}`
if (!result.includes(id)) result.push(id)
}
if (kinds.some((k) => k.toLowerCase() === 'magnetic') && !result.includes('scene.signal')) {
result.push('scene.signal')
}
const wantSignal = scenarios.some((s) => s === 'tpl-sps' || s === 'tpl-pack')
if (wantSignal && !result.includes('scene.signal')) result.push('scene.signal')
if (result.length > 0 && !result.includes('scene.device')) result.push('scene.device')
return result
}
@@ -80,7 +79,7 @@ export async function saveWizardProfile(req: SaveWizardRequest): Promise<Deploym
navigationKinds: req.navigationKinds ?? [],
scenarios: req.scenarios ?? [],
configured: true,
activeSceneIds: toLauncherSceneIds(req.navigationKinds ?? [])
activeSceneIds: toLauncherSceneIds(req.navigationKinds ?? [], req.scenarios ?? [])
}
return mockProfile
}