From c0204f6b02c03f1b39c293cf413bfa7c4e3d18b5 Mon Sep 17 00:00:00 2001 From: alberto Date: Sat, 17 Oct 2026 10:19:33 +0200 Subject: [PATCH] Recover idle radio scanning and reject stale sync progress responses --- README.md | 2 ++ packet-preparation.mjs | 3 +++ public/index.html | 2 +- public/sync-progress.js | 11 ++++++----- public/sync-state.js | 7 +++++++ server.mjs | 2 +- sync-operations.mjs | 6 +++--- sync-operations.test.mjs | 6 ++++++ sync-state.test.mjs | 14 ++++++++++++++ 9 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 public/sync-state.js create mode 100644 sync-state.test.mjs diff --git a/README.md b/README.md index d57713e..179f0fc 100644 --- a/README.md +++ b/README.md @@ -199,3 +199,5 @@ Packet controller integrations must acknowledge a reserved slot with `pttReady: The local packet controller can use `packet-preparation.mjs` to prioritize an idle manual Packet request by advancing BPQ's native scan toward its configured packet entry. This retains the native modem interlock (for example VARA V0/LISTEN OFF), rather than directly retuning from an HF receive slot. Do not advance while attached, connecting, transmitting, or paused. Forwarding and Winlink share the same slot handshake; its measured `preparationMs` is saved with the reservation. A single radio still requires exclusive access to the selected frequency. Manual forwarding and Winlink sync buttons open a live progress dialog (preparation, calling, message exchange, restoration and outcome). Minimize keeps the session running. Interrupt cancels pending packet preparation or disconnects only the matching native BBS partner, then restores the temporary radio profile. Progress jobs are kept by the Console process; restarting the Console clears their visual history. Mail column headings share the same scroll area as their rows. + +Sync status responses carry a revision; the browser rejects late responses for previous jobs and never revives a terminal session. The local radio controller can use `canRecoverIdleScan` to release stale scan holds only after eight seconds of verified RF inactivity, without overriding active links, manual packet reservations or TX pause. diff --git a/packet-preparation.mjs b/packet-preparation.mjs index 2701077..9f26280 100644 --- a/packet-preparation.mjs +++ b/packet-preparation.mjs @@ -6,3 +6,6 @@ export function canExpeditePacket({request,manualRequestId,txSuspended,ptt,conne export function shouldAdvancePacketScan({frequency,packetFrequencyMHz,lastFrequency,lastAdvance=0,now=Date.now()}){ return Number.isFinite(frequency)&&Number.isFinite(packetFrequencyMHz)&&Math.abs(frequency-packetFrequencyMHz)>0.0001&&(frequency!==lastFrequency||now-lastAdvance>=1500); } +export function canRecoverIdleScan({phase,scanning,txSuspended,ptt,request,manualRequestId,radioState,users,radioPorts=null,lastPtt=0,idleSince=0,now=Date.now()}){ + return Boolean(['hf','waiting'].includes(phase)&&!scanning&&!request&&!manualRequestId&&idleSince&&now-idleSince>=8000&&canExpeditePacket({request:{id:'scan-recovery'},manualRequestId,txSuspended,ptt,connections:0,radioState,users,radioPorts,lastPtt,now})); +} diff --git a/public/index.html b/public/index.html index f4d29b8..8bbc4a6 100644 --- a/public/index.html +++ b/public/index.html @@ -1,5 +1,5 @@ -BPQ Console +BPQ Console