feat: When a call is cleared from MSHV/WSJTx/JTDX it also clears the call field of OpsLog
This commit is contained in:
@@ -52,6 +52,11 @@ type Event struct {
|
||||
DecodeFreqHz int64 // RF frequency (dial + audio offset)
|
||||
DecodeSNR int // reported SNR (dB)
|
||||
DecodeCQ bool // the decode was a CQ
|
||||
|
||||
// ClearCall is set when a WSJT/JTDX/MSHV Status message reports an EMPTY DX
|
||||
// Call after previously reporting one — i.e. the operator cleared the call in
|
||||
// the digital app. OpsLog clears its entry to match.
|
||||
ClearCall bool
|
||||
}
|
||||
|
||||
// Server is a single inbound UDP listener.
|
||||
@@ -64,7 +69,8 @@ type Server struct {
|
||||
stopped bool
|
||||
mu sync.Mutex
|
||||
|
||||
lastDialHz int64 // WSJT: dial freq from the last Status, added to Decode offsets
|
||||
lastDialHz int64 // WSJT: dial freq from the last Status, added to Decode offsets
|
||||
lastDX string // WSJT: last non-empty DX Call seen, to detect a clear
|
||||
}
|
||||
|
||||
func newServer(cfg Config, out chan<- Event) *Server {
|
||||
@@ -213,6 +219,17 @@ func (s *Server) handle(pkt []byte, remote *net.UDPAddr) {
|
||||
ev.Mode = w.Mode
|
||||
ev.FreqHz = w.FreqHz
|
||||
ev.LoggedADIF = w.LoggedADIF
|
||||
// A Status with an empty DX Call, right after one that had a call, means the
|
||||
// operator cleared it in WSJT-X / JTDX / MSHV. Fire ONE clear (tracked per
|
||||
// server) — an idle app sends empty Status every second, and we must not
|
||||
// re-clear (which would fight a manual entry) on each of those.
|
||||
s.mu.Lock()
|
||||
prev := s.lastDX
|
||||
s.lastDX = w.DXCall
|
||||
s.mu.Unlock()
|
||||
if w.DXCall == "" && prev != "" {
|
||||
ev.ClearCall = true
|
||||
}
|
||||
case ServiceADIF:
|
||||
// JTAlert / GridTracker forward a text ADIF record after a QSO is
|
||||
// logged. Guard against keep-alive / non-ADIF chatter on the socket:
|
||||
@@ -268,8 +285,9 @@ func (s *Server) handle(pkt []byte, remote *net.UDPAddr) {
|
||||
default:
|
||||
return
|
||||
}
|
||||
// Empty events are useless; skip.
|
||||
if ev.DXCall == "" && ev.LoggedADIF == "" && ev.DecodeCall == "" {
|
||||
// Empty events are useless; skip — EXCEPT a clear signal, which is meant to be
|
||||
// empty (the DX Call was cleared in the digital app).
|
||||
if ev.DXCall == "" && ev.LoggedADIF == "" && ev.DecodeCall == "" && !ev.ClearCall {
|
||||
return
|
||||
}
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user