From e160ddec6d81dd911ff5efe8081fb24d2af6f0c5 Mon Sep 17 00:00:00 2001 From: itsrubberduck Date: Fri, 19 Jun 2026 13:40:20 +0200 Subject: [PATCH] fix(pm): standby strictly mirrors sim while bridge connected Standby used change-detection like active, so a locally tuned standby lingered as "the last" channel. While the bridge is connected, standby now always reflects COM_STANDBY_FREQUENCY from telemetry on every poll. Active keeps its change-detection anchor so flow/manual tuning isn't overridden. Co-Authored-By: Claude Opus 4.8 --- app/pages/pm.vue | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/pages/pm.vue b/app/pages/pm.vue index 9e54735..8623856 100644 --- a/app/pages/pm.vue +++ b/app/pages/pm.vue @@ -4829,10 +4829,11 @@ const bridgeSimActiveFreq = ref(null) const BRIDGE_TELEMETRY_STALE_MS = 12_000 const BRIDGE_POLL_INTERVAL_MS = 3_000 let bridgePoller: ReturnType | null = null -// Last sim frequencies we pushed into the radio — only re-tune when the sim -// value actually changes, so manual/flow tuning isn't constantly overridden. +// Last sim active frequency we pushed into the radio — only re-tune active when +// the sim value actually changes, so manual/flow tuning isn't constantly +// overridden. Standby has no such anchor: while connected it strictly mirrors +// the sim's standby radio. let lastSyncedSimActive: string | null = null -let lastSyncedSimStandby: string | null = null function normalizeSimFreq(value: unknown): string | null { const num = typeof value === 'number' ? value : Number(value) @@ -4853,9 +4854,8 @@ async function pollBridgeTelemetry() { bridgeConnected.value = fresh if (!fresh) { - // Bridge went quiet — drop the sync anchors so reconnecting re-tunes. + // Bridge went quiet — drop the active sync anchor so reconnecting re-tunes. lastSyncedSimActive = null - lastSyncedSimStandby = null bridgeSimActiveFreq.value = null return } @@ -4874,12 +4874,11 @@ async function pollBridgeTelemetry() { } } - // Mirror COM1 standby (no audio side effects — it's just the staged channel). - if (simStandby && simStandby !== lastSyncedSimStandby) { - lastSyncedSimStandby = simStandby - if (frequencies.value.standby !== simStandby) { - frequencies.value.standby = simStandby - } + // Mirror COM1 standby (no audio side effects — it's just the staged + // channel). While connected the standby always reflects the sim's standby + // radio, never the previously tuned channel. + if (simStandby && frequencies.value.standby !== simStandby) { + frequencies.value.standby = simStandby } } catch { bridgeConnected.value = false @@ -4908,7 +4907,6 @@ watch(bridgeToken, () => { bridgeConnected.value = false bridgeSimActiveFreq.value = null lastSyncedSimActive = null - lastSyncedSimStandby = null startBridgeSync() })