fix(udp): edge-detect the decoder's DX Call stream

WSJT-X restates the same DX Call in every Status packet, and a spot clicked
in OpsLog put that call into the last-UDP memory (deliberately, for another
case) — so the guard let the decoder's next restatement straight through and
the entry snapped back to old news. The decoder's stream now only counts when
its value CHANGES; a clear over there resets the edge so re-selecting the
same station still lands. Explicit picks (N1MM, remote, spot relays) are
untouched.
This commit is contained in:
2026-08-30 15:29:07 +02:00
parent 3c59507bc3
commit 997bc81d5e
2 changed files with 19 additions and 2 deletions
+15
View File
@@ -2667,6 +2667,11 @@ export default function App() {
// "the field still shows the previous broadcast" (safe to update) from "the
// user has typed a different call" (must not clobber).
const lastUdpCallRef = useRef('');
// Edge detection for the DECODER'S stream: WSJT-X/JTDX/MSHV re-broadcast the
// same DX Call in every Status packet, seconds apart, forever. Applying each
// one meant a spot clicked in OpsLog was overwritten moments later by the
// decoder restating old news. Only a CHANGE in this stream is an event.
const lastWsjtEdgeRef = useRef('');
// When the entered callsign turns out to be worked-before, jump to the
// Worked-before tab so the history is front-and-centre. Only once per call,
@@ -3796,6 +3801,13 @@ export default function App() {
// Anything that isn't WSJT-X (N1MM, ADIF, a panadapter/cluster click relayed
// over UDP…) is an explicit pick → force it over an existing call.
const force = String(p?.service ?? '').toLowerCase() !== 'wsjt';
if (!force) {
// The decoder's stream: same value as last time = no edge = no update.
// Only a changed DX Call is the operator doing something over there.
const upper = String(p?.call ?? '').trim().toUpperCase();
if (upper && upper === lastWsjtEdgeRef.current) return;
lastWsjtEdgeRef.current = upper;
}
// External app moved to a new station → fresh recording for the new target.
if (applyUdpCall(p?.call, force)) restartRecordingForNewTarget(String(p?.call ?? ''));
});
@@ -3806,6 +3818,9 @@ export default function App() {
// Only when something is actually in the entry, so an idle digital app doesn't
// wipe a call being typed by hand.
const unsubClear = EventsOn('udp:clear_call', () => {
// The decoder cleared its DX Call: the next call it announces — even the
// same one re-selected — is a fresh edge.
lastWsjtEdgeRef.current = '';
if (callsignRef.current?.value?.trim() || callsign.trim()) resetEntry();
});
// Clicked one of OpsLog's spots on the FlexRadio panadapter → fill the call