mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-07 01:55:51 +08:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -4829,10 +4829,11 @@ const bridgeSimActiveFreq = ref<string | null>(null)
|
|||||||
const BRIDGE_TELEMETRY_STALE_MS = 12_000
|
const BRIDGE_TELEMETRY_STALE_MS = 12_000
|
||||||
const BRIDGE_POLL_INTERVAL_MS = 3_000
|
const BRIDGE_POLL_INTERVAL_MS = 3_000
|
||||||
let bridgePoller: ReturnType<typeof setInterval> | null = null
|
let bridgePoller: ReturnType<typeof setInterval> | null = null
|
||||||
// Last sim frequencies we pushed into the radio — only re-tune when the sim
|
// Last sim active frequency we pushed into the radio — only re-tune active when
|
||||||
// value actually changes, so manual/flow tuning isn't constantly overridden.
|
// 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 lastSyncedSimActive: string | null = null
|
||||||
let lastSyncedSimStandby: string | null = null
|
|
||||||
|
|
||||||
function normalizeSimFreq(value: unknown): string | null {
|
function normalizeSimFreq(value: unknown): string | null {
|
||||||
const num = typeof value === 'number' ? value : Number(value)
|
const num = typeof value === 'number' ? value : Number(value)
|
||||||
@@ -4853,9 +4854,8 @@ async function pollBridgeTelemetry() {
|
|||||||
bridgeConnected.value = fresh
|
bridgeConnected.value = fresh
|
||||||
|
|
||||||
if (!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
|
lastSyncedSimActive = null
|
||||||
lastSyncedSimStandby = null
|
|
||||||
bridgeSimActiveFreq.value = null
|
bridgeSimActiveFreq.value = null
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -4874,12 +4874,11 @@ async function pollBridgeTelemetry() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mirror COM1 standby (no audio side effects — it's just the staged channel).
|
// Mirror COM1 standby (no audio side effects — it's just the staged
|
||||||
if (simStandby && simStandby !== lastSyncedSimStandby) {
|
// channel). While connected the standby always reflects the sim's standby
|
||||||
lastSyncedSimStandby = simStandby
|
// radio, never the previously tuned channel.
|
||||||
if (frequencies.value.standby !== simStandby) {
|
if (simStandby && frequencies.value.standby !== simStandby) {
|
||||||
frequencies.value.standby = simStandby
|
frequencies.value.standby = simStandby
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
bridgeConnected.value = false
|
bridgeConnected.value = false
|
||||||
@@ -4908,7 +4907,6 @@ watch(bridgeToken, () => {
|
|||||||
bridgeConnected.value = false
|
bridgeConnected.value = false
|
||||||
bridgeSimActiveFreq.value = null
|
bridgeSimActiveFreq.value = null
|
||||||
lastSyncedSimActive = null
|
lastSyncedSimActive = null
|
||||||
lastSyncedSimStandby = null
|
|
||||||
startBridgeSync()
|
startBridgeSync()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user