Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6345710de5 | ||
|
|
0cab1c1e6b | ||
|
|
1c71495446 | ||
|
|
2c0158b75c | ||
|
|
a2b019b280 | ||
|
|
1fba7d2d57 | ||
|
|
490941f506 | ||
|
|
6bf759b6ae | ||
|
|
43e5088e96 | ||
|
|
582fa561b2 | ||
|
|
7f328d4eb5 | ||
|
|
b2eb6a4b1e | ||
|
|
c2db4c5f7e | ||
|
|
b246c4d10a | ||
|
|
6d4a110949 | ||
|
|
ffbbff80d6 | ||
|
|
bd2edf6624 | ||
|
|
6321948415 | ||
|
|
89e239d83f | ||
|
|
0e48ad7bb2 | ||
|
|
ad82c21dbc | ||
|
|
6f126802cd | ||
|
|
704b614c38 | ||
|
|
6eb6f1b339 | ||
|
|
dbd2fff121 | ||
|
|
dc6da67cbf | ||
|
|
ea6fb1c29c | ||
|
|
29267a865c | ||
|
|
e93d2d36a8 | ||
|
|
107c6fccf6 | ||
|
|
9350af9589 | ||
|
|
a9a6579a9a | ||
|
|
7795e13432 | ||
|
|
c9e98d5fdd | ||
|
|
72253f99fa | ||
|
|
f0d3bed8a2 | ||
|
|
30c9acf0d2 | ||
|
|
e3175ef6a3 | ||
|
|
441eb295c6 | ||
|
|
cb2f8aba72 | ||
|
|
7b9cda93bc | ||
|
|
8f64e3fee3 | ||
|
|
c4de5f2ea0 | ||
|
|
9172f504e5 | ||
|
|
7322e2ab66 | ||
|
|
29d79fb5d1 | ||
|
|
f6b70184a7 | ||
|
|
e4abcda94f | ||
|
|
284ee4ba7c | ||
|
|
10ef984962 | ||
|
|
bd8719ce99 | ||
|
|
5e38319379 | ||
|
|
7e7ad50f60 | ||
|
|
0f4e31853b | ||
|
|
c222468021 | ||
|
|
2fb4a4d0ce | ||
|
|
e4828482c4 | ||
|
|
8acfda4e42 | ||
|
|
db24c38e63 | ||
|
|
06868e9ed1 | ||
|
|
3ed643e072 | ||
|
|
f0f9898f7c | ||
|
|
73cae855ed | ||
|
|
de3a115ca6 | ||
|
|
1d7633484b | ||
|
|
5ee0ade54b | ||
|
|
e637f0814d | ||
|
|
1a169fdb4f | ||
|
|
3dc31697cd |
@@ -74,6 +74,7 @@ import (
|
||||
"hamlog/internal/tunergenius"
|
||||
"hamlog/internal/uls"
|
||||
"hamlog/internal/ultrabeam"
|
||||
"hamlog/internal/watchlist"
|
||||
"hamlog/internal/winkeyer"
|
||||
|
||||
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
@@ -97,6 +98,7 @@ const (
|
||||
|
||||
keyStationCallsign = "station.callsign"
|
||||
keyStationOperator = "station.operator"
|
||||
keyWatchlistContestPattern = "watchlist.contest_pattern" // auto-add contest calls containing this
|
||||
keyStationMyGrid = "station.my_grid"
|
||||
keyStationCountry = "station.my_country"
|
||||
keyStationSOTA = "station.my_sota_ref"
|
||||
@@ -735,6 +737,10 @@ type App struct {
|
||||
uls *uls.Store // US callsign→county/grid (offline FCC ULS), lazily opened
|
||||
awardRefs *awardref.Repo
|
||||
qslTemplates *qslcard.Repo
|
||||
watchlist *watchlist.Store // Tools → Watchlist (global watchlist.json)
|
||||
watchAlertMu sync.Mutex // throttles watchlist alerts…
|
||||
watchAlertAt map[string]time.Time // …per entry
|
||||
watchPattern atomic.Value // auto-contest pattern (string), loaded at startup
|
||||
operating *operating.Repo
|
||||
udp *udp.Manager
|
||||
udpRepo *udp.Repo
|
||||
@@ -1015,6 +1021,13 @@ func (a *App) startup(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
a.dataDir = dataDir
|
||||
// The watchlist needs nothing but its file, so it opens FIRST. It used to be
|
||||
// created after the logbook connect, and a remote MySQL dial of 10-30 s left
|
||||
// the tab saying "Watchlist: 0" until the next refresh tick — twenty seconds
|
||||
// of an empty list for a JSON file that reads in a millisecond. (The
|
||||
// auto-contest pattern still loads later, once the settings store is open.)
|
||||
a.watchlist = watchlist.New(filepath.Join(dataDir, "watchlist.json"))
|
||||
a.watchAlertAt = map[string]time.Time{}
|
||||
// Settings/config database (settings + profiles). Fresh installs use
|
||||
// settings.db; existing installs keep their opslog.db (which also held the
|
||||
// QSOs before they were split into a dedicated logbook file — see below).
|
||||
@@ -1239,6 +1252,49 @@ func (a *App) startup(ctx context.Context) {
|
||||
go a.applyRelayAuto(s.FreqHz, s.Band)
|
||||
}
|
||||
})
|
||||
// Digital Voice Keyer + QSO recorder (WASAPI). Idle until used. Created
|
||||
// BEFORE the CAT link comes up, and it matters: a network Icom with RX
|
||||
// audio enabled builds its audio sink inside reloadCAT, gated on audioMgr —
|
||||
// when the manager was created later, every fresh launch connected with
|
||||
// audio silently off, and the operator had to untick/save/retick the option
|
||||
// to hear anything.
|
||||
a.audioMgr = audio.NewManager(func() {
|
||||
st := a.dvkStatus()
|
||||
// When a voice message finishes (or is stopped), drop the PTT we keyed
|
||||
// for it — but tag the release with the current key generation so it
|
||||
// can't cut a transmission a newer message already started.
|
||||
if !st.Playing {
|
||||
a.pttMu.Lock()
|
||||
keyed := a.dvkPttKeyed
|
||||
gen := a.pttGen
|
||||
if keyed {
|
||||
a.dvkPttKeyed = false
|
||||
}
|
||||
a.pttMu.Unlock()
|
||||
if keyed {
|
||||
go a.dvkUnkeyPTT(gen)
|
||||
}
|
||||
// And give the microphone back, if we took it (see raiseFlexDVKDax).
|
||||
// Off the callback's goroutine: this talks to the radio, and the
|
||||
// audio manager is reporting a state change, not waiting on us.
|
||||
go a.lowerFlexDVKDax()
|
||||
}
|
||||
if a.ctx != nil {
|
||||
wruntime.EventsEmit(a.ctx, "audio:status", st)
|
||||
}
|
||||
})
|
||||
a.qsoRec = audio.NewRecorder()
|
||||
if a.audioMgr != nil {
|
||||
// A running monitor picks the new level up immediately: the operator is
|
||||
// listening while they move the slider, and asking them to stop and
|
||||
// restart it to hear the change is how a working control gets reported
|
||||
// as broken.
|
||||
if cfg, err := a.GetAudioSettings(); err == nil {
|
||||
a.audioMgr.SetMonitorGain(cfg.FromGain)
|
||||
}
|
||||
}
|
||||
a.startQSORecorderIfEnabled()
|
||||
|
||||
a.reloadCAT()
|
||||
|
||||
// The QSO logbook lives where the ACTIVE PROFILE points it: the local SQLite
|
||||
@@ -1385,6 +1441,8 @@ func (a *App) startup(ctx context.Context) {
|
||||
// POTA: background poller of api.pota.app so cluster spots can be tagged
|
||||
// when the DX station is currently activating a park. Best-effort.
|
||||
a.pota = pota.New(func(format string, args ...any) { applog.Printf(format, args...) })
|
||||
a.startWatchlistClubLog()
|
||||
a.watchPattern.Store(strings.ToUpper(strings.TrimSpace(a.settingOr(keyWatchlistContestPattern, ""))))
|
||||
go a.pota.Run(a.ctx)
|
||||
|
||||
// DX Cluster (multi-server): the spot callback enriches each spot
|
||||
@@ -1464,44 +1522,6 @@ func (a *App) startup(ctx context.Context) {
|
||||
})
|
||||
a.solar.Start()
|
||||
|
||||
// Digital Voice Keyer + QSO recorder (WASAPI). Idle until used.
|
||||
a.audioMgr = audio.NewManager(func() {
|
||||
st := a.dvkStatus()
|
||||
// When a voice message finishes (or is stopped), drop the PTT we keyed
|
||||
// for it — but tag the release with the current key generation so it
|
||||
// can't cut a transmission a newer message already started.
|
||||
if !st.Playing {
|
||||
a.pttMu.Lock()
|
||||
keyed := a.dvkPttKeyed
|
||||
gen := a.pttGen
|
||||
if keyed {
|
||||
a.dvkPttKeyed = false
|
||||
}
|
||||
a.pttMu.Unlock()
|
||||
if keyed {
|
||||
go a.dvkUnkeyPTT(gen)
|
||||
}
|
||||
// And give the microphone back, if we took it (see raiseFlexDVKDax).
|
||||
// Off the callback's goroutine: this talks to the radio, and the
|
||||
// audio manager is reporting a state change, not waiting on us.
|
||||
go a.lowerFlexDVKDax()
|
||||
}
|
||||
if a.ctx != nil {
|
||||
wruntime.EventsEmit(a.ctx, "audio:status", st)
|
||||
}
|
||||
})
|
||||
a.qsoRec = audio.NewRecorder()
|
||||
if a.audioMgr != nil {
|
||||
// A running monitor picks the new level up immediately: the operator is
|
||||
// listening while they move the slider, and asking them to stop and
|
||||
// restart it to hear the change is how a working control gets reported
|
||||
// as broken.
|
||||
if cfg, err := a.GetAudioSettings(); err == nil {
|
||||
a.audioMgr.SetMonitorGain(cfg.FromGain)
|
||||
}
|
||||
}
|
||||
a.startQSORecorderIfEnabled()
|
||||
|
||||
// NET Control store (global JSON, shared across logbooks).
|
||||
if ns, err := netctl.Open(filepath.Join(a.dataDir, "nets.json")); err != nil {
|
||||
applog.Printf("netctl: open failed: %v", err)
|
||||
@@ -1796,6 +1816,9 @@ func (a *App) setSettingGlobal(key, val string) {
|
||||
}
|
||||
|
||||
func (a *App) shutdown(ctx context.Context) {
|
||||
if a.watchlist != nil {
|
||||
a.watchlist.Flush() // the save debounce would lose the last edits
|
||||
}
|
||||
// If the user managed to skip beforeClose (force kill, OS shutdown,
|
||||
// crash recovery) we still try the backup here as a best-effort
|
||||
// safety net. HasBackupToday makes a double-run a no-op.
|
||||
@@ -6938,6 +6961,28 @@ func (a *App) BulkUpdateField(ids []int64, field, value string) (int64, error) {
|
||||
if field == "freq" {
|
||||
return a.bulkSetFrequency(ids, value)
|
||||
}
|
||||
// The station-side numbers. Bounded so a slip cannot stamp CQ zone 400 on a
|
||||
// thousand rows: DXCC entities stop short of 1000, CQ zones at 40, ITU at 90.
|
||||
// Empty clears (NULL).
|
||||
if field == "my_dxcc" || field == "my_cq_zone" || field == "my_itu_zone" {
|
||||
var vp *int
|
||||
if t := strings.TrimSpace(value); t != "" {
|
||||
v, err := strconv.Atoi(t)
|
||||
max := map[string]int{"my_dxcc": 999, "my_cq_zone": 40, "my_itu_zone": 90}[field]
|
||||
if err != nil || v < 1 || v > max {
|
||||
return 0, fmt.Errorf("%s must be a number between 1 and %d (empty to clear)", field, max)
|
||||
}
|
||||
vp = &v
|
||||
}
|
||||
n, err := a.qso.BulkSetIntField(a.ctx, ids, field, vp)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if n > 0 {
|
||||
a.invalidateAwardStats()
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
// Some ADIF fields have no promoted column and live in extras_json
|
||||
// (OWNER_CALLSIGN) — those take the JSON path so the rest of the extras on
|
||||
// each QSO survive the edit.
|
||||
@@ -8981,6 +9026,10 @@ func (a *App) clusterEventWorker() {
|
||||
a.detectBandOpening(s)
|
||||
// Fire any matching alert rules (sound / visual / e-mail).
|
||||
a.evaluateAlerts(s)
|
||||
// The watchlist sees the same live stream the alerts do — never the
|
||||
// SH/DX replay above, which would mark forty stations "just seen" with
|
||||
// spots from three hours ago.
|
||||
a.watchSpot(s.DXCall, s.Band, alerts.InferMode(s.Comment, s.FreqHz), s.Country, s.Comment, s.FreqHz)
|
||||
// Mirror the spot onto the FlexRadio panadapter when enabled. Infer the
|
||||
// mode (from the comment, else the band plan) so clicking the spot on the
|
||||
// panadapter tunes AND switches mode — a DX cluster line carries no mode,
|
||||
@@ -9218,7 +9267,9 @@ func (a *App) QSOAudioManualReady() bool {
|
||||
return false
|
||||
}
|
||||
cfg, _ := a.GetAudioSettings()
|
||||
return !cfg.QSORecord && strings.TrimSpace(cfg.FromRadio) != ""
|
||||
// Over the network the radio needs no sound card: the 50003 stream is the
|
||||
// source, so the button is offered even with "From radio" empty.
|
||||
return !cfg.QSORecord && (strings.TrimSpace(cfg.FromRadio) != "" || a.icomNetAudioActive())
|
||||
}
|
||||
|
||||
// QSOAudioManualStart begins a recording when automatic recording is off.
|
||||
@@ -9235,10 +9286,19 @@ func (a *App) QSOAudioManualStart() bool {
|
||||
}
|
||||
if !a.qsoRec.Running() {
|
||||
cfg, _ := a.GetAudioSettings()
|
||||
if strings.TrimSpace(cfg.FromRadio) == "" {
|
||||
// Same source rule as the automatic recorder: when the RX audio arrives
|
||||
// over the network, record THAT — not the "From radio" sound card, which
|
||||
// on a mixed station is another radio entirely. A manual take on the
|
||||
// network IC-7760 was capturing the Flex's DAX: technically a recording,
|
||||
// just not of the QSO being made.
|
||||
from := cfg.FromRadio
|
||||
a.qsoRecPushed = a.icomNetAudioActive() || cfg.FromRadio == audio.NetworkDeviceID
|
||||
if a.qsoRecPushed {
|
||||
from = audio.PushedSource
|
||||
} else if strings.TrimSpace(from) == "" {
|
||||
return false
|
||||
}
|
||||
if err := a.qsoRec.Start(cfg.FromRadio, cfg.RecordingDevice, cfg.PrerollSeconds); err != nil {
|
||||
if err := a.qsoRec.Start(from, cfg.RecordingDevice, cfg.PrerollSeconds); err != nil {
|
||||
applog.Printf("qso-rec: manual start failed: %v", err)
|
||||
return false
|
||||
}
|
||||
@@ -10623,6 +10683,16 @@ func (a *App) AudioStartMonitor() error {
|
||||
if strings.TrimSpace(cfg.FromRadio) == "" {
|
||||
return fmt.Errorf(`no "From radio" capture device set — pick the rig's USB Audio CODEC in Settings → Audio`)
|
||||
}
|
||||
// When the rig's audio arrives over the NETWORK (Icom 50003), the monitor
|
||||
// must be render-only: this button used to start a USB capture from the
|
||||
// "From radio" device as well, and that second producer — often another
|
||||
// radio's DAX — interleaved its chunks with the network stream's pushes.
|
||||
// The result was audio chopped to pieces the moment the operator toggled
|
||||
// Listening off and on while connected to a network Icom.
|
||||
if cs, err := a.GetCATSettings(); err == nil && cs.Enabled && cs.Backend == "icom-net" && cs.IcomNetAudio {
|
||||
applog.Printf("audio: RX monitor start (network sink only → listen=%q)", cfg.ListeningDevice)
|
||||
return a.audioMgr.StartMonitorSink(cfg.ListeningDevice)
|
||||
}
|
||||
applog.Printf("audio: RX monitor start (from=%q → listen=%q)", cfg.FromRadio, cfg.ListeningDevice)
|
||||
a.audioMgr.SetMonitorGain(cfg.FromGain)
|
||||
return a.audioMgr.StartMonitor(cfg.FromRadio, cfg.ListeningDevice)
|
||||
@@ -11576,6 +11646,10 @@ func (a *App) runManualUpload(svc extsvc.Service, ids []int64, cfg extsvc.Extern
|
||||
// with award-style NEW flags computed against the log's prior confirmations.
|
||||
type ConfirmationItem struct {
|
||||
Callsign string `json:"callsign"`
|
||||
// Station is the callsign the QSO was made UNDER, which the download can now
|
||||
// span ("All my callsigns"): a list mixing F4BPO, F4BPO/P and TM2Q says
|
||||
// nothing useful unless each line says which of them it belongs to.
|
||||
Station string `json:"station"`
|
||||
QSODate string `json:"qso_date"` // ISO UTC
|
||||
Band string `json:"band"`
|
||||
Mode string `json:"mode"`
|
||||
@@ -12365,6 +12439,7 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
|
||||
}
|
||||
it := ConfirmationItem{
|
||||
Callsign: q.Callsign,
|
||||
Station: strings.ToUpper(strings.TrimSpace(rec["station_callsign"])),
|
||||
QSODate: q.QSODate.UTC().Format(time.RFC3339),
|
||||
Band: q.Band,
|
||||
Mode: q.Mode,
|
||||
@@ -15524,6 +15599,20 @@ func (a *App) reloadCAT() {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// The IC-7760 streams TWO-channel LPCM whatever the conninfo
|
||||
// asks for (rxcodec 0x02 was requested, 1280-byte payloads
|
||||
// kept arriving — 320 stereo frames per 20 ms tick, right
|
||||
// channel all zeros). Played as mono that is half-speed
|
||||
// metallic garble. A stereo-sized packet is folded to its
|
||||
// left channel; a 640-byte mono packet (a rig that honours
|
||||
// the request) passes through untouched.
|
||||
if len(pcm) == 1280 {
|
||||
mono := make([]byte, len(pcm)/2)
|
||||
for i := 0; i+3 < len(pcm); i += 4 {
|
||||
mono[i/2], mono[i/2+1] = pcm[i], pcm[i+1]
|
||||
}
|
||||
pcm = mono
|
||||
}
|
||||
a.audioMgr.PushMonitorAudio(pcm)
|
||||
// And to the QSO recorder, which has no device to capture from
|
||||
// on this backend. It drops the samples unless a recording is
|
||||
@@ -19679,7 +19768,8 @@ type SpotStatus struct {
|
||||
type clusterStatusCache struct {
|
||||
entities map[int]*qso.EntitySlot
|
||||
workedCalls map[string]struct{}
|
||||
workedCallSlots map[string]struct{} // nil unless the "same slot" option is on
|
||||
workedCallSlots map[string]struct{}
|
||||
workedCallSlotsDig map[string]struct{} // same set, digital modes folded to DIG // nil unless the "same slot" option is on
|
||||
workedCounties map[string]struct{}
|
||||
// callCounties holds callsign → "STATE,County" for stations already logged
|
||||
// with a county, so a spot shows the county the entry panel showed rather
|
||||
@@ -19763,8 +19853,18 @@ func (a *App) clusterStatusMaps() *clusterStatusCache {
|
||||
// "Already worked only on the same slot" option (Settings → DX Cluster): the
|
||||
// WORKED-call flag then needs the SAME band and mode (digital-grouped through
|
||||
// the same normMode when that option is on) rather than the call anywhere.
|
||||
if sameSlot || slotHighlight {
|
||||
// Built UNCONDITIONALLY since the watchlist arrived: its per-slot verdict
|
||||
// needs this set whatever the cluster's own display options say, and the
|
||||
// scan already runs at cache-rebuild cadence, not per batch.
|
||||
c.workedCallSlots, _ = a.qso.WorkedCallSlotKeys(a.ctx, c.normMode)
|
||||
// And once more at digital-CLASS grain, for the spots whose mode the band
|
||||
// plan can only call "DATA": a generic mode cannot be matched exactly, so it
|
||||
// is judged against "any digital mode of this call on this band". When the
|
||||
// grouping option is on, workedCallSlots is already at that grain.
|
||||
if c.normMode != nil {
|
||||
c.workedCallSlotsDig = c.workedCallSlots
|
||||
} else {
|
||||
c.workedCallSlotsDig, _ = a.qso.WorkedCallSlotKeys(a.ctx, qso.GroupDigitalMode)
|
||||
}
|
||||
// Orthogonal dimensions: worked US counties (for the ULS callsign→county
|
||||
// lookup) and worked POTA parks.
|
||||
|
||||
@@ -24,6 +24,17 @@ func (a *App) GetKenwoodState() cat.KenwoodTXState {
|
||||
return st
|
||||
}
|
||||
|
||||
// SetKenwoodPanelMode sets the operating mode from the panel's mode row —
|
||||
// CW / USB / LSB / DATA (soundcard, DT0) / RTTY (FSK D, DT2).
|
||||
func (a *App) SetKenwoodPanelMode(mode string) error {
|
||||
return a.kenwoodPanelDo(func(k cat.KenwoodPanelController) error { return k.SetKenwoodPanelMode(mode) })
|
||||
}
|
||||
|
||||
// SetKenwoodRITOffset sets the RIT/XIT offset to an absolute value in Hz.
|
||||
func (a *App) SetKenwoodRITOffset(hz int) error {
|
||||
return a.kenwoodPanelDo(func(k cat.KenwoodPanelController) error { return k.SetKenwoodRITOffset(hz) })
|
||||
}
|
||||
|
||||
func (a *App) SetKenwoodPower(w int) error {
|
||||
return a.kenwoodPanelDo(func(k cat.KenwoodPanelController) error { return k.SetKenwoodPower(w) })
|
||||
}
|
||||
|
||||
@@ -235,3 +235,12 @@ func (a *App) activeRadioMyRig() string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ActiveRadioMyRig exposes the connected radio's MY_RIG to the frontend, which
|
||||
// pre-fills the entry form's My-station fields on every band change. Without
|
||||
// this the per-band default landed in the field FIRST, and the log-time
|
||||
// priority (the radio that is keying beats the radio that was planned) never
|
||||
// ran — the field was no longer empty by the time the backend looked.
|
||||
func (a *App) ActiveRadioMyRig() string {
|
||||
return a.activeRadioMyRig()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
package main
|
||||
|
||||
// Watchlist bindings — the DXHunter watchlist concept as an OpsLog tab.
|
||||
// The store lives in internal/watchlist (global watchlist.json, DXHunter's own
|
||||
// schema); this file is the Wails boundary plus the two places the list meets
|
||||
// the rest of the app: the spot stream (MarkSeen + alert) and the logbook (the
|
||||
// worked-today answer contest entries are judged by).
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"hamlog/internal/applog"
|
||||
"hamlog/internal/qso"
|
||||
"hamlog/internal/watchlist"
|
||||
|
||||
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
// The auto-contest pattern, DXHunter's contest_prefix: while non-empty, any
|
||||
// spotted callsign CONTAINING it is added to the watchlist as a contest entry
|
||||
// by itself — a special-event fleet (HB9WWA, DL0WWA, F4WWA…) is collected as
|
||||
// it appears instead of typed in one by one. Held in an atomic so the spot
|
||||
// pipeline never touches the settings store per spot.
|
||||
func (a *App) GetWatchlistContestPattern() string {
|
||||
if v := a.watchPattern.Load(); v != nil {
|
||||
return v.(string)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetWatchlistContestPattern stores the pattern (global, like the list itself).
|
||||
// Emptying it stops the auto-add; entries already collected stay — deleting an
|
||||
// operator's list because a setting changed is DXHunter behaviour this port
|
||||
// deliberately drops.
|
||||
func (a *App) SetWatchlistContestPattern(p string) {
|
||||
p = strings.ToUpper(strings.TrimSpace(p))
|
||||
a.watchPattern.Store(p)
|
||||
a.setSettingGlobal(keyWatchlistContestPattern, p)
|
||||
}
|
||||
|
||||
// WatchlistEntries returns the list for the tab.
|
||||
func (a *App) WatchlistEntries() []watchlist.Entry {
|
||||
if a.watchlist == nil {
|
||||
return nil
|
||||
}
|
||||
return a.watchlist.Entries()
|
||||
}
|
||||
|
||||
// WatchlistAdd adds a callsign or prefix; contest entries are judged per UTC day.
|
||||
func (a *App) WatchlistAdd(callsign string, contest bool) error {
|
||||
if a.watchlist == nil {
|
||||
return fmt.Errorf("watchlist not initialized")
|
||||
}
|
||||
return a.watchlist.Add(callsign, contest)
|
||||
}
|
||||
|
||||
// WatchlistRemove deletes an entry.
|
||||
func (a *App) WatchlistRemove(callsign string) error {
|
||||
if a.watchlist == nil {
|
||||
return fmt.Errorf("watchlist not initialized")
|
||||
}
|
||||
return a.watchlist.Remove(callsign)
|
||||
}
|
||||
|
||||
// WatchlistSetNotify arms the existing alert path (sound + toast) for an entry.
|
||||
func (a *App) WatchlistSetNotify(callsign string, on bool) error {
|
||||
if a.watchlist == nil {
|
||||
return fmt.Errorf("watchlist not initialized")
|
||||
}
|
||||
return a.watchlist.SetNotify(callsign, on)
|
||||
}
|
||||
|
||||
// WatchlistSetContest flips the per-entry contest rule.
|
||||
func (a *App) WatchlistSetContest(callsign string, on bool) error {
|
||||
if a.watchlist == nil {
|
||||
return fmt.Errorf("watchlist not initialized")
|
||||
}
|
||||
return a.watchlist.SetContest(callsign, on)
|
||||
}
|
||||
|
||||
// WatchlistSlotQuery asks whether one spot's slot is worked — against the whole
|
||||
// log for a normal entry, against TODAY (UTC) for a contest one.
|
||||
type WatchlistSlotQuery struct {
|
||||
Call string `json:"call"`
|
||||
Band string `json:"band"`
|
||||
Mode string `json:"mode"`
|
||||
Contest bool `json:"contest"`
|
||||
}
|
||||
|
||||
// WatchlistWorkedSlots answers a batch of slot questions for the tab.
|
||||
//
|
||||
// Normal entries read the CLUSTER's own slot set — the same cached
|
||||
// WorkedCallSlotKeys index that colours the grid — so the watchlist can never
|
||||
// contradict the cluster about the same spot. That index normalises the mode
|
||||
// exactly as the operator configured (digital grouping on → FT4 counts as FT8's
|
||||
// class; off → exact mode), and the first version of this ignored that: it
|
||||
// asked the alerts' raw-mode index with a CLASS name, matched nothing, and
|
||||
// showed a fully-worked DXpedition as all Needed.
|
||||
//
|
||||
// Contest entries read TODAY's contacts instead — the midnight-UTC reset is
|
||||
// the query's date bound, nothing stored, nothing to reset — normalised through
|
||||
// the same function so the two answers use one grammar.
|
||||
func (a *App) WatchlistWorkedSlots(queries []WatchlistSlotQuery) []bool {
|
||||
out := make([]bool, len(queries))
|
||||
if a.qso == nil || len(queries) == 0 {
|
||||
return out
|
||||
}
|
||||
idx := a.clusterStatusMaps()
|
||||
norm := func(m string) string {
|
||||
m = strings.ToUpper(strings.TrimSpace(m))
|
||||
if idx.normMode != nil {
|
||||
m = idx.normMode(m)
|
||||
}
|
||||
return m
|
||||
}
|
||||
slotKey := func(call, band, mode string) string {
|
||||
up := strings.ToUpper(strings.TrimSpace(call))
|
||||
b := strings.ToLower(strings.TrimSpace(band))
|
||||
if m := norm(mode); m != "" {
|
||||
return up + "|" + b + "|" + m
|
||||
}
|
||||
return up + "|" + b
|
||||
}
|
||||
// A spot whose mode the band plan could only call "DATA" (an F/H DXpedition
|
||||
// off the standard dials, a comment with no mode) cannot be matched exactly:
|
||||
// "DATA" is in nobody's log. Such a spot is judged at digital-CLASS grain —
|
||||
// worked if ANY digital mode of that call is logged on that band. Claiming
|
||||
// NEW MODE because the label differs from FT8 was the reported bug.
|
||||
generic := func(m string) bool {
|
||||
switch strings.ToUpper(strings.TrimSpace(m)) {
|
||||
case "", "DATA", "DIG", "DIGI", "DIGITAL":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
digKey := func(call, band string) string {
|
||||
return strings.ToUpper(strings.TrimSpace(call)) + "|" + strings.ToLower(strings.TrimSpace(band)) + "|DIG"
|
||||
}
|
||||
needToday := false
|
||||
for _, q := range queries {
|
||||
if q.Contest {
|
||||
needToday = true
|
||||
break
|
||||
}
|
||||
}
|
||||
today := map[string]bool{}
|
||||
if needToday {
|
||||
midnight := time.Now().UTC().Truncate(24 * time.Hour)
|
||||
rows, err := a.qso.SlotsSince(a.ctx, midnight)
|
||||
if err == nil {
|
||||
for _, r := range rows {
|
||||
today[slotKey(r.Callsign, r.Band, r.Mode)] = true
|
||||
today[digKey(r.Callsign, r.Band)] = qso.ModeClass(r.Mode) == "DIG" || today[digKey(r.Callsign, r.Band)]
|
||||
}
|
||||
}
|
||||
}
|
||||
for i, q := range queries {
|
||||
if q.Contest {
|
||||
if generic(q.Mode) {
|
||||
out[i] = today[digKey(q.Call, q.Band)]
|
||||
} else {
|
||||
out[i] = today[slotKey(q.Call, q.Band, q.Mode)]
|
||||
}
|
||||
} else if generic(q.Mode) {
|
||||
if idx.workedCallSlotsDig != nil {
|
||||
_, out[i] = idx.workedCallSlotsDig[digKey(q.Call, q.Band)]
|
||||
}
|
||||
} else if idx.workedCallSlots != nil {
|
||||
_, out[i] = idx.workedCallSlots[slotKey(q.Call, q.Band, q.Mode)]
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// watchSpot runs one live spot through the watchlist: last-seen bookkeeping and
|
||||
// the alert, through the SAME event the alert rules fire — the frontend already
|
||||
// knows how to toast and sound it, and a second notification path would be a
|
||||
// second thing to misconfigure.
|
||||
func (a *App) watchSpot(dxCall, band, mode, country, comment string, freqHz int64) {
|
||||
if a.watchlist == nil {
|
||||
return
|
||||
}
|
||||
entry, notify, ok := a.watchlist.MarkSeen(dxCall)
|
||||
if !ok {
|
||||
// Not watched yet — the auto-contest pattern may claim it. Contains, not
|
||||
// prefix: the event string sits anywhere in these calls (HB9WWA, F4WWA/P).
|
||||
if p := a.GetWatchlistContestPattern(); p != "" &&
|
||||
strings.Contains(strings.ToUpper(dxCall), p) {
|
||||
if err := a.watchlist.Add(dxCall, true); err == nil {
|
||||
applog.Printf("watchlist: auto-added %s (contest pattern %q)", dxCall, p)
|
||||
entry, notify, ok = a.watchlist.MarkSeen(dxCall)
|
||||
if a.ctx != nil {
|
||||
wruntime.EventsEmit(a.ctx, "watchlist:changed")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !ok || !notify || a.ctx == nil {
|
||||
return
|
||||
}
|
||||
// Already worked? Then nothing to announce. Judged HERE, before the sound —
|
||||
// the report was an alert ringing for a slot the tab showed as Worked a
|
||||
// moment later, because the frontend's verdict arrives on a debounce while
|
||||
// the alert used to fire on the raw spot. Same verdict as the tab: exact
|
||||
// slot for named modes, digital class for a generic DATA spot, today-only
|
||||
// for a contest entry.
|
||||
if e, found := a.watchlist.Get(entry); found {
|
||||
if a.WatchlistWorkedSlots([]WatchlistSlotQuery{{Call: dxCall, Band: band, Mode: mode, Contest: e.IsContest}})[0] {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Throttled per entry: a DXpedition lights up every skimmer on the planet,
|
||||
// and forty alerts a minute for one station is a alarm nobody keeps on.
|
||||
a.watchAlertMu.Lock()
|
||||
last := a.watchAlertAt[entry]
|
||||
now := time.Now()
|
||||
if now.Sub(last) < 2*time.Minute {
|
||||
a.watchAlertMu.Unlock()
|
||||
return
|
||||
}
|
||||
a.watchAlertAt[entry] = now
|
||||
a.watchAlertMu.Unlock()
|
||||
wruntime.EventsEmit(a.ctx, "alert:fired", map[string]any{
|
||||
"rule": "Watchlist " + entry,
|
||||
"call": strings.ToUpper(strings.TrimSpace(dxCall)),
|
||||
"band": band,
|
||||
"mode": mode,
|
||||
"freq_hz": freqHz,
|
||||
"country": country,
|
||||
"comment": comment,
|
||||
"sound": true,
|
||||
"visual": true,
|
||||
})
|
||||
}
|
||||
|
||||
// startWatchlistClubLog begins the expedition enrichment: every entry's
|
||||
// ClubLog block (expedition flag, OQRS, LiveStream, QSO totals and 24 h rate)
|
||||
// is refreshed on a rolling schedule — hourly for expeditions, six-hourly for
|
||||
// the rest, DXHunter's own cadence. OpsLog's application API key is used, so
|
||||
// there is nothing to configure.
|
||||
//
|
||||
// Two at a time with a breath between requests: the key is shared by every
|
||||
// OpsLog install, and a hundred-entry watchlist must read as a trickle at
|
||||
// ClubLog's end, not a burst.
|
||||
func (a *App) startWatchlistClubLog() {
|
||||
if a.watchlist == nil {
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
client := &http.Client{Timeout: 30 * time.Second}
|
||||
// Let the app finish starting before the first network pass.
|
||||
time.Sleep(15 * time.Second)
|
||||
for {
|
||||
stale := a.watchlist.StaleEntries(1*time.Hour, 6*time.Hour)
|
||||
changed := false
|
||||
for _, call := range stale {
|
||||
// The pattern's BASE is what ClubLog knows: VK9* has no log.
|
||||
base := strings.TrimSuffix(call, "*")
|
||||
if base == "" {
|
||||
continue
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
d, err := watchlist.FetchWatch(ctx, client, clublogAppAPIKey, base)
|
||||
cancel()
|
||||
if err != nil {
|
||||
applog.Printf("watchlist clublog: %s: %v", base, err)
|
||||
continue
|
||||
}
|
||||
if a.watchlist.ApplyClubLog(call, d) {
|
||||
changed = true
|
||||
if d.IsExpedition {
|
||||
applog.Printf("watchlist clublog: %s is a DXpedition (%d QSOs, %d/24h, OQRS=%v)",
|
||||
base, func() int {
|
||||
if d.ClubLogInfo != nil {
|
||||
return d.ClubLogInfo.TotalQSOs
|
||||
}
|
||||
return 0
|
||||
}(), d.QSOs24h(), d.HasOQRS)
|
||||
}
|
||||
}
|
||||
time.Sleep(400 * time.Millisecond)
|
||||
}
|
||||
if changed && a.ctx != nil {
|
||||
wruntime.EventsEmit(a.ctx, "watchlist:changed")
|
||||
}
|
||||
time.Sleep(10 * time.Minute)
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -1,4 +1,88 @@
|
||||
[
|
||||
{
|
||||
"version": "0.27.1",
|
||||
"date": "",
|
||||
"en": [
|
||||
"Elecraft console: the S-meter is calibrated against a real K3 — S9 and the +dB readings now match the radio’s own display (they read about two S-units low).",
|
||||
"Elecraft console: an SWR spike (the K3’s own blip at the end of an FT8 frame) no longer fades over twelve seconds — the peak shows briefly, then the meter returns straight to the live reading.",
|
||||
"Icom: the IC-7760 joins the model list (CI-V address B2h).",
|
||||
"Icom console: the IC-7760 gets its real attenuator steps — 6/12/18 dB.",
|
||||
"Icom network audio: the RX stream is decoded correctly — mono is requested and the payload offset was confirmed on a real IC-7760, curing the garbled, clicking audio.",
|
||||
"Icom: switching back from a data mode (USB-D1) to plain USB now sticks — if the rig ignores the data-flag command, it is repeated with the modern one-frame form (0x26). Seen on the IC-7760.",
|
||||
"Icom console: a DATA mode button (USB-D, what FT8 wants), the PSK button drives the rigs that have a native PSK mode, and the power meter reads in real watts on the IC-7760’s 250 W scale.",
|
||||
"Icom network audio: the right codec is requested (16-bit mono LPCM), settled by experiment on a real IC-7760.",
|
||||
"CAT settings: reopening the panel now shows the radio that is actually selected — it always showed the first one, with the fields (MY_RIG included) silently editing the wrong entry.",
|
||||
"IC-7760: the power meter is calibrated against the radio (100 W reads 100 W on the 250 W face) and the RF power setting reads in watts, not a percentage.",
|
||||
"Icom network audio: toggling Listening off and on no longer chops the sound — the monitor restarts as network-fed instead of also opening a USB capture.",
|
||||
"QSO recorder: starting a fresh manual take resets the counter for good — it used to flash 0 and jump back to the previous take’s elapsed time.",
|
||||
"MY_RIG follows the radio actually connected: the entry form now asks the active radio first, before the per-band default — an IC-7760 on the air no longer logs as the Flex the band plan names.",
|
||||
"QSO recorder: a manual take on a network Icom records the network RX stream, not the “From radio” sound card (which captured another radio’s DAX on a mixed station).",
|
||||
"Icom network audio: duplicate and late-retransmitted packets no longer reach the recorder — recordings came out longer than the QSO, slowed and stuttering, while the speakers played fine.",
|
||||
"Icom network audio: it now starts with the app — launching OpsLog connected with audio silently off, and the option had to be unticked and re-saved to hear anything.",
|
||||
"Icom network: when the rig goes quiet on CI-V while the session stays up (seen on the IC-7760), the CI-V flow is re-opened on the spot — recovery in seconds instead of the 35-second full reconnect.",
|
||||
"Icom network: after a session dies young, the redial waits 20 s so the rig can purge the old session first — stops the reconnect-die-reconnect spiral seen on the IC-7760, where each fresh session answered for a second and was then strangled by the previous one’s cleanup."
|
||||
],
|
||||
"fr": [
|
||||
"Console Elecraft : le S-mètre est calibré sur un vrai K3 — S9 et les +dB correspondent désormais à l’affichage de la radio (il lisait environ deux points S trop bas).",
|
||||
"Console Elecraft : un pic de ROS (le sursaut du K3 en fin de trame FT8) ne s’estompe plus pendant douze secondes — le pic s’affiche brièvement, puis le ros-mètre revient directement à la valeur réelle.",
|
||||
"Icom : l’IC-7760 rejoint la liste des modèles (adresse CI-V B2h).",
|
||||
"Console Icom : l’IC-7760 reçoit ses vrais crans d’atténuateur — 6/12/18 dB.",
|
||||
"Audio réseau Icom : le flux RX est décodé correctement — le mono est demandé et l’offset du payload a été confirmé sur un vrai IC-7760, ce qui guérit le son inaudible et les clics.",
|
||||
"Icom : revenir d’un mode data (USB-D1) au USB simple tient désormais — si la radio ignore la commande du drapeau data, elle est répétée sous la forme moderne en une trame (0x26). Constaté sur l’IC-7760.",
|
||||
"Console Icom : un bouton de mode DATA (USB-D, celui de FT8), le bouton PSK pilote les radios qui ont un vrai mode PSK, et le wattmètre lit en watts réels sur l’échelle 250 W de l’IC-7760.",
|
||||
"Audio réseau Icom : le bon codec est demandé (LPCM mono 16 bits), déterminé par l’expérience sur un vrai IC-7760.",
|
||||
"Réglages CAT : rouvrir le panneau montre désormais la radio réellement sélectionnée — il montrait toujours la première, et les champs (MY_RIG compris) modifiaient silencieusement la mauvaise entrée.",
|
||||
"IC-7760 : le wattmètre est calibré sur la radio (100 W affiche 100 W sur l’échelle 250 W) et le réglage RF power se lit en watts, plus en pourcentage.",
|
||||
"Audio réseau Icom : couper puis relancer Listening ne hache plus le son — le moniteur redémarre alimenté par le réseau au lieu d’ouvrir en plus une capture USB.",
|
||||
"Enregistreur de QSO : démarrer une nouvelle prise manuelle remet le compteur à zéro pour de bon — il affichait 0 puis resautait au temps de la prise précédente.",
|
||||
"MY_RIG suit la radio réellement connectée : le formulaire interroge d’abord la radio active, avant le défaut par bande — un IC-7760 à l’antenne ne se logue plus comme le Flex prévu par le plan de bande.",
|
||||
"Enregistreur de QSO : une prise manuelle sur un Icom réseau enregistre le flux RX réseau, pas la carte son « From Radio » (qui capturait le DAX d’une autre radio sur une station mixte).",
|
||||
"Audio réseau Icom : les paquets dupliqués ou retransmis en retard n’atteignent plus l’enregistreur — les enregistrements sortaient plus longs que le QSO, ralentis et hachés, alors que les haut-parleurs jouaient bien.",
|
||||
"Audio réseau Icom : il démarre maintenant avec l’application — au lancement, la connexion se faisait audio coupé, et il fallait décocher/recocher l’option pour entendre quelque chose.",
|
||||
"Réseau Icom : quand la radio se tait sur le CI-V alors que la session tient (constaté sur l’IC-7760), le flux CI-V est rouvert immédiatement — récupération en quelques secondes au lieu des 35 secondes de reconnexion complète.",
|
||||
"Réseau Icom : après une session morte jeune, la renumérotation attend 20 s pour que la radio purge d’abord l’ancienne session — stoppe la spirale reconnexion-mort-reconnexion vue sur l’IC-7760, où chaque session neuve répondait une seconde avant d’être étranglée par le nettoyage de la précédente."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.27.0",
|
||||
"date": "",
|
||||
"en": [
|
||||
"⭐ NEW — Watchlist (Tools): the DXHunter watchlist as an OpsLog tab — callsigns you are hunting (exact, or a family with a trailing * — VK9* catches every VK9), the live cluster spots under each with the NEW badges and a Needed/Worked verdict per slot, an ON AIR badge, per-entry alerts through the normal alert path, and CONTEST entries judged per UTC day (at midnight everything is workable again).Each entry is enriched from ClubLog automatically: DXpedition badge, OQRS, LiveStream link, QSO total and 24-hour rate — nothing to configure. Reads and writes DXHunter’s own watchlist.json format — drop your existing file into the data folder to carry it over.",
|
||||
"TCI (SunSDR): the meter subscription is renewed when the radio announces it is ready — sent only at connect, it could fall inside the initial state dump and be ignored, which left the transmit power and SWR empty. The log now also records the subscription and the first sensor frames, so a report can tell “the radio never sends them” from “they arrived and were dropped”.",
|
||||
"Sending a spot while in split now pre-fills the RX frequency — where the station actually is — instead of the TX frequency, which spotted the pile-up five up from the DX.",
|
||||
"Cluster: NEW SLOT gets its own colour — the sky cyan the panadapter palette already uses for it, clearly apart from POTA green and the yellows. The NEW SLOT and NEW COUNTY filter chips now wear the same colours as the badges they select, and the NEW CALL filter works even when the slot-highlight display option is off.",
|
||||
"Elecraft console: a mode row — CW, USB, LSB, DATA and DATA RTTY. The two DATA buttons set the K3’s submode as well (DATA A for FT8/FT4, FSK D for RTTY): switching to DATA by mode alone kept whatever submode the last session left, which is how a K3 “in DATA” keys FT8 with no audio.",
|
||||
"DX Cluster settings: “I chase POTA” and “I chase SOTA”, on by default. Unticked, the NEW POTA badge, colour and filter disappear — a new-band + new-POTA spot reads NEW BAND alone — and the reference columns stay empty.",
|
||||
"Elecraft console: RIT and XIT use the same control as the Icom and TCI consoles — ± buttons, mouse wheel, typed value, Ctrl+←/→ — and the power slider moves in 1 W steps instead of 5.",
|
||||
"Bulk edit: My DXCC, My CQ zone and My ITU zone join the My-station fields — numbers checked against their real ranges, empty clears.",
|
||||
"Clicking a spot in the Chase new panel now applies the FlexRadio panadapter width/zoom, like every other spot click.",
|
||||
"FlexRadio: the panadapter width/zoom now applies reliably when double-clicking a cluster spot — the zoom is sent after the tune settles, so SmartSDR’s own pan-follow on a band change no longer overrides it."
|
||||
],
|
||||
"fr": [
|
||||
"⭐ NOUVEAU — Watchlist (Outils) : la watchlist de DXHunter en onglet OpsLog — indicatifs chassés (exacts, ou une famille avec une * finale — VK9* attrape tous les VK9), les spots cluster en direct sous chaque entrée avec les badges NOUVEAU et un verdict Manquant/Contacté par créneau, un badge ON AIR, des alertes par entrée via le circuit d'alerte normal, et des entrées CONTEST jugées par jour UTC (à minuit tout redevient à faire).Chaque entrée est enrichie automatiquement depuis ClubLog : badge DXpedition, OQRS, lien LiveStream, total de QSO et rythme sur 24 h — rien à configurer. Lit et écrit le format watchlist.json de DXHunter — déposez votre fichier existant dans le dossier data pour le récupérer.",
|
||||
"TCI (SunSDR) : l'abonnement aux mesures est renouvelé quand la radio annonce qu'elle est prête — envoyé seulement à la connexion, il pouvait tomber pendant l'envoi initial de l'état et être ignoré, laissant la puissance et le ROS vides en émission. Le journal enregistre aussi l'abonnement et les premières trames de mesure, pour distinguer « la radio ne les envoie jamais » de « elles arrivaient et étaient perdues ».",
|
||||
"Envoyer un spot en split préremplit désormais la fréquence RX — là où la station se trouve réellement — au lieu de la fréquence TX, qui spottait le pile-up cinq au-dessus du DX.",
|
||||
"Cluster : NOUVEAU SLOT reçoit sa propre couleur — le cyan ciel que la palette du panadapter lui donne déjà, bien distinct du vert POTA et des jaunes. Les puces de filtre NOUVEAU SLOT et NOUVEAU COMTÉ portent désormais les couleurs des badges qu'elles sélectionnent, et le filtre NOUVEAU CALL fonctionne même quand l'option de surlignage par slot est désactivée.",
|
||||
"Console Elecraft : une rangée de modes — CW, USB, LSB, DATA et DATA RTTY. Les deux boutons DATA règlent aussi le sous-mode du K3 (DATA A pour FT8/FT4, FSK D pour le RTTY) : passer en DATA par le seul mode gardait le sous-mode de la session précédente, et un K3 « en DATA » manipulait le FT8 sans audio.",
|
||||
"Réglages DX Cluster : « Je chasse le POTA » et « Je chasse le SOTA », cochés par défaut. Décochés, le badge, la couleur et le filtre NOUVEAU POTA disparaissent — un spot nouvelle bande + nouveau POTA affiche seulement NOUVELLE BANDE — et les colonnes de références restent vides.",
|
||||
"Console Elecraft : le RIT et le XIT utilisent la même commande que les consoles Icom et TCI — boutons ±, molette, valeur tapée, Ctrl+←/→ — et le curseur de puissance avance par pas de 1 W au lieu de 5.",
|
||||
"Édition groupée : My DXCC, My CQ zone et My ITU zone rejoignent les champs Ma station — valeurs vérifiées contre leurs bornes réelles, vide efface.",
|
||||
"Cliquer un spot dans le panneau Chase new applique désormais la largeur/zoom du panadapter FlexRadio, comme tout autre clic de spot.",
|
||||
"FlexRadio : la largeur/zoom du panadapter s’applique désormais de façon fiable au double-clic sur un spot du cluster — le zoom est envoyé après le tune, pour que le suivi du panadapter de SmartSDR lors d’un changement de bande ne l’écrase plus."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.26.23",
|
||||
"date": "",
|
||||
"en": [
|
||||
"LoTW: the downloaded confirmations list gains a Station column, so a list spanning several callsigns says which one each confirmation belongs to. Shown only when the report actually carries more than the one station.",
|
||||
"The band maps follow your IARU region (Settings → General): Region 2’s 40 m runs to 7300 kHz with phone from 7125 and its 80 m to 4000, Region 3’s 80 m to 3900 — the band edges and the CW/digital/phone shading all adjust."
|
||||
],
|
||||
"fr": [
|
||||
"LoTW : la liste des confirmations téléchargées gagne une colonne Station, pour savoir à quel indicatif appartient chaque confirmation quand le téléchargement en couvre plusieurs. Affichée seulement si le rapport en contient effectivement.",
|
||||
"Les cartes de bande suivent votre région IARU (Réglages → Général) : le 40 m de la Région 2 va jusqu'à 7300 kHz avec la phonie dès 7125 et son 80 m jusqu'à 4000, le 80 m de la Région 3 jusqu'à 3900 — les limites de bande et les zones CW/numérique/phonie s'ajustent."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.26.22",
|
||||
"date": "",
|
||||
|
||||
+99
-27
@@ -33,7 +33,7 @@ import {
|
||||
GetSolarData,
|
||||
GetQSORate,
|
||||
LoTWUserInfo,
|
||||
OperatingDefaultForBand,
|
||||
OperatingDefaultForBand, ActiveRadioMyRig,
|
||||
LogUDPLoggedADIF,
|
||||
ListCountries,
|
||||
GetWinkeyerSettings, SaveWinkeyerSettings, ListSerialPorts, GetWinkeyerStatus,
|
||||
@@ -69,6 +69,7 @@ import {
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { APP_VERSION, APP_AUTHOR } from '@/version';
|
||||
import { QSLManagerPanel } from '@/components/QSLManagerModal';
|
||||
import { WatchlistTab } from '@/components/WatchlistTab';
|
||||
import { QslDesignerModal } from '@/components/qsl/QslDesignerModal';
|
||||
import { SendEQSLModal } from '@/components/qsl/SendEQSLModal';
|
||||
import { AutoEQSL } from '@/components/qsl/AutoEQSL';
|
||||
@@ -98,7 +99,7 @@ import { ExportFieldsDialog } from '@/components/ExportFieldsDialog';
|
||||
import { ShutdownProgress } from '@/components/ShutdownProgress';
|
||||
import { ClusterGrid } from '@/components/ClusterGrid';
|
||||
import { cleanSpotter, inferSpotMode, spotModeCategory, spotStatusKey } from '@/lib/spot';
|
||||
import { applySpotDisplay, readSpotDisplayOptions, spotIsWorked, SPOT_DISPLAY_OPTIONS_EXPOSED } from '@/lib/spotDisplay';
|
||||
import { applySpotDisplay, chasePota, readSpotDisplayOptions, spotIsWorked, SPOT_DISPLAY_OPTIONS_EXPOSED } from '@/lib/spotDisplay';
|
||||
import { AnswerDecode, HaltDecodeTx, LogUIError, FlexTXOnBand, GetMatrixColors, GetRotorPresets, GetRowColors, GetSpotTTLMinutes, GetSpotMax, IsNewUSCounty } from '../wailsjs/go/main/App';
|
||||
import { applyMatrixColors } from '@/lib/matrixColors';
|
||||
import { WorkedBeforeGrid } from '@/components/WorkedBeforeGrid';
|
||||
@@ -933,11 +934,16 @@ export default function App() {
|
||||
useEffect(() => {
|
||||
if (!band) return;
|
||||
let cancelled = false;
|
||||
OperatingDefaultForBand(band).then((d) => {
|
||||
OperatingDefaultForBand(band).then(async (d) => {
|
||||
if (cancelled) return;
|
||||
// The radio actually CONNECTED names itself ahead of the per-band plan:
|
||||
// an IC-7760 on the air must not log as the Flex the band default names.
|
||||
let liveRig = '';
|
||||
try { liveRig = (await ActiveRadioMyRig()) || ''; } catch {}
|
||||
if (cancelled) return;
|
||||
setDetails((cur) => ({
|
||||
...cur,
|
||||
my_rig: d?.station_name || '',
|
||||
my_rig: liveRig || d?.station_name || '',
|
||||
my_antenna: d?.antenna_name || '',
|
||||
tx_pwr: d?.tx_pwr ?? cur.tx_pwr,
|
||||
}));
|
||||
@@ -1050,6 +1056,13 @@ export default function App() {
|
||||
if (!active) setError(t('rec.manualFailed'));
|
||||
}).catch((e: any) => setError(String(e?.message ?? e)));
|
||||
};
|
||||
// recTick means "a fresh take" — that is the only case where the clock returns
|
||||
// to zero, as opposed to resuming after a stop. Declared BEFORE the ticking
|
||||
// effect below and deliberately so: effects run in declaration order, and the
|
||||
// other way round the ticker captured the PREVIOUS take's elapsed as its
|
||||
// starting point — the counter showed 0 for one second, then jumped straight
|
||||
// back to the old thirty minutes.
|
||||
useEffect(() => { setRecSeconds(0); recSecondsRef.current = 0; setRecStopped(false); }, [recTick]);
|
||||
useEffect(() => {
|
||||
if (!recording) { setRecSeconds(0); return; }
|
||||
// A stopped take freezes the clock where it is: it must show the length of
|
||||
@@ -1060,9 +1073,6 @@ export default function App() {
|
||||
const id = window.setInterval(() => setRecSeconds(from + Math.floor((Date.now() - start) / 1000)), 1000);
|
||||
return () => window.clearInterval(id);
|
||||
}, [recording, recTick, recStopped]);
|
||||
// recTick means "a fresh take" — that is the only case where the clock returns
|
||||
// to zero, as opposed to resuming after a stop.
|
||||
useEffect(() => { setRecSeconds(0); recSecondsRef.current = 0; setRecStopped(false); }, [recTick]);
|
||||
// The callsign the in-progress recording belongs to (uppercased; '' = none).
|
||||
// Lets us restart from zero when the operator edits the call to a different
|
||||
// station mid-recording, instead of continuing the old take.
|
||||
@@ -1522,7 +1532,7 @@ export default function App() {
|
||||
// Seed the current break-in from the rig when the CW panel becomes active in
|
||||
// Icom mode (so the control reflects the radio's real state).
|
||||
useEffect(() => {
|
||||
if (cwSource !== 'icom' || !wkEnabled || !(catState.backend === 'icom' && catState.connected)) return;
|
||||
if (cwSource !== 'icom' || !wkEnabled || !((catState.backend === 'icom' || catState.backend === 'icom-net') && catState.connected)) return;
|
||||
GetIcomState().then((s: any) => { if (s && typeof s.break_in === 'number') setIcomBreakIn(s.break_in); }).catch(() => {});
|
||||
}, [cwSource, wkEnabled, catState.backend, catState.connected]);
|
||||
// Auto-call: repeat the clicked macro (e.g. F1 CQ) every (message + N seconds)
|
||||
@@ -1546,7 +1556,7 @@ export default function App() {
|
||||
// skips the log that hasn't happened yet.
|
||||
const wkSendGenRef = useRef(0);
|
||||
useEffect(() => {
|
||||
const connected = cwSource === 'icom' ? (catState.backend === 'icom' && catState.connected)
|
||||
const connected = cwSource === 'icom' ? ((catState.backend === 'icom' || catState.backend === 'icom-net') && catState.connected)
|
||||
: cwSource === 'flex' ? (catState.backend === 'flex' && catState.connected)
|
||||
: cwSource === 'yaesu' ? (catState.backend === 'yaesu' && catState.connected)
|
||||
: cwSource === 'kenwood' ? (catState.backend === 'kenwood' && catState.connected)
|
||||
@@ -1684,6 +1694,9 @@ export default function App() {
|
||||
// NET Control tab — enabled from Tools (persisted; once on it's a tab like Cluster).
|
||||
const [netEnabled, setNetEnabled] = useState(() => localStorage.getItem('opslog.netEnabled') === '1');
|
||||
useEffect(() => { localStorage.setItem('opslog.netEnabled', netEnabled ? '1' : '0'); }, [netEnabled]);
|
||||
// Watchlist tab — opt-in from Tools, persisted, closable like NET Control.
|
||||
const [watchlistEnabled, setWatchlistEnabled] = useState(() => localStorage.getItem('opslog.watchlistEnabled') === '1');
|
||||
useEffect(() => { localStorage.setItem('opslog.watchlistEnabled', watchlistEnabled ? '1' : '0'); }, [watchlistEnabled]);
|
||||
// Contest tab is hidden until enabled from Tools → Contest mode.
|
||||
const [contestTabEnabled, setContestTabEnabled] = useState(() => localStorage.getItem('opslog.contestTab') === '1');
|
||||
useEffect(() => { localStorage.setItem('opslog.contestTab', contestTabEnabled ? '1' : '0'); }, [contestTabEnabled]);
|
||||
@@ -2014,7 +2027,7 @@ export default function App() {
|
||||
// so it's loaded async on mount and re-read on profile:changed below.
|
||||
// 'none' is only ever stored for the third and fourth panes: the first two are
|
||||
// the Main view, and a layout with no panes at all is not a layout.
|
||||
type MainPaneKind = 'map1' | 'map2' | 'cluster' | 'worked' | 'flex' | 'recent' | 'icom' | 'yaesu' | 'elecraft' | 'tci' | 'netcontrol' | 'decodes' | 'none';
|
||||
type MainPaneKind = 'map1' | 'map2' | 'cluster' | 'worked' | 'flex' | 'recent' | 'icom' | 'yaesu' | 'elecraft' | 'tci' | 'netcontrol' | 'decodes' | 'watchlist' | 'none';
|
||||
const [mapZoomSignal, setMapZoomSignal] = useState(0); // bump → world map auto-zooms now
|
||||
const [mainPaneLeft, setMainPaneLeft] = useState<MainPaneKind>('map1');
|
||||
const [mainPaneRight, setMainPaneRight] = useState<MainPaneKind>('map2');
|
||||
@@ -2025,7 +2038,7 @@ export default function App() {
|
||||
// quarter-width map is unreadable.
|
||||
const [mainLayout4, setMainLayout4] = useState<'cols' | 'quad'>('quad');
|
||||
const loadMainPanes = useCallback(async () => {
|
||||
const valid = (v: string): v is MainPaneKind => v === 'map1' || v === 'map2' || v === 'cluster' || v === 'worked' || v === 'flex' || v === 'recent' || v === 'icom' || v === 'yaesu' || v === 'elecraft' || v === 'tci' || v === 'netcontrol' || v === 'decodes';
|
||||
const valid = (v: string): v is MainPaneKind => v === 'map1' || v === 'map2' || v === 'cluster' || v === 'worked' || v === 'flex' || v === 'recent' || v === 'icom' || v === 'yaesu' || v === 'elecraft' || v === 'tci' || v === 'netcontrol' || v === 'decodes' || v === 'watchlist';
|
||||
const [l, r, p3, p4, lay] = await Promise.all([
|
||||
GetUIPref('mainPaneLeft').catch(() => ''),
|
||||
GetUIPref('mainPaneRight').catch(() => ''),
|
||||
@@ -3300,11 +3313,16 @@ export default function App() {
|
||||
noteManualEdit();
|
||||
}
|
||||
if (s.band) setBand(s.band);
|
||||
if (catState.connected) tuneRigCAT(s.freq_hz, m);
|
||||
// The panadapter width follows the MODE of the spot, when the option is on.
|
||||
// AFTER the tune, deliberately: a view change must never delay the frequency
|
||||
// change the operator is waiting for. A no-op on any backend but a Flex.
|
||||
FlexZoomForSpot(m ?? '', s.freq_hz ?? 0).catch(() => {});
|
||||
// A no-op on any backend but a Flex. Sequenced AFTER the tune settles, not
|
||||
// fired alongside it: on a cross-band jump SmartSDR moves the panadapter
|
||||
// itself to follow the slice, and that follow lands after — and overrides —
|
||||
// a zoom sent in the same instant. (A spot clicked ON the panadapter never
|
||||
// hit this: the radio had already tuned before our zoom arrived.)
|
||||
const zoom = () => FlexZoomForSpot(m ?? '', s.freq_hz ?? 0).catch(() => {});
|
||||
if (catState.connected) {
|
||||
void tuneRigCAT(s.freq_hz, m).then(() => window.setTimeout(zoom, 300));
|
||||
} else zoom();
|
||||
if (m) applyModeFromSpot(m);
|
||||
onCallsignInput(s.dx_call, { force: true });
|
||||
applySpotRefs((s as any).pota_ref, (s as any).sota_ref);
|
||||
@@ -5004,6 +5022,7 @@ export default function App() {
|
||||
{ type: 'item', label: (cwEnabled ? '✓ ' : '') + t('tools.cwDecoder'), action: 'tools.cwdecoder' },
|
||||
{ type: 'separator' },
|
||||
{ type: 'item', label: (netEnabled ? '✓ ' : '') + t('tools.net'), action: 'tools.net' },
|
||||
{ type: 'item', label: (watchlistEnabled ? '✓ ' : '') + t('tools.watchlist'), action: 'tools.watchlist' },
|
||||
{ type: 'item', label: (contestTabEnabled ? '✓ ' : '') + t('tools.contest'), action: 'tools.contest' },
|
||||
{ type: 'item', label: t('tools.alerts'), action: 'tools.alerts' },
|
||||
{ type: 'separator' },
|
||||
@@ -5027,7 +5046,7 @@ export default function App() {
|
||||
{ type: 'separator' },
|
||||
{ type: 'item', label: t('help.about'), action: 'help.about' },
|
||||
]},
|
||||
], [total, selectedId, selectedIds, exporting, wkEnabled, dvkEnabled, cwEnabled, netEnabled, contestTabEnabled, smtpConfigured, sendingLog, t]);
|
||||
], [total, selectedId, selectedIds, exporting, wkEnabled, dvkEnabled, cwEnabled, netEnabled, watchlistEnabled, contestTabEnabled, smtpConfigured, sendingLog, t]);
|
||||
|
||||
function handleMenu(action: string) {
|
||||
switch (action) {
|
||||
@@ -5055,6 +5074,7 @@ export default function App() {
|
||||
case 'tools.dvk': setDvkEnabled((v) => !v); break;
|
||||
case 'tools.cwdecoder': toggleCwDecoder(); break;
|
||||
case 'tools.net': setNetEnabled((v) => { const nv = !v; if (nv) setActiveTab('net'); return nv; }); break;
|
||||
case 'tools.watchlist': setWatchlistEnabled((v) => { const nv = !v; if (nv) setActiveTab('watchlist'); return nv; }); break;
|
||||
case 'tools.contest': setContestTabEnabled((v) => { const nv = !v; if (nv) setActiveTab('contest'); else setActiveTab((tb) => (tb === 'contest' ? 'recent' : tb)); return nv; }); break;
|
||||
case 'tools.alerts': setAlertsOpen(true); break;
|
||||
case 'tools.duplicates': setShowDuplicates(true); break;
|
||||
@@ -5870,6 +5890,13 @@ export default function App() {
|
||||
// worked call still matches its own entity status too (new-band/new-slot),
|
||||
// so it stays visible under those chips.
|
||||
const matches = (st !== 'worked' && clusterStatusFilter.has(st))
|
||||
// NEW CALL is a FACT about the callsign (never worked on this band and
|
||||
// mode), surfaced as a status only by the slot-highlight option. The
|
||||
// chip filters on the fact itself, so it works whether or not that
|
||||
// display option is on — worked_slot is computed whenever either
|
||||
// slot option is enabled.
|
||||
|| (clusterStatusFilter.has('new-call') && e?.worked_slot === false
|
||||
&& (!e?.status || e?.status === 'worked' || e?.status === 'new-call'))
|
||||
|| (!!e?.worked_call && clusterStatusFilter.has('worked'))
|
||||
|| (!!e?.new_pota && clusterStatusFilter.has('new-pota'))
|
||||
|| (!!e?.new_county && clusterStatusFilter.has('new-county'))
|
||||
@@ -5976,12 +6003,20 @@ export default function App() {
|
||||
);
|
||||
|
||||
const F_CHIP = 'px-1.5 py-[3px] rounded-md border text-[10px] font-bold tracking-wider transition-opacity';
|
||||
const fChip = (key: string, label: string, cls: string, on: boolean, toggle: () => void) => (
|
||||
<button key={key} type="button" onClick={toggle}
|
||||
className={cn(F_CHIP, on ? cls : `${cls} opacity-40 hover:opacity-80`)}>
|
||||
const fChip = (key: string, label: string, cls: string, on: boolean, toggle: () => void, style?: React.CSSProperties, title?: string) => (
|
||||
<button key={key} type="button" onClick={toggle} title={title}
|
||||
className={cn(F_CHIP, on ? cls : `${cls} opacity-40 hover:opacity-80`)} style={style}>
|
||||
{label}
|
||||
</button>
|
||||
);
|
||||
// chipStyle builds a filter chip in an arbitrary colour — for the statuses
|
||||
// whose grid badge is not one of the semantic tokens the chip classes cover.
|
||||
// A filter that does not look like what it selects has to be learned twice.
|
||||
const chipStyle = (c: string): React.CSSProperties => ({
|
||||
color: c,
|
||||
borderColor: `color-mix(in srgb, ${c} 45%, transparent)`,
|
||||
background: `color-mix(in srgb, ${c} 14%, transparent)`,
|
||||
});
|
||||
|
||||
const renderClusterFilters = () => (
|
||||
<div className="w-56 shrink-0 border-l border-border/60 flex flex-col min-h-0 bg-muted/10">
|
||||
@@ -6097,14 +6132,14 @@ export default function App() {
|
||||
{ k: 'new-band-mode' as SpotFilterKey, label: 'NEW B+M', cls: 'bg-danger-muted text-danger-muted-foreground border-danger-border' },
|
||||
{ k: 'new-band' as SpotFilterKey, label: 'NEW BAND', cls: 'bg-warning-muted text-warning-muted-foreground border-warning-border' },
|
||||
{ k: 'new-mode' as SpotFilterKey, label: 'NEW MODE', cls: 'bg-caution-muted text-caution-muted-foreground border-caution-border' },
|
||||
{ k: 'new-slot' as SpotFilterKey, label: 'NEW SLOT', cls: 'bg-caution-muted text-caution-muted-foreground border-caution-border' },
|
||||
{ k: 'new-slot' as SpotFilterKey, label: 'NEW SLOT', cls: 'border', style: chipStyle('#5AC8FA') },
|
||||
// NEW CALL is about the CALLSIGN, not the entity: never worked on this
|
||||
// band and mode. Only appears when the slot-highlight option is on.
|
||||
{ k: 'new-call' as SpotFilterKey, label: 'NEW CALL', cls: 'bg-caution-muted text-caution-muted-foreground border-caution-border' },
|
||||
// Same colours as the badges in the grid — a filter that does not
|
||||
// look like what it selects has to be learned twice.
|
||||
{ k: 'new-pota' as SpotFilterKey, label: 'NEW POTA', cls: 'bg-success-muted text-success-muted-foreground border-success-border' },
|
||||
{ k: 'new-county' as SpotFilterKey, label: 'NEW COUNTY', cls: 'bg-success-muted text-success-muted-foreground border-success-border' },
|
||||
{ k: 'new-county' as SpotFilterKey, label: 'NEW COUNTY', cls: 'border', style: chipStyle('var(--chart-5)') },
|
||||
{ k: 'new-pfx' as SpotFilterKey, label: 'NEW PFX', cls: 'bg-caution-muted text-caution-muted-foreground border-caution-border' },
|
||||
// Only ever set for a station this receiver decoded over the UDP link.
|
||||
{ k: 'new-grid' as SpotFilterKey, label: 'NEW GRID', cls: 'bg-muted text-foreground border-border' },
|
||||
@@ -6112,8 +6147,9 @@ export default function App() {
|
||||
// worked spots; the separate "Hide worked" checkbox drops them — they
|
||||
// are opposite controls, so don't use both at once.
|
||||
{ k: 'worked' as SpotFilterKey, label: 'WORKED', cls: 'bg-info-muted text-info-muted-foreground border-info-border' },
|
||||
]).map((s) => fChip(s.k, s.label, s.cls, clusterStatusFilter.has(s.k),
|
||||
() => setClusterStatusFilter((cur) => { const n = new Set(cur); if (n.has(s.k)) n.delete(s.k); else n.add(s.k); return n; })))}
|
||||
]).filter((s: any) => s.k !== 'new-pota' || chasePota())
|
||||
.map((s: any) => fChip(s.k, s.label, s.cls, clusterStatusFilter.has(s.k),
|
||||
() => setClusterStatusFilter((cur) => { const n = new Set(cur); if (n.has(s.k)) n.delete(s.k); else n.add(s.k); return n; }), s.style))}
|
||||
</div>,
|
||||
clusterStatusFilter.size > 0 ? (
|
||||
<button type="button" onClick={() => setClusterStatusFilter(new Set())}
|
||||
@@ -6317,6 +6353,13 @@ export default function App() {
|
||||
<IcomPanel isNetwork={catBackend === 'icom-net'} onReportRST={(r) => { setRstSent(r); rstUserEditedRef.current = true; }} />
|
||||
</div>
|
||||
);
|
||||
case 'watchlist':
|
||||
return (
|
||||
<div className="h-full w-full min-h-0 flex flex-col bg-card border border-border rounded-lg overflow-hidden">
|
||||
<WatchlistTab spots={spots} spotStatus={spotStatus}
|
||||
onSpotSelect={handleSpotSelect} onSpotClick={handleSpotClick} />
|
||||
</div>
|
||||
);
|
||||
case 'netcontrol':
|
||||
return (
|
||||
<div className="h-full w-full min-h-0 flex flex-col rounded-lg overflow-hidden border border-border">
|
||||
@@ -7210,7 +7253,7 @@ export default function App() {
|
||||
// relative + absolute inner: the panel's content can't grow the row, so
|
||||
// the row height is set by the ENTRY STRIP. A taller tab (Awards/F3) then
|
||||
// scrolls inside this fixed height instead of pushing everything down.
|
||||
<div className="w-[560px] shrink-0 min-h-0 relative">
|
||||
<div className="w-[600px] shrink-0 min-h-0 relative">
|
||||
<div className="absolute inset-0 flex flex-col min-h-0">
|
||||
<DetailsPanel
|
||||
callsign={callsign}
|
||||
@@ -7392,7 +7435,10 @@ export default function App() {
|
||||
entry, and the rig onto the frequency it was decoded on. */}
|
||||
<ChaseNewPanel onPick={(sp) => {
|
||||
onCallsignInput(sp.call, { force: true });
|
||||
if (sp.freq_hz) void tuneRigCAT(sp.freq_hz, sp.mode);
|
||||
// And the panadapter width too — after the tune settles, for the
|
||||
// same SmartSDR pan-follow reason as handleSpotClick.
|
||||
if (sp.freq_hz) void tuneRigCAT(sp.freq_hz, sp.mode).then(() =>
|
||||
window.setTimeout(() => FlexZoomForSpot(sp.mode ?? '', sp.freq_hz ?? 0).catch(() => {}), 300));
|
||||
}} onClose={() => { setShowChaseNew(false); writeUiPref('opslog.showChaseNew', '0'); }} />
|
||||
</div>
|
||||
)}
|
||||
@@ -7585,6 +7631,21 @@ export default function App() {
|
||||
</span>
|
||||
</TabsTrigger>
|
||||
)}
|
||||
{watchlistEnabled && (
|
||||
<TabsTrigger value="watchlist" className="gap-1.5">
|
||||
{t('tab.watchlist')}
|
||||
<span
|
||||
role="button"
|
||||
aria-label="Close Watchlist"
|
||||
title="Close"
|
||||
className="inline-flex items-center justify-center size-4 rounded hover:bg-foreground/10 text-muted-foreground hover:text-foreground"
|
||||
onPointerDown={(e) => { e.stopPropagation(); }}
|
||||
onClick={(e) => { e.stopPropagation(); setWatchlistEnabled(false); setActiveTab((t) => (t === 'watchlist' ? 'recent' : t)); }}
|
||||
>
|
||||
<X className="size-3" />
|
||||
</span>
|
||||
</TabsTrigger>
|
||||
)}
|
||||
{catState.backend === 'flex' && <TabsTrigger value="flex">Flex Console</TabsTrigger>}
|
||||
{catState.backend === 'icom' && <TabsTrigger value="icom">Icom Console</TabsTrigger>}
|
||||
{catState.backend === 'yaesu' && <TabsTrigger value="yaesu">Yaesu Console</TabsTrigger>}
|
||||
@@ -8296,6 +8357,12 @@ export default function App() {
|
||||
{/* Band Map: several bands shown side-by-side (panadapter-style
|
||||
strips). Pick bands with the chips; each strip is clickable to
|
||||
tune the rig. */}
|
||||
{watchlistEnabled && (
|
||||
<TabsContent value="watchlist" className="mt-0 flex flex-col min-h-0 flex-1">
|
||||
<WatchlistTab spots={spots} spotStatus={spotStatus}
|
||||
onSpotSelect={handleSpotSelect} onSpotClick={handleSpotClick} />
|
||||
</TabsContent>
|
||||
)}
|
||||
{netEnabled && (
|
||||
<TabsContent value="net" className="mt-0 flex flex-col min-h-0 flex-1">
|
||||
<NetControlPanel onLogged={refresh} countries={countries} bands={bands} modes={modes}
|
||||
@@ -8652,9 +8719,14 @@ export default function App() {
|
||||
// freqMhz display string, which the manual-edit freeze / field locks can
|
||||
// leave stale (that dropped the sub-kHz: on 14134.5 the frozen "14.134"
|
||||
// string spotted 14134). Fall back to the entry field, then the last QSO.
|
||||
//
|
||||
// The RX frequency when split, deliberately: a spot names where the
|
||||
// STATION is, and in split that is where we listen — freq_hz is where
|
||||
// we transmit, and spotting a 5-up pile-up's TX frequency sent the
|
||||
// whole cluster five kHz above the DX.
|
||||
defaultFreqKHz={
|
||||
catState.connected && (catState.freq_hz ?? 0) > 0
|
||||
? Math.round(((catState.freq_hz ?? 0) / 1000) * 10) / 10
|
||||
catState.connected && ((catState.split && (catState.freq_rx_hz ?? 0) > 0 ? catState.freq_rx_hz : catState.freq_hz) ?? 0) > 0
|
||||
? Math.round((((catState.split && (catState.freq_rx_hz ?? 0) > 0 ? catState.freq_rx_hz : catState.freq_hz) ?? 0) / 1000) * 10) / 10
|
||||
: parseFloat(freqMhz) > 0
|
||||
? Math.round(parseFloat(freqMhz) * 1000 * 10) / 10
|
||||
: (qsos[0]?.freq_hz ? Math.round((qsos[0].freq_hz / 1000) * 10) / 10 : 0)
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Minus, Plus, Crosshair, X, PanelLeft, PanelRight } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { bandRange, bandSegments, subscribeIaruRegion, type SegMode } from '@/lib/bandplan';
|
||||
import { spotStatusKey, inferSpotMode, spotModeCategory } from '@/lib/spot';
|
||||
import { SPOT_MARKERS, activeMarkers } from '@/lib/spotMarkers';
|
||||
import { applySpotDisplay, readSpotDisplayOptions } from '@/lib/spotDisplay';
|
||||
@@ -114,59 +115,26 @@ interface Props {
|
||||
keyNav?: boolean;
|
||||
}
|
||||
|
||||
const BAND_RANGES: Record<string, [number, number]> = {
|
||||
'160m': [1800, 2000],
|
||||
'80m': [3500, 3800],
|
||||
'60m': [5350, 5450],
|
||||
'40m': [7000, 7200],
|
||||
'30m': [10100, 10150],
|
||||
'20m': [14000, 14350],
|
||||
'17m': [18068, 18168],
|
||||
'15m': [21000, 21450],
|
||||
'12m': [24890, 24990],
|
||||
'10m': [28000, 29700],
|
||||
'6m': [50000, 50500],
|
||||
'4m': [70000, 70500],
|
||||
'2m': [144000, 146000],
|
||||
'70cm': [430000, 440000],
|
||||
// Band edges and mode segments come from lib/bandplan, which knows the
|
||||
// operator's IARU region (Settings → General): a Region 2 operator's 40 m runs
|
||||
// to 7300 with phone from 7125, and drawing Region 1's plan under their spots
|
||||
// cut the top 100 kHz of the band off the map.
|
||||
//
|
||||
// Sub-band shading colours: these are IDENTITIES (which mode the segment is
|
||||
// for), not states, so they take categorical hues — never the status tokens.
|
||||
// All three are drawn from the cool end of the categorical order and laid down
|
||||
// at low opacity, so the band plan stays background context while the warm
|
||||
// spot pills keep the foreground. Checked with the palette validator in both
|
||||
// themes (violet failed the dark protan step; magenta clears every check).
|
||||
const SEG_COLOR: Record<SegMode, string> = {
|
||||
cw: 'var(--chart-7)', // magenta
|
||||
digi: 'var(--chart-1)', // blue
|
||||
phone: 'var(--chart-2)', // aqua
|
||||
};
|
||||
|
||||
// Sub-band shading: CW / digital / phone.
|
||||
//
|
||||
// These are IDENTITIES (which mode the segment is for), not states, so they take
|
||||
// categorical hues — never the status tokens. They used to use success / info /
|
||||
// warning, which collided head-on with the spot pills drawn ON TOP of them: amber
|
||||
// is "new band" in this very component's legend, so the whole SSB portion read as
|
||||
// a giant "new band" wash. Status colours are reserved for status.
|
||||
//
|
||||
// All three are drawn from the COOL end of the categorical order and laid down at
|
||||
// low opacity, so the band plan stays background context while the warm spot pills
|
||||
// keep the foreground to themselves.
|
||||
// Checked with the palette validator in BOTH themes. Violet was the first pick
|
||||
// for CW and failed on the dark steps — violet and blue land 1.9 ΔE apart for a
|
||||
// protan reader there, i.e. the same colour. Magenta clears every check on both
|
||||
// surfaces (worst adjacent pair 13.0 light / 15.9 dark).
|
||||
const SEG_CW = 'var(--chart-7)'; // magenta
|
||||
const SEG_DIGI = 'var(--chart-1)'; // blue
|
||||
const SEG_PHONE = 'var(--chart-2)'; // aqua
|
||||
// A band-plan wash is CONTEXT, not data: it must stay under the spot pills that
|
||||
// are read on top of it.
|
||||
const SEG_OPACITY = 0.13;
|
||||
|
||||
const SEGMENT_COLORS: Record<string, [number, number, string][]> = {
|
||||
'160m': [[1800, 1838, SEG_CW], [1838, 1840, SEG_DIGI], [1840, 2000, SEG_PHONE]],
|
||||
'80m': [[3500, 3580, SEG_CW], [3580, 3600, SEG_DIGI], [3600, 3800, SEG_PHONE]],
|
||||
'60m': [[5350, 5450, SEG_PHONE]],
|
||||
'40m': [[7000, 7040, SEG_CW], [7040, 7100, SEG_DIGI], [7100, 7200, SEG_PHONE]],
|
||||
'30m': [[10100, 10130, SEG_CW], [10130, 10150, SEG_DIGI]],
|
||||
'20m': [[14000, 14070, SEG_CW], [14070, 14100, SEG_DIGI], [14100, 14350, SEG_PHONE]],
|
||||
'17m': [[18068, 18095, SEG_CW], [18095, 18110, SEG_DIGI], [18110, 18168, SEG_PHONE]],
|
||||
'15m': [[21000, 21070, SEG_CW], [21070, 21150, SEG_DIGI], [21150, 21450, SEG_PHONE]],
|
||||
'12m': [[24890, 24915, SEG_CW], [24915, 24940, SEG_DIGI], [24940, 24990, SEG_PHONE]],
|
||||
'10m': [[28000, 28070, SEG_CW], [28070, 28300, SEG_DIGI], [28300, 29700, SEG_PHONE]],
|
||||
'6m': [[50000, 50100, SEG_CW], [50100, 50500, SEG_PHONE]],
|
||||
};
|
||||
|
||||
// Small coloured dot + label used in the band-map legend strip.
|
||||
function LegendDot({ cls, colour, label }: { cls?: string; colour?: string; label: string }) {
|
||||
return (
|
||||
@@ -304,13 +272,16 @@ export function BandMap({ band, spots, spotStatus: spotStatusRaw, currentFreqHz,
|
||||
// nothing until the next poll happened to hand over a fresh object.
|
||||
const dispOpts = readSpotDisplayOptions();
|
||||
const spotStatus = useMemo(() => {
|
||||
if (!dispOpts.muteWorked && !dispOpts.slotHighlight) return spotStatusRaw;
|
||||
if (!dispOpts.muteWorked && !dispOpts.slotHighlight && dispOpts.chasePota) return spotStatusRaw;
|
||||
const out: Record<string, SpotStatusEntry> = {};
|
||||
for (const k of Object.keys(spotStatusRaw)) out[k] = applySpotDisplay(spotStatusRaw[k], dispOpts) as SpotStatusEntry;
|
||||
return out;
|
||||
}, [spotStatusRaw, dispOpts.muteWorked, dispOpts.slotHighlight]);
|
||||
const range = BAND_RANGES[band];
|
||||
const segments = SEGMENT_COLORS[band] ?? [];
|
||||
}, [spotStatusRaw, dispOpts.muteWorked, dispOpts.slotHighlight, dispOpts.chasePota]);
|
||||
// Re-render when the operator changes their IARU region in Settings.
|
||||
const [, setRegionTick] = useState(0);
|
||||
useEffect(() => subscribeIaruRegion(() => setRegionTick((n) => n + 1)), []);
|
||||
const range = bandRange(band);
|
||||
const segments = bandSegments(band).map(([a, b, m]) => [a, b, SEG_COLOR[m]] as [number, number, string]);
|
||||
const [zoomIdx, setZoomIdx] = useState(() => readZoom(band));
|
||||
// The docked map follows the rig, so a band change must bring up THAT band's
|
||||
// remembered zoom.
|
||||
@@ -794,9 +765,9 @@ export function BandMap({ band, spots, spotStatus: spotStatusRaw, currentFreqHz,
|
||||
))}
|
||||
{/* Sub-band shading, so the wash behind the pills is never colour-alone. */}
|
||||
<span className="mx-0.5 opacity-40">|</span>
|
||||
<LegendDot colour={SEG_CW} label={t("bmp.legendCW")} />
|
||||
<LegendDot colour={SEG_DIGI} label={t("bmp.legendData")} />
|
||||
<LegendDot colour={SEG_PHONE} label={t("bmp.legendPhone")} />
|
||||
<LegendDot colour={SEG_COLOR.cw} label={t("bmp.legendCW")} />
|
||||
<LegendDot colour={SEG_COLOR.digi} label={t("bmp.legendData")} />
|
||||
<LegendDot colour={SEG_COLOR.phone} label={t("bmp.legendPhone")} />
|
||||
</div>
|
||||
<div className="px-3 py-1 text-[9px] text-muted-foreground bg-muted/30 border-t border-border font-mono text-center shrink-0">
|
||||
{t('bmp.footerHint')}
|
||||
|
||||
@@ -242,11 +242,11 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
||||
return (
|
||||
<section
|
||||
className={cn(
|
||||
'flex items-center gap-4 px-3 py-2 flex-wrap shrink-0',
|
||||
'flex items-center gap-2 px-2 py-2 flex-wrap shrink-0',
|
||||
newOne && 'bg-gradient-to-br from-warning-muted to-warning-muted rounded-lg',
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center gap-2 min-w-[220px] flex-1">
|
||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
||||
{newOne ? (
|
||||
<>
|
||||
<Badge className="bg-warning text-warning-foreground gap-1 px-3 py-1 text-[11px]">
|
||||
@@ -269,7 +269,7 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
||||
{forCall}
|
||||
</Badge>
|
||||
)}
|
||||
<Badge className="bg-primary text-primary-foreground px-3 py-1 text-xs normal-case font-semibold tracking-normal">
|
||||
<Badge className="bg-primary text-primary-foreground px-2 py-0.5 text-xs normal-case font-semibold tracking-normal leading-tight">
|
||||
{dxccName || `DXCC #${dxcc}`}
|
||||
</Badge>
|
||||
{mwBadge}
|
||||
|
||||
@@ -60,6 +60,9 @@ const FIELDS: FieldDef[] = [
|
||||
// No promoted column: written into extras_json (see qso.bulkEditableExtras).
|
||||
{ id: 'owner_callsign', label: 'bulk.fOwnerCallsign', group: 'My station', kind: 'text', upper: true },
|
||||
{ id: 'my_grid', label: 'bulk.fMyGrid', group: 'My station', kind: 'text', upper: true },
|
||||
{ id: 'my_dxcc', label: 'bulk.fMyDxcc', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_cq_zone', label: 'bulk.fMyCqZone', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_itu_zone', label: 'bulk.fMyItuZone', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_antenna', label: 'bulk.fMyAntenna', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_rig', label: 'bulk.fMyRig', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_street', label: 'bulk.fMyStreet', group: 'My station', kind: 'text' },
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { cleanSpotter, inferSpotMode, spotStatusKey } from '@/lib/spot';
|
||||
import { markerColour } from '@/lib/spotMarkers';
|
||||
import { applySpotDisplay, readSpotDisplayOptions } from '@/lib/spotDisplay';
|
||||
import { applySpotDisplay, chasePota, chaseSota, readSpotDisplayOptions } from '@/lib/spotDisplay';
|
||||
import { loadLocal, loadRemote, saveState, seedLocal, whenGridPrefsReady } from '@/lib/gridPrefs';
|
||||
import { distanceUnit, distanceValue, subscribeDistanceUnit } from '@/lib/units';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
@@ -148,6 +148,12 @@ function statusFor(p: any): SpotStatusEntry | undefined {
|
||||
// filled pfx → new prefix filled POTA → new park filled county → new county
|
||||
// blue call → already worked (not a novelty, so text only)
|
||||
const NEW = 'var(--warning)'; // yellow: something here is new
|
||||
// NEW SLOT gets its own hue. It shared the amber NEW family while the NEW PFX
|
||||
// marker sits in caution yellow — two different facts, two near-identical
|
||||
// colours in the same cell. Sky cyan, the exact colour the panadapter palette
|
||||
// ships for new-slot (#5AC8FA), so the two views tell one story — and clearly
|
||||
// apart from the POTA green the first attempt (aqua) sat next to.
|
||||
const NEWSLOT = '#5AC8FA';
|
||||
const WKD = 'var(--info)'; // blue: this callsign is already in the log
|
||||
|
||||
// FILLING the cell that carries the fact, rather than only tinting its text.
|
||||
@@ -190,9 +196,10 @@ function statusColor(s: SpotStatusEntry | undefined): string | null {
|
||||
case 'new-band-mode':
|
||||
case 'new-band':
|
||||
case 'new-mode':
|
||||
case 'new-slot':
|
||||
case 'new-call':
|
||||
return NEW;
|
||||
case 'new-slot':
|
||||
return NEWSLOT;
|
||||
default:
|
||||
return s?.worked_call ? WKD : null;
|
||||
}
|
||||
@@ -336,7 +343,9 @@ const makeColCatalog = (t: TFn): ColEntry[] => [
|
||||
},
|
||||
{
|
||||
group: 'Spot', label: t('clg2.c.pota'), colId: 'pota',
|
||||
headerName: t('clg2.c.pota'), field: 'pota_ref' as any, width: 92, cellClass: 'font-mono',
|
||||
headerName: t('clg2.c.pota'), width: 92, cellClass: 'font-mono',
|
||||
// Through a valueGetter so the chase switch empties the column live.
|
||||
valueGetter: (p: any) => (chasePota() ? p.data?.pota_ref ?? '' : ''),
|
||||
defaultVisible: true,
|
||||
cellStyle: (p: any) => (statusFor(p)?.new_pota
|
||||
? fillStyle(markerColour('new_pota'))
|
||||
@@ -349,7 +358,8 @@ const makeColCatalog = (t: TFn): ColEntry[] => [
|
||||
// which is why the column is off by default rather than an empty column for
|
||||
// everyone who does not watch summits.
|
||||
group: 'Spot', label: t('clg2.c.sota'), colId: 'sota',
|
||||
headerName: t('clg2.c.sota'), field: 'sota_ref' as any, width: 100, cellClass: 'font-mono',
|
||||
headerName: t('clg2.c.sota'), width: 100, cellClass: 'font-mono',
|
||||
valueGetter: (p: any) => (chaseSota() ? p.data?.sota_ref ?? '' : ''),
|
||||
defaultVisible: false,
|
||||
cellStyle: () => ({ color: 'var(--success)' }) as any,
|
||||
},
|
||||
|
||||
@@ -4,17 +4,18 @@ import {
|
||||
GetKenwoodState, RefreshKenwood, SetKenwoodPower, SetKenwoodAFGain, SetKenwoodTX, TuneKenwoodATU,
|
||||
SetKenwoodRFGain, SetKenwoodMicGain, SetKenwoodSquelch, SetKenwoodPreamp, SetKenwoodAtt,
|
||||
SetKenwoodNB, SetKenwoodNR, SetKenwoodAGC, SetKenwoodFilter, SetKenwoodAntenna,
|
||||
SetKenwoodRIT, SetKenwoodXIT, ClearKenwoodRIT, SetKenwoodKeySpeed, ToggleKenwoodATU, NudgeKenwoodRIT,
|
||||
SetKenwoodRIT, SetKenwoodXIT, ClearKenwoodRIT, SetKenwoodKeySpeed, ToggleKenwoodATU, SetKenwoodRITOffset, SetKenwoodPanelMode,
|
||||
GetCATState,
|
||||
} from '../../wailsjs/go/main/App';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { sMeterRST } from '@/lib/rst';
|
||||
import { ShiftRow } from '@/components/ShiftRow';
|
||||
import { MeterBar } from '@/components/MeterBar';
|
||||
import { WheelRange } from '@/components/WheelRange';
|
||||
|
||||
type KenwoodState = {
|
||||
available: boolean; model?: string; elecraft: boolean; mode?: string;
|
||||
available: boolean; model?: string; elecraft: boolean; mode?: string; data_sub?: string;
|
||||
transmitting: boolean; split: boolean; split_tx_hz?: number;
|
||||
s_meter: number; s_meter_raw: number;
|
||||
power_meter: number; swr: number; swr_raw: number;
|
||||
@@ -41,18 +42,22 @@ const ZERO: KenwoodState = {
|
||||
// nobody notices are missing.
|
||||
const FILTERS = [200, 400, 700, 1000, 1800, 2400, 2800, 4000];
|
||||
|
||||
// Raw S-meter → S units. The K3 answers 0-21 across S0…S9+60; S9 is taken at
|
||||
// raw 9 and each step above it as 6 dB. PROVISIONAL, like the rest of the
|
||||
// scaling: the raw value is on screen and in the log, so a real radio settles
|
||||
// it rather than this comment.
|
||||
const S9_RAW = 9;
|
||||
const DB_PER_RAW = 6;
|
||||
function sParts(rawV: number): { s: number; over: number; label: string } {
|
||||
if (rawV >= S9_RAW) {
|
||||
const over = Math.max(0, Math.round((rawV - S9_RAW) * DB_PER_RAW));
|
||||
// Raw S-meter → S units, CALIBRATED against a real K3 beside its own display
|
||||
// (2026-08): raw 5 reads S7 on the radio, raw 9 reads S9+20. So S9 sits near
|
||||
// raw 6.5 — not 9, which showed everything two S-units low — and each raw step
|
||||
// above it is worth ~8 dB, shown in the 10 dB steps the K3's own meter uses.
|
||||
// A Kenwood answers 0-30 on the same command and keeps the simple 1-per-raw
|
||||
// scale until someone calibrates one against a real radio too.
|
||||
const K3_S9_RAW = 6.5;
|
||||
const K3_DB_PER_RAW = 8;
|
||||
function sParts(rawV: number, elecraft: boolean): { s: number; over: number; label: string } {
|
||||
const s9raw = elecraft ? K3_S9_RAW : 9;
|
||||
if (rawV >= s9raw) {
|
||||
let over = Math.max(0, Math.round((rawV - s9raw) * (elecraft ? K3_DB_PER_RAW : 6)));
|
||||
if (elecraft) over = Math.round(over / 10) * 10;
|
||||
return { s: 9, over, label: over > 0 ? `S9+${over}` : 'S9' };
|
||||
}
|
||||
const s = Math.max(0, Math.min(9, rawV));
|
||||
const s = Math.max(0, Math.min(9, Math.round(rawV * (elecraft ? 9 / K3_S9_RAW : 1))));
|
||||
return { s, over: 0, label: `S${s}` };
|
||||
}
|
||||
|
||||
@@ -89,9 +94,34 @@ function Toggle({ label, on, off, onClick }: { label: string; on: boolean; off:
|
||||
);
|
||||
}
|
||||
|
||||
// isDataMode: what the rig reports for MD6 varies — "DATA", or the configured
|
||||
// digital default (FT8…) — so the DATA family is "not one of the native modes".
|
||||
function isDataMode(m?: string): boolean {
|
||||
switch ((m ?? '').toUpperCase()) {
|
||||
case '': case 'CW': case 'USB': case 'LSB': case 'SSB': case 'FM': case 'AM': case 'RTTY':
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) => void }) {
|
||||
const { t } = useI18n();
|
||||
const [st, setSt] = useState<KenwoodState>(ZERO);
|
||||
// Ctrl+Left/Right shifts the RIT by ±10 Hz while RIT is on — the same
|
||||
// keyboard clarifier the Icom and TCI consoles have, for zero-beating a
|
||||
// caller without touching the mouse.
|
||||
const stRef = useRef(st); stRef.current = st;
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (!e.ctrlKey || (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight')) return;
|
||||
const v = stRef.current;
|
||||
if (!v.available || !v.rit) return;
|
||||
e.preventDefault();
|
||||
SetKenwoodRITOffset((v.rit_offset || 0) + (e.key === 'ArrowRight' ? 10 : -10)).catch(() => {});
|
||||
};
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => window.removeEventListener('keydown', onKey);
|
||||
}, []);
|
||||
const [freqHz, setFreqHz] = useState(0);
|
||||
const [err, setErr] = useState('');
|
||||
// Optimistic overlay: a slider must follow the finger, not the poll. Dropped
|
||||
@@ -149,6 +179,28 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
||||
{freqHz > 0 ? (freqHz / 1e6).toFixed(6) : '—'}
|
||||
</div>
|
||||
</div>
|
||||
{/* Mode row. The two DATA buttons are why it exists: MD6 alone keeps
|
||||
whatever submode the last session left, and a K3 "in DATA" with FSK D
|
||||
still armed keys FT8 with no audio. DATA sends MD6+DT0 (DATA A, the
|
||||
soundcard path), RTTY sends MD6+DT2 (FSK D). The active DATA button
|
||||
follows the rig's own DT answer. */}
|
||||
<div className="inline-flex rounded-md border border-border overflow-hidden">
|
||||
{([
|
||||
['CW', 'CW', view.mode === 'CW'],
|
||||
['USB', 'USB', view.mode === 'USB'],
|
||||
['LSB', 'LSB', view.mode === 'LSB'],
|
||||
['DATA', t('k3.modeData'), isDataMode(view.mode) && view.data_sub !== 'FSK D' && view.data_sub !== 'PSK D'],
|
||||
['RTTY', t('k3.modeRtty'), (isDataMode(view.mode) && (view.data_sub === 'FSK D' || view.data_sub === 'PSK D')) || view.mode === 'RTTY'],
|
||||
] as [string, string, boolean][]).map(([cmd, label, on]) => (
|
||||
<button key={cmd} type="button" disabled={off}
|
||||
title={cmd === 'DATA' ? t('k3.modeDataHint') : cmd === 'RTTY' ? t('k3.modeRttyHint') : label}
|
||||
onClick={() => SetKenwoodPanelMode(cmd).catch((e: any) => setErr(String(e?.message ?? e)))}
|
||||
className={cn('px-2.5 py-1.5 text-xs font-bold border-l border-border first:border-l-0',
|
||||
on ? 'bg-primary text-primary-foreground' : 'bg-card text-muted-foreground hover:bg-muted')}>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<button type="button" className="text-[11px] text-muted-foreground hover:text-foreground flex items-center gap-1"
|
||||
onClick={() => RefreshKenwood().catch(() => {})} title={t('k3.refreshHint')}>
|
||||
<SlidersHorizontal className="size-3.5" />
|
||||
@@ -163,10 +215,10 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-2">
|
||||
<MeterBar label="S-METER" value={view.transmitting ? 0 : view.s_meter} lo={0} hi={100}
|
||||
accent="#16a34a" segColor={sSegColor}
|
||||
display={view.transmitting ? '—' : sParts(view.s_meter_raw).label}
|
||||
display={view.transmitting ? '—' : sParts(view.s_meter_raw, view.elecraft).label}
|
||||
onClick={() => {
|
||||
if (view.transmitting || !onReportRST) return;
|
||||
const sp = sParts(view.s_meter_raw);
|
||||
const sp = sParts(view.s_meter_raw, view.elecraft);
|
||||
onReportRST(sMeterRST(sp.s, sp.over, view.mode));
|
||||
}}
|
||||
title={t('k3.sMeterHint', { raw: String(view.s_meter_raw) })} />
|
||||
@@ -216,7 +268,7 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-6 gap-y-2">
|
||||
<label className="flex items-center gap-2 text-xs">
|
||||
<span className="w-16 shrink-0 text-muted-foreground">{t('k3.power')}</span>
|
||||
<WheelRange min={0} max={110} step={5} disabled={off}
|
||||
<WheelRange min={0} max={110} step={1} disabled={off}
|
||||
value={view.rf_power ?? 0}
|
||||
onChange={(n) => put({ rf_power: n }, () => SetKenwoodPower(n))} />
|
||||
<span className="w-12 text-right font-mono tabular-nums">{view.rf_power ?? 0} W</span>
|
||||
@@ -279,21 +331,18 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* RIT / XIT. Clear zeroes both offsets at once — the radio's own RC,
|
||||
and what an operator means by "clear it". */}
|
||||
{/* RIT / XIT — the shared ShiftRow, exactly as the Icom and TCI consoles
|
||||
drive theirs: ± / wheel / type, Ctrl+←/→ while RIT is on. The K3 has
|
||||
ONE offset for both, so both rows show it, like the Icom's. */}
|
||||
<div className="space-y-1.5">
|
||||
<ShiftRow label="RIT" accent="#8b5cf6" on={view.rit} hz={view.rit_offset || 0} disabled={off}
|
||||
onToggle={() => SetKenwoodRIT(!view.rit).catch(setErrMsg)}
|
||||
onSet={(hz) => SetKenwoodRITOffset(hz).catch(setErrMsg)} />
|
||||
<ShiftRow label="XIT" accent="#f59e0b" on={view.xit} hz={view.rit_offset || 0} disabled={off}
|
||||
onToggle={() => SetKenwoodXIT(!view.xit).catch(setErrMsg)}
|
||||
onSet={(hz) => SetKenwoodRITOffset(hz).catch(setErrMsg)} />
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<Toggle label="RIT" on={view.rit} off={off} onClick={() => SetKenwoodRIT(!view.rit).catch(setErrMsg)} />
|
||||
<Toggle label="XIT" on={view.xit} off={off} onClick={() => SetKenwoodXIT(!view.xit).catch(setErrMsg)} />
|
||||
{/* The offset itself. A lit RIT button says the feature is on and
|
||||
nothing about where it has put the receiver. */}
|
||||
{[-100, -10, 10, 100].map((d) => (
|
||||
<Toggle key={d} label={(d > 0 ? '+' : '') + d} on={false} off={off}
|
||||
onClick={() => NudgeKenwoodRIT(d).catch(setErrMsg)} />
|
||||
))}
|
||||
<span className="text-[11px] font-mono tabular-nums text-muted-foreground w-16">
|
||||
{view.rit_offset > 0 ? '+' : ''}{view.rit_offset || 0} Hz
|
||||
</span>
|
||||
<Toggle label={t('k3.clear')} on={false} off={off} onClick={() => ClearKenwoodRIT().catch(setErrMsg)} />
|
||||
{/* Antenna only when the radio answered AN — a K3 without the internal
|
||||
ATU has one socket and no switch to offer. */}
|
||||
{view.antenna > 0 && (<>
|
||||
|
||||
@@ -79,17 +79,18 @@ function bandsFor(model?: string): Band[] {
|
||||
|
||||
// Mode buttons for the console (like RS-BA1's row). SetCATMode picks USB/LSB for
|
||||
// SSB by frequency and the rig's data variant for digital modes.
|
||||
const MODES = ['SSB', 'CW', 'RTTY', 'PSK', 'AM', 'FM'];
|
||||
const MODES = ['SSB', 'CW', 'RTTY', 'PSK', 'AM', 'FM', 'DATA'];
|
||||
|
||||
// Attenuator steps are MODEL-dependent even though the CI-V command (0x11) is the
|
||||
// same: the value byte is the dB. The IC-7610 (and 7700/7800/7851) have a 6/12/18
|
||||
// dB stepped attenuator; the IC-7300/705/7100 have a single 20 dB attenuator; the
|
||||
// dB stepped attenuator, and the IC-7760 the same (confirmed on a real one); the
|
||||
// IC-7300/705/7100 have a single 20 dB attenuator; the
|
||||
// IC-9700 a single 10 dB. Offering the wrong steps = a dead button (the rig NAKs
|
||||
// e.g. 6 dB on a 7300). Default to the common single 20 dB for unknown models.
|
||||
function attOptions(model?: string): { v: string; l: string }[] {
|
||||
const m = (model ?? '').toUpperCase();
|
||||
const OFF = { v: '0', l: 'OFF' };
|
||||
if (/(7610|7700|7800|7850|7851)/.test(m)) {
|
||||
if (/(7610|7700|7760|7800|7850|7851)/.test(m)) {
|
||||
return [OFF, { v: '6', l: '6dB' }, { v: '12', l: '12dB' }, { v: '18', l: '18dB' }];
|
||||
}
|
||||
if (m.includes('9700')) return [OFF, { v: '10', l: '10dB' }];
|
||||
@@ -128,9 +129,36 @@ function fmtVFO(hz?: number): string {
|
||||
}
|
||||
|
||||
// modeMatches marks a mode button active, folding the rig's USB/LSB into SSB.
|
||||
// icomWatts turns the backend's 0-100 meter percentage back into watts on the
|
||||
// IC-7760's own meter face. The backend value is linear in the RAW meter byte
|
||||
// (0-255 → 0-100), but Icom's calibration is not: raw 143 is half deflection
|
||||
// and raw 213 is full scale. On a real 7760 a measured 100 W sits at half
|
||||
// deflection of the 250 W face — the linear ×2.5 first tried showed 140 W for
|
||||
// it. Below half scale watts run 0→100, above it 100→250.
|
||||
// The anchors are MEASURED on the real radio, not derived: a known 50 W read
|
||||
// raw ≈89 and a known 100 W read raw 143 (Icom's documented half-deflection),
|
||||
// with raw 213 = full scale = 250 W. The face is not linear in watts at the
|
||||
// bottom — a two-segment guess showed 50 W as 62 — so watts interpolate
|
||||
// between the measured anchors, and a new measurement just adds a row.
|
||||
const ICOM_7760_PO: [number, number][] = [[0, 0], [89, 50], [143, 100], [213, 250]];
|
||||
function icomWatts(pct: number): { w: number; defl: number } {
|
||||
const raw = Math.max(0, pct * 2.55);
|
||||
const defl = raw <= 143 ? (raw / 143) * 50 : Math.min(100, 50 + ((raw - 143) / 70) * 50);
|
||||
let w = 250;
|
||||
for (let i = 1; i < ICOM_7760_PO.length; i++) {
|
||||
const [r0, w0] = ICOM_7760_PO[i - 1], [r1, w1] = ICOM_7760_PO[i];
|
||||
if (raw <= r1) { w = w0 + ((raw - r0) / (r1 - r0)) * (w1 - w0); break; }
|
||||
}
|
||||
return { w: Math.round(w), defl };
|
||||
}
|
||||
|
||||
function modeMatches(btn: string, cur?: string): boolean {
|
||||
if (!cur) return false;
|
||||
if (btn === 'SSB') return cur === 'SSB' || cur === 'USB' || cur === 'LSB';
|
||||
// The backend surfaces USB-D as the operator's digital default (FT8…), or as
|
||||
// plain DATA — either way it is the DATA button that should light.
|
||||
if (btn === 'DATA') return ['DATA', 'FT8', 'FT4', 'JS8', 'JT65', 'JT9', 'MFSK', 'OLIVIA'].includes(cur);
|
||||
if (btn === 'PSK') return cur === 'PSK' || cur === 'PSK31';
|
||||
return btn === cur;
|
||||
}
|
||||
|
||||
@@ -245,7 +273,7 @@ function Meter({ label, value, accent, scale, onClick, title }: { label: string;
|
||||
</>
|
||||
);
|
||||
if (onClick) {
|
||||
return <button type="button" onClick={onClick} title={title} className="flex items-center gap-2 w-full rounded hover:bg-muted/50 -mx-1 px-1 py-0.5">{body}</button>;
|
||||
return <button type="button" onClick={onClick} title={title} className="flex items-center gap-2 w-full rounded cursor-pointer hover:bg-muted/50 -mx-1 px-1 py-0.5">{body}</button>;
|
||||
}
|
||||
return <div className="flex items-center gap-2">{body}</div>;
|
||||
}
|
||||
@@ -717,7 +745,7 @@ export function IcomPanel({ onReportRST, isNetwork = false }: { onReportRST?: (r
|
||||
</div>
|
||||
</div>
|
||||
{/* Mode selector row (RS-BA1's SSB/CW/RTTY/PSK/AM/FM). */}
|
||||
<div className="grid grid-cols-6 border-t border-border/60 divide-x divide-border/60">
|
||||
<div className="grid grid-cols-7 border-t border-border/60 divide-x divide-border/60">
|
||||
{MODES.map((m) => {
|
||||
const on = modeMatches(m, curMode);
|
||||
return (
|
||||
@@ -738,7 +766,13 @@ export function IcomPanel({ onReportRST, isNetwork = false }: { onReportRST?: (r
|
||||
title={onReportRST ? t('rst.clickToFill') : undefined}
|
||||
onClick={onReportRST ? () => onReportRST(sMeterRST(sp.s, sp.over, st.mode)) : undefined} />
|
||||
); })()}
|
||||
<Meter label="Po" value={st.power_meter} accent="#ef4444" scale={`${st.power_meter} W`} />
|
||||
{(() => {
|
||||
if ((st.model ?? '').includes('7760')) {
|
||||
const { w, defl } = icomWatts(st.power_meter);
|
||||
return <Meter label="Po" value={defl} accent="#ef4444" scale={`${w} W`} />;
|
||||
}
|
||||
return <Meter label="Po" value={st.power_meter} accent="#ef4444" scale={`${st.power_meter} W`} />;
|
||||
})()}
|
||||
<Meter label="SWR" value={st.swr_meter} accent="#f59e0b" scale={st.swr_meter > 0 ? `${(1 + st.swr_meter / 33.3).toFixed(1)}` : '1.0'} />
|
||||
</div>
|
||||
|
||||
@@ -784,7 +818,11 @@ export function IcomPanel({ onReportRST, isNetwork = false }: { onReportRST?: (r
|
||||
<Card icon={Mic} title={t('icmp.transmit')} accent="#ef4444">
|
||||
<Row label={t('icmp.power')}>
|
||||
<Slider value={st.rf_power} accent="#ef4444" onChange={(v) => set({ rf_power: v }, () => IcomSetRFPower(v))} />
|
||||
<span className="w-8 text-right text-xs font-mono tabular-nums text-muted-foreground">{st.rf_power}</span>
|
||||
{/* PC is a percentage of the rig's rated power; on a 200 W rig the
|
||||
operator thinks in watts, so say it in watts there. */}
|
||||
<span className="w-12 text-right text-xs font-mono tabular-nums text-muted-foreground">
|
||||
{(st.model ?? '').includes('7760') ? `${st.rf_power * 2} W` : st.rf_power}
|
||||
</span>
|
||||
</Row>
|
||||
{isPhone && (
|
||||
<Row label={t('icmp.mic')}>
|
||||
|
||||
@@ -31,7 +31,7 @@ const UPLOAD_COLS: ColDef<UploadRow>[] = [
|
||||
];
|
||||
|
||||
type Confirmation = {
|
||||
callsign: string; qso_date: string; band: string; mode: string; country: string;
|
||||
callsign: string; station?: string; qso_date: string; band: string; mode: string; country: string;
|
||||
new_dxcc: boolean; new_band: boolean; new_mode: boolean; new_slot: boolean;
|
||||
};
|
||||
|
||||
@@ -619,6 +619,10 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
|
||||
<thead className="sticky top-0 bg-card">
|
||||
<tr className="text-left text-muted-foreground border-b border-border">
|
||||
<th className="py-1.5 px-2">{t('qslm.thDateUtc')}</th><th className="py-1.5 px-2">{t('qslm.thCallsign')}</th>
|
||||
{/* Which of the operator's callsigns the contact was made
|
||||
under. Only worth a column when the list can hold more than
|
||||
one — see "All my callsigns" on the download. */}
|
||||
{shownConfs.some((c) => c.station) && <th className="py-1.5 px-2">{t('qslm.thStation')}</th>}
|
||||
<th className="py-1.5 px-2">{t('qslm.thBand')}</th><th className="py-1.5 px-2">{t('qslm.thMode')}</th>
|
||||
<th className="py-1.5 px-2">{t('qslm.thCountry')}</th><th className="py-1.5 px-2">{t('qslm.thNew')}</th>
|
||||
</tr>
|
||||
@@ -628,6 +632,9 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
|
||||
<tr key={i} className="border-b border-border/40">
|
||||
<td className="py-1 px-2 font-mono">{fmtDate(c.qso_date)}</td>
|
||||
<td className="py-1 px-2 font-mono font-bold">{c.callsign}</td>
|
||||
{shownConfs.some((x) => x.station) && (
|
||||
<td className="py-1 px-2 font-mono text-muted-foreground">{c.station ?? ''}</td>
|
||||
)}
|
||||
<td className="py-1 px-2">{c.band}</td>
|
||||
<td className="py-1 px-2">{c.mode}</td>
|
||||
<td className="py-1 px-2 text-muted-foreground">{c.country}</td>
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import {
|
||||
GetLookupSettings, SaveLookupSettings, ClearLookupCache, TestLookupProvider,
|
||||
GetListsSettings, SaveListsSettings,
|
||||
GetCATSettings, SaveCATSettings, GetRadios, SaveRadios, SetActiveRadio, DiscoverFlexRadios,
|
||||
GetCATSettings, SaveCATSettings, GetRadios, SaveRadios, SetActiveRadio, ActiveRadioID, DiscoverFlexRadios,
|
||||
ListProfiles, GetActiveProfile, SaveProfile, DeleteProfile, ActivateProfile, DuplicateProfile,
|
||||
GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop,
|
||||
GetRotorPresets, SaveRotorPresets, ResetRotorPresets,
|
||||
@@ -81,6 +81,7 @@ import {
|
||||
import { cn } from '@/lib/utils';
|
||||
import { writeUiPref } from '@/lib/uiPref';
|
||||
import { setUseMiles } from '@/lib/units';
|
||||
import { iaruRegion, setIaruRegion, type IaruRegion } from '@/lib/bandplan';
|
||||
import { getDateFormat, setDateFormat, type DateFormat } from '@/lib/dateFormat';
|
||||
import { useI18n, FlagGB, FlagFR, type Lang } from '@/lib/i18n';
|
||||
import { useTheme, CONCRETE_THEMES, type ThemeChoice } from '@/lib/theme';
|
||||
@@ -689,8 +690,7 @@ function TelemetryToggle() {
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||
<Checkbox checked={on} disabled={!loaded}
|
||||
onCheckedChange={(c) => { const v = !!c; setOn(v); SetTelemetryEnabled(v).catch(() => {}); }} />
|
||||
{t('settings.telemetry')}
|
||||
<span className="text-xs text-muted-foreground">({t('settings.telemetryHint')})</span>
|
||||
<span title={t('settings.telemetryHint')}>{t('settings.telemetry')}</span>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
@@ -1086,7 +1086,7 @@ function RelayAutoPanel() {
|
||||
// panes. The first two are the view; the third and fourth can be left empty, and
|
||||
// an empty one is not drawn at all. Per-profile (stored via SetUIPref, which is
|
||||
// profile-prefixed). Self-contained so it owns its async-loaded state.
|
||||
const MAIN_PANE_VALUES = ['map1', 'map2', 'cluster', 'worked', 'recent', 'netcontrol', 'decodes'];
|
||||
const MAIN_PANE_VALUES = ['map1', 'map2', 'cluster', 'worked', 'recent', 'netcontrol', 'decodes', 'watchlist'];
|
||||
const PANE_NONE = 'none';
|
||||
function MainViewPanes({ onChanged, flexAvailable, icomAvailable, yaesuAvailable, elecraftAvailable, tciAvailable }: { onChanged?: (side: 'left' | 'right' | 'p3' | 'p4' | 'layout', value: string) => void; flexAvailable?: boolean; icomAvailable?: boolean; yaesuAvailable?: boolean; elecraftAvailable?: boolean; tciAvailable?: boolean }) {
|
||||
const { t } = useI18n();
|
||||
@@ -1503,6 +1503,7 @@ const ICOM_MODELS: { name: string; addr: number }[] = [
|
||||
{ name: 'IC-7600', addr: 0x7A },
|
||||
{ name: 'IC-7610', addr: 0x98 },
|
||||
{ name: 'IC-7700', addr: 0x74 },
|
||||
{ name: 'IC-7760', addr: 0xB2 },
|
||||
{ name: 'IC-7800', addr: 0x6A },
|
||||
{ name: 'IC-7851', addr: 0x8E },
|
||||
{ name: 'IC-9100', addr: 0x7C },
|
||||
@@ -1749,6 +1750,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
const [lookupOnBlur, setLookupOnBlur] = useState(() => localStorage.getItem('opslog.lookupOnBlur') === '1');
|
||||
const [groupDigital, setGroupDigital] = useState(() => localStorage.getItem('opslog.groupDigitalSlots') === '1');
|
||||
const [milesUnit, setMilesUnit] = useState(() => localStorage.getItem('opslog.distanceMiles') === '1');
|
||||
const [region, setRegion] = useState<IaruRegion>(() => iaruRegion());
|
||||
const [clusterWorkedSameSlot, setClusterWorkedSameSlot] = useState(() => localStorage.getItem('opslog.clusterWorkedSameSlot') === '1');
|
||||
// Declared HERE and not in ClusterPanel: that renderer is called as a plain
|
||||
// function by the PANELS map, so it must stay hooks-free.
|
||||
@@ -2067,6 +2069,8 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
try { await SaveGridScopeSettings(next); } catch { /* the panel keeps the choice either way */ }
|
||||
};
|
||||
const [chaseGrids, setChaseGrids] = useState(false);
|
||||
const [chasePotaOn, setChasePotaOn] = useState(() => localStorage.getItem('opslog.chasePota') !== '0');
|
||||
const [chaseSotaOn, setChaseSotaOn] = useState(() => localStorage.getItem('opslog.chaseSota') !== '0');
|
||||
const [chaseNew, setChaseNew] = useState(false);
|
||||
const [spotTTL, setSpotTTL] = useState(0);
|
||||
const [spotTTLText, setSpotTTLText] = useState('0');
|
||||
@@ -2202,8 +2206,14 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
try {
|
||||
const rl: any = await GetRadios();
|
||||
setRadios(rl ?? []);
|
||||
const act = (rl ?? []).find((r: any) => r.active) ?? (rl ?? [])[0];
|
||||
setActiveRadioId(act?.id ?? '');
|
||||
// The backend is the only one who knows which radio is on the air —
|
||||
// the list entries carry no 'active' flag, and guessing the first
|
||||
// meant reopening the panel showed Radio 1's name over the settings
|
||||
// of whichever radio was actually selected.
|
||||
let actId = '';
|
||||
try { actId = (await ActiveRadioID()) ?? ''; } catch {}
|
||||
if (!actId || !(rl ?? []).some((r: any) => r.id === actId)) actId = (rl ?? [])[0]?.id ?? '';
|
||||
setActiveRadioId(actId);
|
||||
} catch { /* one radio, never listed — the panel works as it always did */ }
|
||||
try { setUltrabeam(await GetUltrabeamSettings() as any); } catch {}
|
||||
try { setAntgenius(await GetAntGeniusSettings() as any); } catch {}
|
||||
@@ -4883,7 +4893,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
|
||||
{wk.engine === 'icom' ? (
|
||||
<>
|
||||
{(!catCfg.enabled || catCfg.backend !== 'icom') && (
|
||||
{(!catCfg.enabled || (catCfg.backend !== 'icom' && catCfg.backend !== 'icom-net')) && (
|
||||
<p className="text-xs font-medium text-warning -mt-1 flex items-start gap-1.5">
|
||||
<span aria-hidden>⚠</span>
|
||||
<span>{t('wk.catWarnIcom', { backend: catCfg.enabled ? (catCfg.backend || 'none') : 'disabled' })}</span>
|
||||
@@ -5313,11 +5323,6 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('clu.freeNodes')} <span className="font-mono">dxc.k0xm.net:7300</span>,{' '}
|
||||
<span className="font-mono">dx.maritimecontestclub.net:7300</span>,{' '}
|
||||
<span className="font-mono">w8avi.net:7300</span>.
|
||||
</p>
|
||||
<label className="flex items-start gap-2 text-sm cursor-pointer border-t border-border/60 pt-3">
|
||||
<Checkbox checked={clusterWorkedSameSlot} className="mt-0.5"
|
||||
onCheckedChange={(c) => { const v = !!c; setClusterWorkedSameSlot(v); writeUiPref('opslog.clusterWorkedSameSlot', v ? '1' : '0'); }} />
|
||||
@@ -5379,11 +5384,24 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
const n = parseInt(raw, 10);
|
||||
if (Number.isFinite(n) && n > 0) SetSpotMax(Math.min(10000, n)).catch(() => {});
|
||||
}} />
|
||||
<span className="text-xs text-muted-foreground">{t('clu.spotMaxHint')}</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="border-t border-border/60 pt-3 space-y-2">
|
||||
{/* Chase switches: off, the marker stops being TOLD, everywhere at
|
||||
once — badge, colour, filter chip, reference column. A "new band
|
||||
+ new POTA" spot then reads NEW BAND alone. */}
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer" title={t('clu.chasePotaHint')}>
|
||||
<Checkbox checked={chasePotaOn}
|
||||
onCheckedChange={(c) => { const v = !!c; setChasePotaOn(v); writeUiPref('opslog.chasePota', v ? '1' : '0'); }} />
|
||||
{t('clu.chasePota')}
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer" title={t('clu.chaseSotaHint')}>
|
||||
<Checkbox checked={chaseSotaOn}
|
||||
onCheckedChange={(c) => { const v = !!c; setChaseSotaOn(v); writeUiPref('opslog.chaseSota', v ? '1' : '0'); }} />
|
||||
{t('clu.chaseSota')}
|
||||
</label>
|
||||
<label className="flex items-start gap-2 text-sm cursor-pointer">
|
||||
<Checkbox checked={chaseGrids} className="mt-0.5"
|
||||
onCheckedChange={(c) => { setChaseGrids(!!c); SetChaseNewGrids(!!c).catch(() => {}); }} />
|
||||
@@ -6777,7 +6795,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
useLocalLogbook(); // SQLite → default logbook file (clears any per-profile path)
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="h-8 w-72"><SelectValue /></SelectTrigger>
|
||||
<SelectTrigger className="h-8 w-72" title={t('gen.iaruHint')}><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="sqlite">{t('db.optSqlite')}</SelectItem>
|
||||
<SelectItem value="mysql">{t('db.optMysql')}</SelectItem>
|
||||
@@ -7147,7 +7165,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
const { lang, setLang, t } = useI18n();
|
||||
return (
|
||||
<>
|
||||
<SectionHeader title={t('sec.general')} hint={t('gen.hint')} />
|
||||
<SectionHeader title={t('sec.general')} />
|
||||
<div className="space-y-3 max-w-3xl">
|
||||
<div className="flex items-center gap-3">
|
||||
<Label className="text-sm w-40">{t('settings.language')}</Label>
|
||||
@@ -7175,15 +7193,32 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
['us', t('gen.dateUS'), '07-30-2026 14:25']] as [DateFormat, string, string][]).map(([code, label, sample]) => (
|
||||
<button key={code} type="button" title={sample}
|
||||
onClick={() => { setDateFormat(code); setDateFmtSel(code); }}
|
||||
className={cn('flex flex-col items-start px-3 py-1 text-sm font-medium border-l border-border first:border-l-0',
|
||||
className={cn('px-3 py-1.5 text-sm font-medium border-l border-border first:border-l-0',
|
||||
dateFmtSel === code ? 'bg-primary text-primary-foreground' : 'bg-card text-muted-foreground hover:bg-muted')}>
|
||||
{label}
|
||||
<span className="text-[10px] font-mono opacity-70">{sample}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
{/* The IARU region drives the band edges and mode segments the band
|
||||
maps draw — Region 2's 40 m runs to 7300, Region 1's stops at
|
||||
7200 — and nothing else: spots and logging are region-blind. */}
|
||||
<Label className="text-sm w-40 shrink-0">{t('gen.iaruRegion')}</Label>
|
||||
<Select value={String(region)} onValueChange={(v) => {
|
||||
const r = (v === '2' ? 2 : v === '3' ? 3 : 1) as IaruRegion;
|
||||
setRegion(r); setIaruRegion(r);
|
||||
}}>
|
||||
<SelectTrigger className="h-8 w-72"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="1">{t('gen.iaruR1')}</SelectItem>
|
||||
<SelectItem value="2">{t('gen.iaruR2')}</SelectItem>
|
||||
<SelectItem value="3">{t('gen.iaruR3')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<ThemeSelector />
|
||||
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||
@@ -7205,11 +7240,10 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
{/* Super Check Partial / N+1 — downloads the community MASTER.SCP list and
|
||||
shows a two-column callsign helper (partial matches + one-edit calls). */}
|
||||
<div className="border-t border-border/60 pt-3 space-y-2">
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer" title={t('scp.settingsHint')}>
|
||||
<Checkbox checked={scp.enabled} disabled={scpBusy} onCheckedChange={(c) => toggleScp(!!c)} />
|
||||
{t('scp.enable')}
|
||||
</label>
|
||||
<p className="text-[11px] text-muted-foreground">{t('scp.settingsHint')}</p>
|
||||
{scp.enabled && (
|
||||
<div className="flex items-center gap-3">
|
||||
<Button variant="outline" size="sm" onClick={downloadScp} disabled={scpBusy}>
|
||||
@@ -7237,18 +7271,18 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||
<Checkbox checked={groupDigital} onCheckedChange={(c) => { const v = !!c; setGroupDigital(v); writeUiPref('opslog.groupDigitalSlots', v ? '1' : '0'); }} />
|
||||
{t('gen.groupDigital')} <span className="text-xs text-muted-foreground">{t('gen.groupDigitalHint')}</span>
|
||||
<span title={t('gen.groupDigitalHint')}>{t('gen.groupDigital')}</span>
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||
{/* Distances are computed in km everywhere and converted at display
|
||||
time — see lib/units. Changing this repaints the columns that
|
||||
already carry a distance; nothing stored moves. */}
|
||||
<Checkbox checked={milesUnit} onCheckedChange={(c) => { const v = !!c; setMilesUnit(v); setUseMiles(v); }} />
|
||||
{t('gen.miles')} <span className="text-xs text-muted-foreground">{t('gen.milesHint')}</span>
|
||||
{t('gen.miles')}
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||
<Checkbox checked={checkUpdates} onCheckedChange={(c) => { const v = !!c; setCheckUpdates(v); writeUiPref('opslog.checkUpdates', v ? '1' : '0'); }} />
|
||||
{t('gen.checkUpdates')} <span className="text-xs text-muted-foreground">{t('gen.checkUpdatesHint')}</span>
|
||||
{t('gen.checkUpdates')}
|
||||
</label>
|
||||
<TelemetryToggle />
|
||||
|
||||
@@ -7311,12 +7345,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
}}
|
||||
className="mt-0.5"
|
||||
/>
|
||||
<span>
|
||||
{t('gen.clubUse')}
|
||||
<span className="block text-xs text-muted-foreground mt-0.5">
|
||||
{t('gen.clubDesc')}
|
||||
</span>
|
||||
</span>
|
||||
<span title={t('gen.clubDesc')}>{t('gen.clubUse')}</span>
|
||||
</label>
|
||||
<div className="flex items-center gap-3 pl-6">
|
||||
<Button variant="outline" size="sm" className="h-8" disabled={clubBusy}
|
||||
|
||||
@@ -0,0 +1,417 @@
|
||||
// Watchlist — the DXHunter concept as an OpsLog tab.
|
||||
//
|
||||
// One card per watched callsign (or prefix), the live spots that match it
|
||||
// underneath, and the two questions an operator actually asks answered on every
|
||||
// line: is this slot still NEEDED, and what would it be worth (the same NEW
|
||||
// DXCC / band / mode / slot badges the cluster shows, resolved from the same
|
||||
// index). A CONTEST entry is judged against the current UTC day — at midnight
|
||||
// everything reads "work today" again; the boundary lives in the backend query,
|
||||
// so there is nothing to reset.
|
||||
//
|
||||
// The design is DXHunter's — the layout, the badges, the wording — repainted in
|
||||
// the app's theme tokens rather than its hard-coded slate/pink.
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Eye, Plus, Trash2, Bell, BellOff, Trophy, Search } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import {
|
||||
WatchlistEntries, WatchlistAdd, WatchlistRemove, WatchlistSetNotify,
|
||||
WatchlistSetContest, WatchlistWorkedSlots,
|
||||
GetWatchlistContestPattern, SetWatchlistContestPattern, OpenExternalURL,
|
||||
} from '../../wailsjs/go/main/App';
|
||||
import { EventsOn } from '../../wailsjs/runtime/runtime';
|
||||
import type { ClusterSpot, SpotStatusEntry } from '@/components/ClusterGrid';
|
||||
import { inferSpotMode, spotStatusKey } from '@/lib/spot';
|
||||
|
||||
interface WLEntry {
|
||||
callsign: string; lastSeenStr: string; addedAt: string; spotCount: number;
|
||||
isContest: boolean; notify: boolean;
|
||||
isExpedition: boolean; clubLogQSOs24h: number; clubLogTotalQSOs: number;
|
||||
clubLogHasOQRS: boolean; clubLogLiveStream: boolean;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
spots: ClusterSpot[];
|
||||
spotStatus: Record<string, SpotStatusEntry>;
|
||||
onSpotSelect?: (s: ClusterSpot) => void;
|
||||
onSpotClick?: (s: ClusterSpot) => void;
|
||||
}
|
||||
|
||||
// A spot is ON AIR for the badge while its last sighting is this fresh.
|
||||
const ON_AIR_MS = 10 * 60 * 1000;
|
||||
|
||||
// Exact unless the entry carries a trailing * — the same rule the backend's
|
||||
// Match applies to the live stream, mirrored so the tab and the alerts can
|
||||
// never disagree about what an entry covers.
|
||||
function matchesEntry(call: string, pattern: string): boolean {
|
||||
const c = call.toUpperCase();
|
||||
if (pattern.endsWith('*')) {
|
||||
const p = pattern.slice(0, -1);
|
||||
return p !== '' && c.startsWith(p);
|
||||
}
|
||||
return c === pattern;
|
||||
}
|
||||
|
||||
export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: Props) {
|
||||
const { t } = useI18n();
|
||||
const [entries, setEntries] = useState<WLEntry[]>([]);
|
||||
const [addCall, setAddCall] = useState('');
|
||||
const [addContest, setAddContest] = useState(false);
|
||||
const [search, setSearch] = useState('');
|
||||
// The filters survive leaving the tab: the component unmounts on every tab
|
||||
// switch, and filters that reset each time are filters nobody trusts.
|
||||
const [neededOnly, setNeededOnlyRaw] = useState(() => localStorage.getItem('opslog.wlNeededOnly') === '1');
|
||||
const [activeOnly, setActiveOnlyRaw] = useState(() => localStorage.getItem('opslog.wlActiveOnly') === '1');
|
||||
const [family, setFamilyRaw] = useState<'all' | 'normal' | 'contest'>(() => {
|
||||
const v = localStorage.getItem('opslog.wlFamily');
|
||||
return v === 'normal' || v === 'contest' ? v : 'all';
|
||||
});
|
||||
const setNeededOnly = (f: (v: boolean) => boolean) => setNeededOnlyRaw((v) => { const nv = f(v); try { localStorage.setItem('opslog.wlNeededOnly', nv ? '1' : '0'); } catch {} return nv; });
|
||||
const setActiveOnly = (f: (v: boolean) => boolean) => setActiveOnlyRaw((v) => { const nv = f(v); try { localStorage.setItem('opslog.wlActiveOnly', nv ? '1' : '0'); } catch {} return nv; });
|
||||
const setFamily = (v: 'all' | 'normal' | 'contest') => { setFamilyRaw(v); try { localStorage.setItem('opslog.wlFamily', v); } catch {} };
|
||||
// Mode filter — DXHunter's "All Modes" select. DIGI matches the digital class
|
||||
// (FT8, FT4, a generic DATA spot…), the named modes match exactly.
|
||||
const [modeFilter, setModeFilterRaw] = useState(() => localStorage.getItem('opslog.wlMode') || 'ALL');
|
||||
const setModeFilter = (v: string) => { setModeFilterRaw(v); try { localStorage.setItem('opslog.wlMode', v); } catch {} };
|
||||
const modeMatches = (s2: ClusterSpot): boolean => {
|
||||
if (modeFilter === 'ALL') return true;
|
||||
const m = (inferSpotMode(s2.comment ?? '', s2.freq_hz) || '').toUpperCase();
|
||||
if (modeFilter === 'DIGI') return !['', 'CW', 'SSB', 'USB', 'LSB', 'FM', 'AM'].includes(m);
|
||||
if (modeFilter === 'SSB') return m === 'SSB' || m === 'USB' || m === 'LSB';
|
||||
return m === modeFilter;
|
||||
};
|
||||
const [error, setError] = useState('');
|
||||
// A quiet confirmation under the toolbar; both messages clear themselves —
|
||||
// a stale "added" from ten minutes ago reads as a fresh one.
|
||||
const [notice, setNotice] = useState('');
|
||||
const noticeTimer = useRef<number | undefined>(undefined);
|
||||
const flash = (msg: string, isError: boolean) => {
|
||||
if (noticeTimer.current) window.clearTimeout(noticeTimer.current);
|
||||
setError(isError ? msg : '');
|
||||
setNotice(isError ? '' : msg);
|
||||
noticeTimer.current = window.setTimeout(() => { setError(''); setNotice(''); }, 4000) as unknown as number;
|
||||
};
|
||||
|
||||
// worked answer per "call|band|modeclass|contest" key.
|
||||
const [worked, setWorked] = useState<Record<string, boolean>>({});
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
try { setEntries(((await WatchlistEntries()) ?? []) as any as WLEntry[]); }
|
||||
catch (e: any) { setError(String(e?.message ?? e)); }
|
||||
}, []);
|
||||
// Refreshed on mount, when the backend auto-adds (event), and on a slow tick
|
||||
// so last-seen and the spot counters stay honest while the tab sits open.
|
||||
useEffect(() => {
|
||||
void refresh();
|
||||
const off = EventsOn('watchlist:changed', () => { void refresh(); });
|
||||
const id = window.setInterval(() => { void refresh(); }, 30_000);
|
||||
return () => { off(); window.clearInterval(id); };
|
||||
}, [refresh]);
|
||||
// The auto-contest pattern (DXHunter's contest_prefix): spots whose call
|
||||
// contains it are added as contest entries by the backend.
|
||||
const [pattern, setPattern] = useState('');
|
||||
useEffect(() => { GetWatchlistContestPattern().then((p: string) => setPattern(p ?? '')).catch(() => {}); }, []);
|
||||
|
||||
// Live spots per entry — prefix-matched, newest first, deduped per band+mode
|
||||
// (one line per slot; the freshest spot represents it).
|
||||
const spotsFor = useMemo(() => {
|
||||
const map = new Map<string, ClusterSpot[]>();
|
||||
for (const e of entries) map.set(e.callsign, []);
|
||||
for (const s of spots) {
|
||||
for (const e of entries) {
|
||||
if (matchesEntry(s.dx_call ?? '', e.callsign)) { map.get(e.callsign)!.push(s); break; }
|
||||
}
|
||||
}
|
||||
for (const [k, list] of map) {
|
||||
const seen = new Set<string>();
|
||||
map.set(k, list.filter((s) => {
|
||||
const key = `${(s.band ?? '')}|${inferSpotMode(s.comment ?? '', s.freq_hz)}|${s.dx_call}`;
|
||||
if (seen.has(key)) return false;
|
||||
seen.add(key);
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
return map;
|
||||
}, [spots, entries]);
|
||||
|
||||
// The worked answers, refreshed when the visible slots change. Debounced: a
|
||||
// spot burst must cost one round trip, not one per spot.
|
||||
const queryTimer = useRef<number | undefined>(undefined);
|
||||
useEffect(() => {
|
||||
if (queryTimer.current) window.clearTimeout(queryTimer.current);
|
||||
queryTimer.current = window.setTimeout(async () => {
|
||||
const queries: { call: string; band: string; mode: string; contest: boolean }[] = [];
|
||||
const keys: string[] = [];
|
||||
for (const e of entries) {
|
||||
for (const s of spotsFor.get(e.callsign) ?? []) {
|
||||
const mode = inferSpotMode(s.comment ?? '', s.freq_hz) || '';
|
||||
queries.push({ call: s.dx_call, band: s.band ?? '', mode, contest: e.isContest });
|
||||
keys.push(`${s.dx_call}|${s.band ?? ''}|${mode}|${e.isContest ? 1 : 0}`);
|
||||
}
|
||||
}
|
||||
if (queries.length === 0) { setWorked({}); return; }
|
||||
try {
|
||||
const res: boolean[] = (await WatchlistWorkedSlots(queries as any)) ?? [];
|
||||
// MERGED, not replaced: replacing made every already-answered key
|
||||
// momentarily unknown on each refresh, which re-hid settled lines.
|
||||
setWorked((prev) => {
|
||||
const next = { ...prev };
|
||||
keys.forEach((k, i) => { next[k] = !!res[i]; });
|
||||
return next;
|
||||
});
|
||||
} catch { /* the badges just stay conservative */ }
|
||||
}, 150) as unknown as number;
|
||||
return () => { if (queryTimer.current) window.clearTimeout(queryTimer.current); };
|
||||
}, [spotsFor, entries]);
|
||||
|
||||
const wkey = (e: WLEntry, s: ClusterSpot) =>
|
||||
`${s.dx_call}|${s.band ?? ''}|${inferSpotMode(s.comment ?? '', s.freq_hz) || ''}|${e.isContest ? 1 : 0}`;
|
||||
const workedFor = (e: WLEntry, s: ClusterSpot): boolean => worked[wkey(e, s)] ?? false;
|
||||
// A spot whose verdict has not come back yet is NOT drawn. Showing it as
|
||||
// Needed and withdrawing it half a second later made the list twitch on
|
||||
// every burst — and nobody needs a spot 400 ms early, they need it settled.
|
||||
const settled = (e: WLEntry, s: ClusterSpot): boolean => wkey(e, s) in worked;
|
||||
|
||||
const add = async () => {
|
||||
const c = addCall.trim().toUpperCase();
|
||||
if (!c) return;
|
||||
try {
|
||||
await WatchlistAdd(c, addContest);
|
||||
setAddCall('');
|
||||
flash(t(addContest ? 'wl.addedContest' : 'wl.added', { call: c }), false);
|
||||
await refresh();
|
||||
} catch (e: any) { flash(String(e?.message ?? e), true); }
|
||||
};
|
||||
|
||||
// One click, like the bell and the trophy beside it: removing a watchlist
|
||||
// entry is cheap to undo (type it again), so it does not earn a confirmation
|
||||
// the other two buttons do not have.
|
||||
const remove = async (call: string) => {
|
||||
try { await WatchlistRemove(call); flash(t('wl.removed', { call }), false); await refresh(); }
|
||||
catch (e: any) { flash(String(e?.message ?? e), true); }
|
||||
};
|
||||
|
||||
const isOnAir = (e: WLEntry): boolean =>
|
||||
(spotsFor.get(e.callsign) ?? []).some((s) => {
|
||||
const ts = Date.parse(String((s as any).received_at ?? ''));
|
||||
return ts > 0 && Date.now() - ts < ON_AIR_MS;
|
||||
});
|
||||
|
||||
const shown = entries.filter((e) => {
|
||||
if (family === 'normal' && e.isContest) return false;
|
||||
if (family === 'contest' && !e.isContest) return false;
|
||||
if (search && !e.callsign.includes(search.trim().toUpperCase())) return false;
|
||||
const list = (spotsFor.get(e.callsign) ?? []).filter(modeMatches).filter((s2) => settled(e, s2));
|
||||
if (activeOnly && list.length === 0) return false;
|
||||
if (neededOnly && !list.some((s2) => !workedFor(e, s2))) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
const counters = useMemo(() => {
|
||||
let active = 0, needed = 0;
|
||||
for (const e of entries) {
|
||||
const list = (spotsFor.get(e.callsign) ?? []).filter(modeMatches).filter((s2) => settled(e, s2));
|
||||
if (list.length > 0) active++;
|
||||
if (list.some((s2) => !workedFor(e, s2))) needed++;
|
||||
}
|
||||
return { total: entries.length, active, needed };
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [entries, spotsFor, worked, modeFilter]);
|
||||
|
||||
// The cluster's own badge for a spot, read from the shared status index.
|
||||
const dxccBadge = (s: ClusterSpot): { label: string; color: string } | null => {
|
||||
const st = spotStatus[spotStatusKey(s.dx_call, s.band ?? '', s.comment ?? '', s.freq_hz)];
|
||||
switch (st?.status) {
|
||||
case 'new': return { label: t('wl.newDxcc'), color: 'var(--danger)' };
|
||||
case 'new-band-mode': return { label: t('clg2.newBandMode'), color: 'var(--danger)' };
|
||||
case 'new-band': return { label: t('clg2.newBand'), color: 'var(--warning)' };
|
||||
case 'new-mode': return { label: t('clg2.newMode'), color: 'var(--caution)' };
|
||||
case 'new-slot': return { label: t('clg2.newSlot'), color: '#5AC8FA' };
|
||||
default: return null;
|
||||
}
|
||||
};
|
||||
|
||||
const chip = (color: string, text: string, extra?: string) => (
|
||||
<span className={cn('px-1.5 py-0.5 rounded text-[10px] font-bold border', extra)}
|
||||
style={{ color, borderColor: `color-mix(in srgb, ${color} 40%, transparent)`, background: `color-mix(in srgb, ${color} 12%, transparent)` }}>
|
||||
{text}
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
// Capped and centred: a card is a reading surface, and callsign-to-badge
|
||||
// lines stretched across a 34-inch window are not readable, they are long.
|
||||
<div className="flex flex-col min-h-0 flex-1 gap-2 p-2 w-full max-w-5xl mx-auto">
|
||||
{/* Header: the counters alone, centred — they are the tab's headline.
|
||||
Everything one INTERACTS with lives on the second row. */}
|
||||
<div className="flex items-center justify-center gap-2 text-sm text-muted-foreground">
|
||||
<Eye className="size-4 text-primary shrink-0" />
|
||||
<span>
|
||||
{t('wl.cTotal')} <b className="text-foreground">{counters.total}</b>
|
||||
<span className="mx-1.5 opacity-50">|</span>
|
||||
{t('wl.cActive')} <b className="text-info">{counters.active}</b>
|
||||
<span className="mx-1.5 opacity-50">|</span>
|
||||
{t('wl.cNeeded')} <b className="text-warning">{counters.needed}</b>
|
||||
</span>
|
||||
</div>
|
||||
{/* toolbar */}
|
||||
<div className="flex items-start justify-between gap-x-3 gap-y-1.5 flex-wrap">
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
<Input className="h-8 w-40 font-mono placeholder:font-sans placeholder:normal-case" placeholder={t('wl.addPh')} value={addCall}
|
||||
onChange={(e) => setAddCall(e.target.value.toUpperCase())}
|
||||
onKeyDown={(e) => { if (e.key === 'Enter') void add(); }} />
|
||||
<label className="flex items-center gap-1.5 text-xs cursor-pointer" title={t('wl.contestHint')}>
|
||||
<Checkbox checked={addContest} onCheckedChange={(c) => setAddContest(!!c)} />
|
||||
<Trophy className="size-3.5 text-warning" /> {t('wl.addAsContest')}
|
||||
</label>
|
||||
<Button size="sm" className="h-8" onClick={() => void add()} disabled={!addCall.trim()}>
|
||||
<Plus className="size-3.5" /> {t('wl.add')}
|
||||
</Button>
|
||||
<Input className="h-8 w-28 font-mono placeholder:font-sans placeholder:normal-case" placeholder={t('wl.patternPh')}
|
||||
title={t('wl.patternHint')}
|
||||
value={pattern}
|
||||
onChange={(e) => setPattern(e.target.value.toUpperCase())}
|
||||
onBlur={() => { void SetWatchlistContestPattern(pattern.trim()); }} />
|
||||
</div>
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
<div className="relative">
|
||||
<Search className="size-3.5 absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground" />
|
||||
<Input className="h-8 w-28 pl-7 text-sm" placeholder={t('wl.searchPh')} value={search}
|
||||
onChange={(e) => setSearch(e.target.value)} />
|
||||
</div>
|
||||
{/* families kept together, told apart — per review of the DXHunter port,
|
||||
no global contest mode: each entry carries its own rule. */}
|
||||
<div className="inline-flex rounded-md border border-border overflow-hidden text-xs">
|
||||
{([['all', t('wl.famAll')], ['normal', t('wl.famNormal')], ['contest', t('wl.famContest')]] as const).map(([k, label]) => (
|
||||
<button key={k} type="button" onClick={() => setFamily(k)}
|
||||
className={cn('px-2 py-1 border-l border-border first:border-l-0',
|
||||
family === k ? 'bg-accent font-medium' : 'text-muted-foreground hover:bg-accent/50')}>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<select value={modeFilter} onChange={(e) => setModeFilter(e.target.value)}
|
||||
title={t('wl.modeFilter')}
|
||||
className="h-7 px-1.5 rounded-md border border-border bg-background text-xs text-foreground">
|
||||
{['ALL', 'CW', 'SSB', 'FT8', 'FT4', 'RTTY', 'DIGI'].map((m) => (
|
||||
<option key={m} value={m}>{m === 'ALL' ? t('wl.allModes') : m}</option>
|
||||
))}
|
||||
</select>
|
||||
<button type="button" onClick={() => setActiveOnly((v) => !v)}
|
||||
className={cn('px-2 py-1 rounded-md border text-xs', activeOnly ? 'bg-accent border-border font-medium' : 'border-border text-muted-foreground hover:bg-accent/50')}>
|
||||
{t('wl.activeOnly')}
|
||||
</button>
|
||||
<button type="button" onClick={() => setNeededOnly((v) => !v)}
|
||||
className={cn('px-2 py-1 rounded-md border text-xs', neededOnly ? 'bg-accent border-border font-medium' : 'border-border text-muted-foreground hover:bg-accent/50')}>
|
||||
{t('wl.neededOnly')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{error && <div className="text-xs text-danger px-1">{error}</div>}
|
||||
{notice && <div className="text-xs text-success px-1">{notice}</div>}
|
||||
|
||||
{/* cards */}
|
||||
<div className="flex-1 min-h-0 overflow-y-auto space-y-2 pr-1">
|
||||
{shown.length === 0 ? (
|
||||
<div className="text-sm text-muted-foreground text-center pt-16 max-w-md mx-auto leading-relaxed">
|
||||
{entries.length === 0 ? t('wl.empty') : t('wl.noneMatch')}
|
||||
</div>
|
||||
) : shown.map((e) => {
|
||||
const all = (spotsFor.get(e.callsign) ?? []).filter(modeMatches).filter((s2) => settled(e, s2));
|
||||
const needed = all.filter((s) => !workedFor(e, s)).length;
|
||||
// Needed-only hides the worked LINES as well as the all-worked cards:
|
||||
// a filter that says needed and still lists five green Worked rows is
|
||||
// answering a different question than the one asked.
|
||||
const list = neededOnly ? all.filter((s) => !workedFor(e, s)) : all;
|
||||
return (
|
||||
<div key={e.callsign}
|
||||
className={cn('rounded-lg border bg-card p-3',
|
||||
needed > 0 ? 'border-warning/50' : 'border-border',
|
||||
e.isContest && 'border-l-4 border-l-warning')}>
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<span className="text-lg font-bold font-mono text-primary">{e.callsign}</span>
|
||||
{isOnAir(e) && chip('var(--danger)', t('wl.onAir'), 'animate-pulse')}
|
||||
{e.isContest && (
|
||||
<span className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-bold bg-warning-muted text-warning-muted-foreground border border-warning-border"
|
||||
title={t('wl.contestHint')}>
|
||||
<Trophy className="size-3" /> {t('wl.contest')}
|
||||
</span>
|
||||
)}
|
||||
{e.isExpedition && chip('var(--chart-5)', t('wl.expedition'))}
|
||||
{e.clubLogTotalQSOs > 0 && <span className="text-[11px] text-muted-foreground">{e.clubLogTotalQSOs.toLocaleString()} QSOs{e.clubLogQSOs24h > 0 ? ` · ${e.clubLogQSOs24h}/24h` : ''}</span>}
|
||||
{e.clubLogHasOQRS && chip('var(--success)', 'OQRS')}
|
||||
{e.clubLogLiveStream && (
|
||||
<a href="#" onClick={(ev) => { ev.preventDefault(); void OpenExternalURL(`https://clublog.org/livestream/${e.callsign.replace('*', '')}`); }}
|
||||
className="px-1.5 py-0.5 rounded text-[10px] font-bold border text-info border-info/40 bg-info/10 hover:bg-info/20">Live</a>
|
||||
)}
|
||||
{list.length > 0 && (needed > 0
|
||||
? chip('var(--warning)', e.isContest ? t('wl.nToday', { n: needed }) : t('wl.nNeeded', { n: needed }))
|
||||
: chip('var(--success)', e.isContest ? t('wl.workedToday') : t('wl.allWorked')))}
|
||||
{e.lastSeenStr && e.lastSeenStr !== 'Never' && (
|
||||
<span className="text-[11px] text-muted-foreground">· {e.lastSeenStr}</span>
|
||||
)}
|
||||
{e.spotCount > 0 && (
|
||||
<span className="text-[11px] text-muted-foreground/70">· {t('wl.totalSpots', { n: e.spotCount })}</span>
|
||||
)}
|
||||
<div className="flex-1" />
|
||||
<button type="button" title={t('wl.toggleContest')}
|
||||
onClick={() => void WatchlistSetContest(e.callsign, !e.isContest).then(refresh)}
|
||||
className={cn('p-1 rounded hover:bg-muted', e.isContest ? 'text-warning' : 'text-muted-foreground/40')}>
|
||||
<Trophy className="size-3.5" />
|
||||
</button>
|
||||
<button type="button" title={e.notify ? t('wl.notifyOff') : t('wl.notifyOn')}
|
||||
onClick={() => void WatchlistSetNotify(e.callsign, !e.notify).then(refresh)}
|
||||
className={cn('p-1 rounded hover:bg-muted', e.notify ? 'text-warning' : 'text-muted-foreground/40')}>
|
||||
{e.notify ? <Bell className="size-3.5" /> : <BellOff className="size-3.5" />}
|
||||
</button>
|
||||
<button type="button" title={t('wl.remove')}
|
||||
onClick={() => void remove(e.callsign)}
|
||||
className="p-1 rounded hover:bg-muted text-muted-foreground/40 hover:text-danger">
|
||||
<Trash2 className="size-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{list.length > 0 ? (
|
||||
<div className="mt-2 space-y-1 max-h-52 overflow-y-auto">
|
||||
{list.slice(0, 12).map((s, i) => {
|
||||
const done = workedFor(e, s);
|
||||
const badge = dxccBadge(s);
|
||||
const mode = inferSpotMode(s.comment ?? '', s.freq_hz);
|
||||
return (
|
||||
<button key={i} type="button"
|
||||
onClick={() => onSpotSelect?.(s)}
|
||||
onDoubleClick={() => onSpotClick?.(s)}
|
||||
title={t('wl.spotTip')}
|
||||
className={cn('w-full flex items-center gap-2 px-2 py-1.5 rounded text-[11px] bg-muted/40 hover:bg-muted text-left',
|
||||
!done && 'border-l-2 border-warning')}>
|
||||
{done && <span className='font-bold shrink-0 text-success'>✓</span>}
|
||||
<span className="font-mono font-bold text-info shrink-0">{s.dx_call}</span>
|
||||
<span className="text-muted-foreground truncate flex-1 min-w-0 max-w-56">{(s as any).country ?? ''}</span>
|
||||
<span className="px-1.5 rounded bg-muted shrink-0">{s.band}</span>
|
||||
{mode && <span className="px-1.5 rounded shrink-0" style={{ color: 'var(--chart-5)', background: 'color-mix(in srgb, var(--chart-5) 12%, transparent)' }}>{mode}</span>}
|
||||
<span className="font-mono text-muted-foreground shrink-0">{(s.freq_hz / 1e6).toFixed(4)}</span>
|
||||
{badge && chip(badge.color, badge.label)}
|
||||
<div className="flex-1" />
|
||||
{done
|
||||
? chip('var(--success)', e.isContest ? t('wl.todayOk') : t('wl.worked'))
|
||||
: chip('var(--warning)', e.isContest ? t('wl.workToday') : t('wl.needed'))}
|
||||
<span className="text-muted-foreground/70 shrink-0">{s.time_utc ?? ''}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="mt-2 text-[11px] text-muted-foreground text-center py-1.5 bg-muted/30 rounded">
|
||||
{t('wl.noSpots')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// IARU band plans, by region.
|
||||
//
|
||||
// The band maps used to carry one hard-coded table — Region 1's — so a US or
|
||||
// Australian operator saw 40 m stop at 7200 while stations sat spotted at 7250,
|
||||
// and the SSB wash started 25 kHz early. The region is a station-level fact the
|
||||
// operator states once (Settings → General); everything drawing a band edge or
|
||||
// a mode segment reads it from here.
|
||||
//
|
||||
// The tables are deliberately coarse: a band map's wash is CONTEXT, not a
|
||||
// regulatory chart. Only the segments that differ between regions in ways an
|
||||
// operator notices are split out; national fine print (US licence classes,
|
||||
// beacon slots) does not belong in a background tint.
|
||||
import { writeUiPref } from '@/lib/uiPref';
|
||||
|
||||
export type IaruRegion = 1 | 2 | 3;
|
||||
export const KEY_IARU_REGION = 'opslog.iaruRegion';
|
||||
|
||||
export function iaruRegion(): IaruRegion {
|
||||
try {
|
||||
const v = localStorage.getItem(KEY_IARU_REGION);
|
||||
return v === '2' ? 2 : v === '3' ? 3 : 1;
|
||||
} catch { return 1; }
|
||||
}
|
||||
|
||||
export function setIaruRegion(r: IaruRegion): void {
|
||||
writeUiPref(KEY_IARU_REGION, String(r));
|
||||
listeners.forEach((l) => l());
|
||||
}
|
||||
|
||||
// The band maps capture the plan inside their render, so a change must reach
|
||||
// them the way the distance unit reaches the grids.
|
||||
const listeners = new Set<() => void>();
|
||||
export function subscribeIaruRegion(fn: () => void): () => void {
|
||||
listeners.add(fn);
|
||||
return () => { listeners.delete(fn); };
|
||||
}
|
||||
|
||||
export type SegMode = 'cw' | 'digi' | 'phone';
|
||||
type Seg = [number, number, SegMode];
|
||||
|
||||
interface Plan {
|
||||
ranges: Record<string, [number, number]>;
|
||||
segments: Record<string, Seg[]>;
|
||||
}
|
||||
|
||||
// Region 1 — Europe / Africa / Middle East / northern Asia. The baseline the
|
||||
// other two override.
|
||||
const R1: Plan = {
|
||||
ranges: {
|
||||
'160m': [1800, 2000], '80m': [3500, 3800], '60m': [5350, 5450],
|
||||
'40m': [7000, 7200], '30m': [10100, 10150], '20m': [14000, 14350],
|
||||
'17m': [18068, 18168], '15m': [21000, 21450], '12m': [24890, 24990],
|
||||
'10m': [28000, 29700], '6m': [50000, 50500], '4m': [70000, 70500],
|
||||
'2m': [144000, 146000], '70cm': [430000, 440000],
|
||||
},
|
||||
segments: {
|
||||
'160m': [[1800, 1838, 'cw'], [1838, 1840, 'digi'], [1840, 2000, 'phone']],
|
||||
'80m': [[3500, 3580, 'cw'], [3580, 3600, 'digi'], [3600, 3800, 'phone']],
|
||||
'60m': [[5350, 5450, 'phone']],
|
||||
'40m': [[7000, 7040, 'cw'], [7040, 7100, 'digi'], [7100, 7200, 'phone']],
|
||||
'30m': [[10100, 10130, 'cw'], [10130, 10150, 'digi']],
|
||||
'20m': [[14000, 14070, 'cw'], [14070, 14100, 'digi'], [14100, 14350, 'phone']],
|
||||
'17m': [[18068, 18095, 'cw'], [18095, 18110, 'digi'], [18110, 18168, 'phone']],
|
||||
'15m': [[21000, 21070, 'cw'], [21070, 21150, 'digi'], [21150, 21450, 'phone']],
|
||||
'12m': [[24890, 24915, 'cw'], [24915, 24940, 'digi'], [24940, 24990, 'phone']],
|
||||
'10m': [[28000, 28070, 'cw'], [28070, 28300, 'digi'], [28300, 29700, 'phone']],
|
||||
'6m': [[50000, 50100, 'cw'], [50100, 50500, 'phone']],
|
||||
},
|
||||
};
|
||||
|
||||
// Region 2 — the Americas. 80 m runs to 4000 and 40 m to 7300, with phone from
|
||||
// 7125 (the whole point of asking the region: a KP4 ragchew on 7250 must not
|
||||
// hang past the top of the map).
|
||||
const R2: Plan = {
|
||||
ranges: {
|
||||
...R1.ranges,
|
||||
'80m': [3500, 4000], '40m': [7000, 7300],
|
||||
'6m': [50000, 54000], '2m': [144000, 148000], '70cm': [420000, 450000],
|
||||
},
|
||||
segments: {
|
||||
...R1.segments,
|
||||
'80m': [[3500, 3570, 'cw'], [3570, 3600, 'digi'], [3600, 4000, 'phone']],
|
||||
'40m': [[7000, 7040, 'cw'], [7040, 7125, 'digi'], [7125, 7300, 'phone']],
|
||||
'6m': [[50000, 50100, 'cw'], [50100, 54000, 'phone']],
|
||||
},
|
||||
};
|
||||
|
||||
// Region 3 — Asia-Pacific. 80 m to 3900; 40 m as Region 1's shape.
|
||||
const R3: Plan = {
|
||||
ranges: {
|
||||
...R1.ranges,
|
||||
'80m': [3500, 3900],
|
||||
'6m': [50000, 54000], '2m': [144000, 148000], '70cm': [430000, 450000],
|
||||
},
|
||||
segments: {
|
||||
...R1.segments,
|
||||
'80m': [[3500, 3535, 'cw'], [3535, 3600, 'digi'], [3600, 3900, 'phone']],
|
||||
'6m': [[50000, 50100, 'cw'], [50100, 54000, 'phone']],
|
||||
},
|
||||
};
|
||||
|
||||
function plan(): Plan {
|
||||
const r = iaruRegion();
|
||||
return r === 2 ? R2 : r === 3 ? R3 : R1;
|
||||
}
|
||||
|
||||
export function bandRange(band: string): [number, number] | undefined {
|
||||
return plan().ranges[band];
|
||||
}
|
||||
|
||||
export function bandSegments(band: string): Seg[] {
|
||||
return plan().segments[band] ?? [];
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -11,7 +11,25 @@
|
||||
//
|
||||
// They compose deliberately: mute what is done, light up what is not.
|
||||
|
||||
export type SpotDisplayOptions = { muteWorked: boolean; slotHighlight: boolean };
|
||||
export type SpotDisplayOptions = {
|
||||
muteWorked: boolean; slotHighlight: boolean;
|
||||
// Chase switches (Settings → DX Cluster), ON by default. An operator who does
|
||||
// not chase parks does not want NEW POTA shouting from every activator spot:
|
||||
// off, the marker is withdrawn at the display layer — a "new band + new POTA"
|
||||
// spot simply reads NEW BAND — and the reference column goes quiet. The facts
|
||||
// keep being computed; only the telling stops, so ticking the box back on
|
||||
// needs no rescan.
|
||||
chasePota: boolean; chaseSota: boolean;
|
||||
};
|
||||
|
||||
// chasePota/chaseSota read the switches directly — for the places that show a
|
||||
// REFERENCE rather than a status (the POTA and SOTA columns).
|
||||
export function chasePota(): boolean {
|
||||
try { return localStorage.getItem('opslog.chasePota') !== '0'; } catch { return true; }
|
||||
}
|
||||
export function chaseSota(): boolean {
|
||||
try { return localStorage.getItem('opslog.chaseSota') !== '0'; } catch { return true; }
|
||||
}
|
||||
|
||||
// Both options are withdrawn from the filter panel for now. The machinery below
|
||||
// is deliberately kept whole — it is correct and hard-won — so putting the two
|
||||
@@ -23,14 +41,19 @@ export type SpotDisplayOptions = { muteWorked: boolean; slotHighlight: boolean }
|
||||
export const SPOT_DISPLAY_OPTIONS_EXPOSED = false;
|
||||
|
||||
export function readSpotDisplayOptions(): SpotDisplayOptions {
|
||||
if (!SPOT_DISPLAY_OPTIONS_EXPOSED) return { muteWorked: false, slotHighlight: false };
|
||||
// The EXPOSED flag only withdraws the two original switches; the chase
|
||||
// switches are live regardless.
|
||||
if (!SPOT_DISPLAY_OPTIONS_EXPOSED) {
|
||||
return { muteWorked: false, slotHighlight: false, chasePota: chasePota(), chaseSota: chaseSota() };
|
||||
}
|
||||
try {
|
||||
return {
|
||||
muteWorked: localStorage.getItem('opslog.clusterMuteWorked') === '1',
|
||||
slotHighlight: localStorage.getItem('opslog.clusterSlotHighlight') === '1',
|
||||
chasePota: chasePota(), chaseSota: chaseSota(),
|
||||
};
|
||||
} catch {
|
||||
return { muteWorked: false, slotHighlight: false };
|
||||
return { muteWorked: false, slotHighlight: false, chasePota: true, chaseSota: true };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +95,9 @@ export function applySpotDisplay<T extends Entry>(s: T, o: SpotDisplayOptions):
|
||||
if (o.muteWorked) {
|
||||
e = { ...e, worked_call: false } as NonNullable<T>;
|
||||
}
|
||||
if (!o.chasePota && e.new_pota) {
|
||||
e = { ...e, new_pota: false } as NonNullable<T>;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ const PORTABLE_KEYS = [
|
||||
'opslog.clusterLockBand', 'opslog.clusterLockMode', 'opslog.clusterStatusFilter',
|
||||
'opslog.clusterModeFilter', 'opslog.clusterSearch', 'opslog.clusterHideWorked',
|
||||
'opslog.distanceMiles', // distances shown in statute miles rather than km
|
||||
'opslog.iaruRegion', // IARU region (1/2/3) — band edges and segments on the band maps
|
||||
'opslog.chasePota', // show POTA references and the NEW POTA marker on spots
|
||||
'opslog.chaseSota', // show SOTA references on spots
|
||||
'opslog.activeTab', // last selected tab
|
||||
'opslog.mainSplit', // Main tab: width share of the left pane (percent) — legacy, read once to seed mainShares
|
||||
'opslog.mainShares', // Main tab: column shares per column count, as {2:[..],3:[..],4:[..]}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Single source of truth for the app version shown in the UI (header + About).
|
||||
// Bump this on a release (the release script updates it alongside telemetry.go).
|
||||
export const APP_VERSION = '0.26.22';
|
||||
export const APP_VERSION = '0.27.0';
|
||||
|
||||
// Author / credits, shown in Help -> About.
|
||||
export const APP_AUTHOR = 'F4BPO';
|
||||
|
||||
Vendored
+23
@@ -30,6 +30,7 @@ import {lotwusers} from '../models';
|
||||
import {lookup} from '../models';
|
||||
import {netctl} from '../models';
|
||||
import {scp} from '../models';
|
||||
import {watchlist} from '../models';
|
||||
|
||||
export function ACOMSetOperate(arg1:boolean):Promise<void>;
|
||||
|
||||
@@ -45,6 +46,8 @@ export function ActivateProfile(arg1:number):Promise<void>;
|
||||
|
||||
export function ActiveRadioID():Promise<string>;
|
||||
|
||||
export function ActiveRadioMyRig():Promise<string>;
|
||||
|
||||
export function AddQSO(arg1:qso.QSO):Promise<number>;
|
||||
|
||||
export function AmpFanMode(arg1:string,arg2:string):Promise<void>;
|
||||
@@ -601,6 +604,8 @@ export function GetUltrabeamSettings():Promise<main.UltrabeamSettings>;
|
||||
|
||||
export function GetUltrabeamStatus():Promise<main.UltrabeamStatusInfo>;
|
||||
|
||||
export function GetWatchlistContestPattern():Promise<string>;
|
||||
|
||||
export function GetWebPublishConfig():Promise<webpub.Config>;
|
||||
|
||||
export function GetWebPublishStatus():Promise<main.WebPublishStatus>;
|
||||
@@ -1145,6 +1150,8 @@ export function SetKenwoodNB(arg1:boolean):Promise<void>;
|
||||
|
||||
export function SetKenwoodNR(arg1:boolean):Promise<void>;
|
||||
|
||||
export function SetKenwoodPanelMode(arg1:string):Promise<void>;
|
||||
|
||||
export function SetKenwoodPower(arg1:number):Promise<void>;
|
||||
|
||||
export function SetKenwoodPreamp(arg1:boolean):Promise<void>;
|
||||
@@ -1153,6 +1160,8 @@ export function SetKenwoodRFGain(arg1:number):Promise<void>;
|
||||
|
||||
export function SetKenwoodRIT(arg1:boolean):Promise<void>;
|
||||
|
||||
export function SetKenwoodRITOffset(arg1:number):Promise<void>;
|
||||
|
||||
export function SetKenwoodSquelch(arg1:number):Promise<void>;
|
||||
|
||||
export function SetKenwoodTX(arg1:boolean):Promise<void>;
|
||||
@@ -1223,6 +1232,8 @@ export function SetUIPref(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function SetUltrabeamDirection(arg1:number):Promise<void>;
|
||||
|
||||
export function SetWatchlistContestPattern(arg1:string):Promise<void>;
|
||||
|
||||
export function SetWinkeyerTrace(arg1:boolean):Promise<void>;
|
||||
|
||||
export function SetWorkedCallVariants(arg1:boolean):Promise<void>;
|
||||
@@ -1353,6 +1364,18 @@ export function UploadCallsign(arg1:string):Promise<string>;
|
||||
|
||||
export function UploadQSOsManual(arg1:string,arg2:Array<number>):Promise<void>;
|
||||
|
||||
export function WatchlistAdd(arg1:string,arg2:boolean):Promise<void>;
|
||||
|
||||
export function WatchlistEntries():Promise<Array<watchlist.Entry>>;
|
||||
|
||||
export function WatchlistRemove(arg1:string):Promise<void>;
|
||||
|
||||
export function WatchlistSetContest(arg1:string,arg2:boolean):Promise<void>;
|
||||
|
||||
export function WatchlistSetNotify(arg1:string,arg2:boolean):Promise<void>;
|
||||
|
||||
export function WatchlistWorkedSlots(arg1:Array<main.WatchlistSlotQuery>):Promise<Array<boolean>>;
|
||||
|
||||
export function WebPublishColumns():Promise<Array<Record<string, string>>>;
|
||||
|
||||
export function WinkeyerBackspace():Promise<void>;
|
||||
|
||||
@@ -30,6 +30,10 @@ export function ActiveRadioID() {
|
||||
return window['go']['main']['App']['ActiveRadioID']();
|
||||
}
|
||||
|
||||
export function ActiveRadioMyRig() {
|
||||
return window['go']['main']['App']['ActiveRadioMyRig']();
|
||||
}
|
||||
|
||||
export function AddQSO(arg1) {
|
||||
return window['go']['main']['App']['AddQSO'](arg1);
|
||||
}
|
||||
@@ -1142,6 +1146,10 @@ export function GetUltrabeamStatus() {
|
||||
return window['go']['main']['App']['GetUltrabeamStatus']();
|
||||
}
|
||||
|
||||
export function GetWatchlistContestPattern() {
|
||||
return window['go']['main']['App']['GetWatchlistContestPattern']();
|
||||
}
|
||||
|
||||
export function GetWebPublishConfig() {
|
||||
return window['go']['main']['App']['GetWebPublishConfig']();
|
||||
}
|
||||
@@ -2230,6 +2238,10 @@ export function SetKenwoodNR(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodNR'](arg1);
|
||||
}
|
||||
|
||||
export function SetKenwoodPanelMode(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodPanelMode'](arg1);
|
||||
}
|
||||
|
||||
export function SetKenwoodPower(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodPower'](arg1);
|
||||
}
|
||||
@@ -2246,6 +2258,10 @@ export function SetKenwoodRIT(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodRIT'](arg1);
|
||||
}
|
||||
|
||||
export function SetKenwoodRITOffset(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodRITOffset'](arg1);
|
||||
}
|
||||
|
||||
export function SetKenwoodSquelch(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodSquelch'](arg1);
|
||||
}
|
||||
@@ -2386,6 +2402,10 @@ export function SetUltrabeamDirection(arg1) {
|
||||
return window['go']['main']['App']['SetUltrabeamDirection'](arg1);
|
||||
}
|
||||
|
||||
export function SetWatchlistContestPattern(arg1) {
|
||||
return window['go']['main']['App']['SetWatchlistContestPattern'](arg1);
|
||||
}
|
||||
|
||||
export function SetWinkeyerTrace(arg1) {
|
||||
return window['go']['main']['App']['SetWinkeyerTrace'](arg1);
|
||||
}
|
||||
@@ -2646,6 +2666,30 @@ export function UploadQSOsManual(arg1, arg2) {
|
||||
return window['go']['main']['App']['UploadQSOsManual'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function WatchlistAdd(arg1, arg2) {
|
||||
return window['go']['main']['App']['WatchlistAdd'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function WatchlistEntries() {
|
||||
return window['go']['main']['App']['WatchlistEntries']();
|
||||
}
|
||||
|
||||
export function WatchlistRemove(arg1) {
|
||||
return window['go']['main']['App']['WatchlistRemove'](arg1);
|
||||
}
|
||||
|
||||
export function WatchlistSetContest(arg1, arg2) {
|
||||
return window['go']['main']['App']['WatchlistSetContest'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function WatchlistSetNotify(arg1, arg2) {
|
||||
return window['go']['main']['App']['WatchlistSetNotify'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function WatchlistWorkedSlots(arg1) {
|
||||
return window['go']['main']['App']['WatchlistWorkedSlots'](arg1);
|
||||
}
|
||||
|
||||
export function WebPublishColumns() {
|
||||
return window['go']['main']['App']['WebPublishColumns']();
|
||||
}
|
||||
|
||||
@@ -1072,6 +1072,7 @@ export namespace cat {
|
||||
model?: string;
|
||||
elecraft: boolean;
|
||||
mode?: string;
|
||||
data_sub?: string;
|
||||
transmitting: boolean;
|
||||
split: boolean;
|
||||
split_tx_hz: number;
|
||||
@@ -1108,6 +1109,7 @@ export namespace cat {
|
||||
this.model = source["model"];
|
||||
this.elecraft = source["elecraft"];
|
||||
this.mode = source["mode"];
|
||||
this.data_sub = source["data_sub"];
|
||||
this.transmitting = source["transmitting"];
|
||||
this.split = source["split"];
|
||||
this.split_tx_hz = source["split_tx_hz"];
|
||||
@@ -4299,6 +4301,24 @@ export namespace main {
|
||||
this.text = source["text"];
|
||||
}
|
||||
}
|
||||
export class WatchlistSlotQuery {
|
||||
call: string;
|
||||
band: string;
|
||||
mode: string;
|
||||
contest: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WatchlistSlotQuery(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.call = source["call"];
|
||||
this.band = source["band"];
|
||||
this.mode = source["mode"];
|
||||
this.contest = source["contest"];
|
||||
}
|
||||
}
|
||||
export class WebPublishStatus {
|
||||
last_run: string;
|
||||
last_err: string;
|
||||
@@ -5988,6 +6008,68 @@ export namespace udp {
|
||||
|
||||
}
|
||||
|
||||
export namespace watchlist {
|
||||
|
||||
export class Entry {
|
||||
callsign: string;
|
||||
// Go type: time
|
||||
lastSeen: any;
|
||||
lastSeenStr: string;
|
||||
// Go type: time
|
||||
addedAt: any;
|
||||
spotCount: number;
|
||||
isContest: boolean;
|
||||
notify: boolean;
|
||||
isExpedition: boolean;
|
||||
clubLogQSOs24h: number;
|
||||
clubLogTotalQSOs: number;
|
||||
clubLogHasOQRS: boolean;
|
||||
clubLogLiveStream: boolean;
|
||||
// Go type: time
|
||||
clubLogUpdatedAt?: any;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Entry(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.callsign = source["callsign"];
|
||||
this.lastSeen = this.convertValues(source["lastSeen"], null);
|
||||
this.lastSeenStr = source["lastSeenStr"];
|
||||
this.addedAt = this.convertValues(source["addedAt"], null);
|
||||
this.spotCount = source["spotCount"];
|
||||
this.isContest = source["isContest"];
|
||||
this.notify = source["notify"];
|
||||
this.isExpedition = source["isExpedition"];
|
||||
this.clubLogQSOs24h = source["clubLogQSOs24h"];
|
||||
this.clubLogTotalQSOs = source["clubLogTotalQSOs"];
|
||||
this.clubLogHasOQRS = source["clubLogHasOQRS"];
|
||||
this.clubLogLiveStream = source["clubLogLiveStream"];
|
||||
this.clubLogUpdatedAt = this.convertValues(source["clubLogUpdatedAt"], null);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export namespace webpub {
|
||||
|
||||
export class Config {
|
||||
|
||||
@@ -36,6 +36,7 @@ const (
|
||||
CmdVfoFreq = 0x25 // read a specific VFO's freq (sub 0x00 selected, 0x01 unselected)
|
||||
CmdPTT = 0x1C // sub 0x00 = PTT
|
||||
CmdExtra = 0x1A // sub 0x06 = data mode on modern Icoms
|
||||
CmdModeDataFil = 0x26 // sub 0x00 = selected VFO: mode + data flag + filter in one frame
|
||||
CmdReadID = 0x19 // sub 0x00 = rig's own CI-V address (identifies model)
|
||||
CmdPower = 0x18 // power on/off (sub 0x01 = on, 0x00 = off; on needs an FE wake preamble)
|
||||
|
||||
@@ -130,6 +131,8 @@ const (
|
||||
ModeFM = 0x05
|
||||
ModeCWR = 0x07
|
||||
ModeRTTYR = 0x08
|
||||
ModePSK = 0x12 // native PSK (IC-7610/7760/7851 class; older rigs NAK it)
|
||||
ModePSKR = 0x13
|
||||
)
|
||||
|
||||
// Frame builds a complete CI-V frame (preamble … end) for payload, which is the
|
||||
@@ -305,6 +308,8 @@ func ModeToADIF(m byte, data bool) string {
|
||||
return "CW"
|
||||
case ModeRTTY, ModeRTTYR:
|
||||
return "RTTY"
|
||||
case ModePSK, ModePSKR:
|
||||
return "PSK31"
|
||||
case ModeAM:
|
||||
return "AM"
|
||||
case ModeFM:
|
||||
@@ -357,6 +362,8 @@ func ModelName(addr byte) string {
|
||||
return "IC-9700"
|
||||
case 0xA4:
|
||||
return "IC-705"
|
||||
case 0xB2:
|
||||
return "IC-7760"
|
||||
case 0xB6:
|
||||
return "IC-7300MKII"
|
||||
}
|
||||
|
||||
@@ -28,11 +28,13 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// icaAudioOffset is where the PCM payload begins inside an audio data packet
|
||||
// (wfview audio_packet: 16-byte common header + ident@0x10 + datalen@0x12 +
|
||||
// sendseq@0x14 → audio@0x16). Isolated as a const so a capture-confirmed change
|
||||
// is a one-line edit.
|
||||
const icaAudioOffset = 0x16
|
||||
// icaAudioOffset is where the PCM payload begins inside an audio data packet.
|
||||
// CONFIRMED on a real IC-7760 (2026-08-29): 16-byte common header, ident@0x10,
|
||||
// send seq (BE) @0x12, payload length (BE uint32) @0x14 — 0x500 observed on
|
||||
// every packet — and the PCM starts at 0x18. The 0x16 first guessed from
|
||||
// wfview's struct swallowed two header bytes into the audio, one broken sample
|
||||
// per packet: a 50 Hz click track under everything.
|
||||
const icaAudioOffset = 0x18
|
||||
|
||||
// icaDumpFirst is how many initial audio packets to hex-dump to the debug log for
|
||||
// offset verification. After the layout is confirmed on a real rig this can go to
|
||||
@@ -132,12 +134,19 @@ func (a *icomAudio) audioPump() {
|
||||
case typ == 0x05: // rig-initiated disconnect
|
||||
debugLog.Printf("icom audio: rig sent DISCONNECT — audio stream dropped by the rig")
|
||||
case typ == 0x00 && k > icaAudioOffset: // audio data packet
|
||||
a.trackRxSeq(icnLE.Uint16(buf[6:]))
|
||||
fresh := a.trackRxSeq(icnLE.Uint16(buf[6:]))
|
||||
if a.dumped < icaDumpFirst {
|
||||
a.dumped++
|
||||
debugLog.Printf("icom audio raw #%d: len=%d head=% X", a.dumped, k, buf[:min(icaAudioOffset+8, k)])
|
||||
}
|
||||
if a.sink != nil {
|
||||
// Only a packet that ADVANCES the sequence reaches the sink. A
|
||||
// duplicate or a late retransmit used to be delivered as if it
|
||||
// were the next 20 ms of audio: the monitor's capped ring threw
|
||||
// the surplus away (the speakers stayed clean), but the recorder
|
||||
// keeps every sample it is given — the file grew longer than the
|
||||
// QSO and played back slowed and stuttering, each lost-then-
|
||||
// resent packet heard twice.
|
||||
if fresh && a.sink != nil {
|
||||
payload := append([]byte(nil), buf[icaAudioOffset:k]...)
|
||||
a.sink(payload)
|
||||
}
|
||||
@@ -157,26 +166,36 @@ func (a *icomAudio) audioPump() {
|
||||
// trackRxSeq / sendRetransmitReq mirror icomNet's receive-side retransmit exactly
|
||||
// (audio is as loss-sensitive as the scope stream). Duplicated deliberately so
|
||||
// the audio stream owns its own seq state with no shared locking.
|
||||
func (a *icomAudio) trackRxSeq(seq uint16) {
|
||||
//
|
||||
// The return value says whether this packet moves the stream FORWARD — the
|
||||
// only kind the sink may hear. A duplicate is the same 20 ms again; a late
|
||||
// retransmit would play old audio in the middle of new. Both are accounted
|
||||
// for here and dropped by the caller.
|
||||
func (a *icomAudio) trackRxSeq(seq uint16) bool {
|
||||
if !a.rxHaveSeq {
|
||||
a.rxHaveSeq = true
|
||||
a.rxLastSeq = seq
|
||||
return
|
||||
return true
|
||||
}
|
||||
switch d := int16(seq - a.rxLastSeq); {
|
||||
case d == 0:
|
||||
return false
|
||||
case d < 0:
|
||||
delete(a.rxMissing, seq)
|
||||
return false
|
||||
case d == 1:
|
||||
a.rxLastSeq = seq
|
||||
return true
|
||||
case int(d) <= icnMaxMissing:
|
||||
for f := a.rxLastSeq + 1; f != seq; f++ {
|
||||
a.rxMissing[f] = 0
|
||||
}
|
||||
a.rxLastSeq = seq
|
||||
return true
|
||||
default:
|
||||
a.rxMissing = make(map[uint16]int)
|
||||
a.rxLastSeq = seq
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+123
-5
@@ -56,6 +56,15 @@ func NewIcomNet(host, user, pass string, civAddr int, digitalDefault string, aud
|
||||
model: "Icom",
|
||||
scopeFixed: true,
|
||||
}
|
||||
// lastNetConnect is when the previous session came up, and it drives a
|
||||
// deliberate pause: on a real IC-7760 a session sometimes goes deaf on CI-V
|
||||
// while the rig still holds it half-open, and a session dialled straight
|
||||
// back in answers for a second and is then strangled when the rig finally
|
||||
// purges the old one — reconnect, die, reconnect, die, twenty seconds a
|
||||
// lap and no audio the whole time. When the last session died YOUNG, wait
|
||||
// out the rig's cleanup before dialling again; a session that lived long
|
||||
// reconnects immediately, as ever.
|
||||
var lastNetConnect time.Time
|
||||
b.open = func() (civTransport, error) {
|
||||
if strings.TrimSpace(host) == "" {
|
||||
return nil, fmt.Errorf("no rig host configured")
|
||||
@@ -63,7 +72,20 @@ func NewIcomNet(host, user, pass string, civAddr int, digitalDefault string, aud
|
||||
b.dialMu.Lock()
|
||||
cancel := b.dialCancel
|
||||
b.dialMu.Unlock()
|
||||
return dialIcomNet(host, user, pass, "OpsLog", b.rigAddr, cancel, audioSink)
|
||||
if !lastNetConnect.IsZero() && time.Since(lastNetConnect) < 90*time.Second {
|
||||
debugLog.Printf("icom net: the last session died young — pausing 20 s before redialling so the rig can purge it first")
|
||||
for i := 0; i < 40; i++ {
|
||||
if icnCanceled(cancel) {
|
||||
return nil, errDialCanceled
|
||||
}
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
tr, err := dialIcomNet(host, user, pass, "OpsLog", b.rigAddr, cancel, audioSink)
|
||||
if err == nil {
|
||||
lastNetConnect = time.Now()
|
||||
}
|
||||
return tr, err
|
||||
}
|
||||
return b
|
||||
}
|
||||
@@ -97,6 +119,14 @@ type icomNet struct {
|
||||
// CAT goroutine) and during dial — never by the pump — so no lock is needed.
|
||||
vTracked uint16
|
||||
vCivSeq uint16
|
||||
seqMu sync.Mutex // guards vTracked/vCivSeq: the command loop AND the pump's quiet-recovery both send
|
||||
// txCiv counts CI-V command packets sent, and txAtData snapshots it at the
|
||||
// last received CI-V data. Their difference during a silence answers the
|
||||
// question the reconnects cannot: were we still ASKING when the answers
|
||||
// stopped? Zero writes-since-data would mean the fault is our own poll
|
||||
// loop, not the rig — and RS-BA1 showing no such dropouts points that way.
|
||||
txCiv atomic.Uint32
|
||||
txAtData atomic.Uint32
|
||||
|
||||
rx chan []byte // CI-V byte chunks from civPump → Read (control replies)
|
||||
scopeRx chan []byte // scope (0x27) frames, kept off rx so the panadapter
|
||||
@@ -227,10 +257,13 @@ func (n *icomNet) Write(p []byte) (int, error) {
|
||||
if icnTrace {
|
||||
debugLog.Printf("icom net TX: % X", p)
|
||||
}
|
||||
seq := n.vTracked
|
||||
pkt := icnCivData(seq, n.vID, n.vRemote, n.vCivSeq, p)
|
||||
n.seqMu.Lock()
|
||||
seq, civSeq := n.vTracked, n.vCivSeq
|
||||
n.vTracked++
|
||||
n.vCivSeq++
|
||||
n.seqMu.Unlock()
|
||||
n.txCiv.Add(1)
|
||||
pkt := icnCivData(seq, n.vID, n.vRemote, civSeq, p)
|
||||
n.sentMu.Lock()
|
||||
n.sentBuf[seq] = pkt
|
||||
delete(n.sentBuf, seq-1024) // keep the buffer bounded (~last 1024 packets) so
|
||||
@@ -359,6 +392,17 @@ func (n *icomNet) civPump() {
|
||||
buf := make([]byte, 8192)
|
||||
lastIdle := time.Now()
|
||||
lastReq := time.Now()
|
||||
// Diagnosis for the recurring 2-3-minute silence a real IC-7760 shows on
|
||||
// this stream while the control link stays alive: when the stream has been
|
||||
// quiet for 10 s, say so ONCE, with the last read error — a socket error
|
||||
// and a rig that stopped talking are different repairs, and the 30 s
|
||||
// watchdog that follows cannot tell them apart from where it sits.
|
||||
lastPkt := time.Now()
|
||||
lastData := time.Now() // CI-V payload packets (replies + transceive)
|
||||
lastScope := time.Time{} // scope frames within those
|
||||
var lastErr error
|
||||
quietSaid := false
|
||||
gaveUp := false
|
||||
for {
|
||||
select {
|
||||
case <-n.done:
|
||||
@@ -366,7 +410,14 @@ func (n *icomNet) civPump() {
|
||||
default:
|
||||
}
|
||||
_ = n.civ.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
if k, err := n.civ.Read(buf); err == nil && k >= 16 {
|
||||
k, err := n.civ.Read(buf)
|
||||
if err != nil {
|
||||
if e, ok := err.(net.Error); !ok || !e.Timeout() {
|
||||
lastErr = err // a REAL socket error, not the read deadline
|
||||
}
|
||||
}
|
||||
if err == nil && k >= 16 {
|
||||
lastPkt = time.Now()
|
||||
n.markRx()
|
||||
switch typ := icnLE.Uint16(buf[4:]); {
|
||||
case typ == 0x07: // ping
|
||||
@@ -379,6 +430,12 @@ func (n *icomNet) civPump() {
|
||||
n.dead.Store(true) // make Alive() fail now → prompt clean reconnect
|
||||
debugLog.Printf("icom net: rig sent DISCONNECT on CI-V stream — session dropped by the rig")
|
||||
case typ == 0x00 && k > 0x15 && buf[0x10] == 0xc1: // CI-V data
|
||||
if quietSaid {
|
||||
debugLog.Printf("icom net: CI-V replies are back after %s", time.Since(lastData).Round(time.Second))
|
||||
quietSaid, gaveUp = false, false
|
||||
}
|
||||
lastData = time.Now()
|
||||
n.txAtData.Store(n.txCiv.Load())
|
||||
n.trackRxSeq(icnLE.Uint16(buf[6:])) // note gaps for retransmit
|
||||
civBytes := buf[0x15:k]
|
||||
cp := append([]byte(nil), civBytes...)
|
||||
@@ -388,6 +445,7 @@ func (n *icomNet) civPump() {
|
||||
// feeder in IcomSerial picks them up. Everything else is a control
|
||||
// reply → rx → Read.
|
||||
if len(civBytes) >= 5 && civBytes[4] == 0x27 {
|
||||
lastScope = time.Now()
|
||||
icnEnqueueDrop(n.scopeRx, cp)
|
||||
break
|
||||
}
|
||||
@@ -410,6 +468,40 @@ func (n *icomNet) civPump() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if !quietSaid && time.Since(lastData) > 10*time.Second {
|
||||
quietSaid = true
|
||||
scopeAge := "never"
|
||||
if !lastScope.IsZero() {
|
||||
scopeAge = time.Since(lastScope).Round(time.Second).String()
|
||||
}
|
||||
debugLog.Printf("icom net: no CI-V DATA for 10 s (transport last heard %s ago; last scope frame %s ago; last socket error: %v; missing-seq backlog: %d; CI-V commands SENT since the last answer: %d)",
|
||||
time.Since(lastPkt).Round(time.Second), scopeAge, lastErr, len(n.rxMissing), n.txCiv.Load()-n.txAtData.Load())
|
||||
// And try the gentle repair before the 30 s watchdog tears the whole
|
||||
// session down: if the rig quietly closed the CI-V data flow (the
|
||||
// transport is still chatting, so the session itself stands), saying
|
||||
// "open" again on the same stream is all it should take. Harmless
|
||||
// when the cause is elsewhere — the watchdog still fires at 30 s.
|
||||
n.seqMu.Lock()
|
||||
seq, civSeq := n.vTracked, n.vCivSeq
|
||||
n.vTracked++
|
||||
n.vCivSeq++
|
||||
n.seqMu.Unlock()
|
||||
ocPkt := icnOpenClose(seq, n.vID, n.vRemote, civSeq, 0x04)
|
||||
n.sentMu.Lock()
|
||||
n.sentBuf[seq] = ocPkt
|
||||
n.sentMu.Unlock()
|
||||
_, _ = n.civ.Write(ocPkt)
|
||||
debugLog.Printf("icom net: re-sent the CI-V open on the existing stream")
|
||||
}
|
||||
// The reopen was given five seconds. On a real IC-7760 it never works —
|
||||
// the rig ignores it and only a fresh session brings CI-V back — so
|
||||
// rather than sit out the 30 s watchdog, fail the link NOW and let the
|
||||
// manager rebuild it: the outage drops from ~35 s to ~15.
|
||||
if quietSaid && !gaveUp && time.Since(lastData) > 15*time.Second {
|
||||
gaveUp = true
|
||||
n.dead.Store(true)
|
||||
debugLog.Printf("icom net: the reopen did not bring CI-V back — forcing a fresh session")
|
||||
}
|
||||
if time.Since(lastIdle) > 150*time.Millisecond {
|
||||
_, _ = n.civ.Write(icnCtrl(0x00, 0, n.vID, n.vRemote))
|
||||
lastIdle = time.Now()
|
||||
@@ -712,6 +804,11 @@ func icnHandshake(c *net.UDPConn, myID uint32, cancel <-chan struct{}) (uint32,
|
||||
}
|
||||
typ := icnLE.Uint16(p[4:])
|
||||
sentid := icnLE.Uint32(p[8:])
|
||||
// Every packet the rig sends during the handshake, verbatim. A radio that
|
||||
// answers SOMETHING unrecognised (a newer model, a different firmware) and
|
||||
// a radio that answers nothing are different faults, and a silent timeout
|
||||
// hides which one this is.
|
||||
icnHandshakeProbe(p)
|
||||
switch typ {
|
||||
case 0x04: // iAmHere
|
||||
remoteID = sentid
|
||||
@@ -844,7 +941,12 @@ func icnConnInfo(seq, innerSeq, tokReq uint16, sentid, rcvdid, token uint32, use
|
||||
copy(b[0x60:0x70], icnPasscode(user))
|
||||
b[0x70] = rxEnable // rxenable: 1 opens the 50003 RX audio stream, 0 = CI-V only
|
||||
b[0x71] = 0x00 // txenable (Phase 5)
|
||||
b[0x72] = 0x10 // rxcodec
|
||||
// rxcodec 0x04 = LPCM, ONE channel, 16-BIT — settled by experiment on a
|
||||
// real IC-7760, one wrong guess at a time: 0x10 produced 1280-byte payloads
|
||||
// of interleaved 16-bit stereo, 0x02 produced 320-byte payloads of 8-bit
|
||||
// mono (samples hugging 0x80). 0x04 sits between them in the codec table
|
||||
// (as in wfview): 16-bit mono, the format the 16 kHz playback path plays.
|
||||
b[0x72] = 0x04 // rxcodec
|
||||
b[0x73] = 0x04 // txcodec
|
||||
icnBE.PutUint32(b[0x74:], 16000)
|
||||
icnBE.PutUint32(b[0x78:], 8000)
|
||||
@@ -903,3 +1005,19 @@ func icnPasscode(s string) []byte {
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// icnHandshakeProbe logs the first packets seen during a control handshake —
|
||||
// capped hard, because a working handshake would log for ever.
|
||||
var icnProbeCount int
|
||||
|
||||
func icnHandshakeProbe(p []byte) {
|
||||
if icnProbeCount >= 12 {
|
||||
return
|
||||
}
|
||||
icnProbeCount++
|
||||
n := len(p)
|
||||
if n > 32 {
|
||||
n = 32
|
||||
}
|
||||
debugLog.Printf("icom net: handshake rx %d bytes: % X", len(p), p[:n])
|
||||
}
|
||||
|
||||
@@ -347,7 +347,12 @@ func (b *IcomSerial) ReadState() (RigState, error) {
|
||||
case readerGone:
|
||||
debugLog.Printf("icom net: the CI-V reader has exited — the connection is dead however alive the control link looks → reconnecting")
|
||||
case at.Alive():
|
||||
debugLog.Printf("icom net: control link answers but no CI-V reply for %s → reconnecting. Another program (WSJT-X/OmniRig, the Remote Utility) has most likely taken the CI-V session.", silentFor.Round(time.Second))
|
||||
// No verdict on WHY: this fires for a session taken by another
|
||||
// program (WSJT-X, the Remote Utility) AND for a rig that simply
|
||||
// stopped answering — a real IC-7760 did exactly that once with
|
||||
// nothing else on the network. Blaming a hijacker sent that
|
||||
// operator hunting software that was not installed.
|
||||
debugLog.Printf("icom net: control link answers but no CI-V reply for %s → reconnecting. Either another program took the CI-V session (WSJT-X/OmniRig/Remote Utility), or the rig stopped answering on its own.", silentFor.Round(time.Second))
|
||||
default:
|
||||
debugLog.Printf("icom net: control link went quiet (no rig packets for >6 s) → reconnecting. If this recurs every ~2-3 min, the rig is invalidating the session (token renewal rejected).")
|
||||
}
|
||||
@@ -559,6 +564,18 @@ func (b *IcomSerial) SetMode(mode string) error {
|
||||
}
|
||||
// Filter 0x01 (FIL1) is the conventional default for the data-mode set.
|
||||
_ = b.execIdempotent("set data mode", civ.CmdExtra, civ.SubDataMode, dataByte, 0x01)
|
||||
// Trust, then verify: the IC-7760 acknowledges 1A 06 and stays in USB-D
|
||||
// anyway, which left an operator unable to get back to plain USB at all.
|
||||
// When the readback disagrees, say it again with 0x26 — mode, data flag and
|
||||
// filter in one frame, the command the newer rigs actually honour. Only on
|
||||
// a mismatch, so rigs that predate 0x26 never see it.
|
||||
if got := b.readDataMode(); got != data {
|
||||
if err := b.execIdempotent("set mode+data (0x26)", civ.CmdModeDataFil, 0x00, code, dataByte, 0x01); err != nil {
|
||||
applog.Printf("icom: data flag stuck at %v after mode %s, and 0x26 failed too: %v", got, mode, err)
|
||||
} else {
|
||||
applog.Printf("icom: data flag stuck after 1A06, corrected via 0x26 (mode %s)", mode)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1482,6 +1499,12 @@ func (b *IcomSerial) modeCode(mode string) (code byte, data bool, err error) {
|
||||
return civ.ModeFM, false, nil
|
||||
case "RTTY", "FSK":
|
||||
return civ.ModeRTTY, false, nil
|
||||
case "PSK":
|
||||
// The console button, not the ADIF mode: the rigs that HAVE a native PSK
|
||||
// mode (7610/7760/7851 class) get it; a 7300 NAKs 0x12 and the button
|
||||
// stays dead there, exactly as RS-BA1's does. Soundcard PSK31 stays on
|
||||
// USB-D below, where every rig can do it.
|
||||
return civ.ModePSK, false, nil
|
||||
case "FT8", "FT4", "PSK31", "MFSK", "JS8", "JT65", "JT9", "OLIVIA", "DATA", "DIGITALVOICE":
|
||||
// Digital data modes ride on USB with the data flag set (FT8 etc.).
|
||||
return civ.ModeUSB, true, nil
|
||||
|
||||
@@ -35,6 +35,11 @@ type KenwoodTXState struct {
|
||||
Model string `json:"model,omitempty"`
|
||||
Elecraft bool `json:"elecraft"` // a K3/K4 rather than a Kenwood
|
||||
Mode string `json:"mode,omitempty"`
|
||||
// DataSub is the K3/K4 DATA submode while in DATA mode (DT): "DATA A",
|
||||
// "AFSK A", "FSK D" or "PSK D". Empty on a Kenwood, and outside DATA. The
|
||||
// panel's two DATA buttons need it to show WHICH data mode the rig is in —
|
||||
// FT8 wants DATA A, RTTY wants FSK D, and MD6 alone cannot say which.
|
||||
DataSub string `json:"data_sub,omitempty"`
|
||||
|
||||
Transmitting bool `json:"transmitting"`
|
||||
Split bool `json:"split"`
|
||||
@@ -107,10 +112,12 @@ type KenwoodPanelController interface {
|
||||
SetKenwoodRIT(bool) error
|
||||
SetKenwoodXIT(bool) error
|
||||
NudgeKenwoodRIT(int) error
|
||||
SetKenwoodRITOffset(int) error
|
||||
ClearKenwoodRIT() error
|
||||
SetKenwoodTX(bool) error
|
||||
TuneKenwoodATU() error
|
||||
ToggleKenwoodATU() error
|
||||
SetKenwoodPanelMode(string) error
|
||||
}
|
||||
|
||||
// kenwoodPanelSlowBeat is how many polls pass between full re-reads of the
|
||||
@@ -212,6 +219,14 @@ func (k *Kenwood) readPanelSettings() {
|
||||
if v, ok := k.askNum("NR;", "NR", 1); ok {
|
||||
k.panel.NR = v != 0
|
||||
}
|
||||
// The DATA submode, Elecraft only (a plain Kenwood has no DT and would "?;"
|
||||
// it). Read every settings beat: the operator changes it from the rig's own
|
||||
// front panel mid-session, and the two DATA buttons must follow.
|
||||
if k.elecraft {
|
||||
if v, ok := k.askNum("DT;", "DT", 1); ok {
|
||||
k.panel.DataSub = kenwoodDataSubName(v)
|
||||
}
|
||||
}
|
||||
if v, ok := k.askNum("GT;", "GT", 3); ok {
|
||||
k.panel.AGC = kenwoodAGCName(v)
|
||||
}
|
||||
@@ -334,7 +349,7 @@ func (k *Kenwood) readTXMeters() {
|
||||
if v, ok := k.askNum("SW;", "SW", 3); ok {
|
||||
k.panel.SWRRaw = v
|
||||
if v > 0 {
|
||||
k.panel.SWR = float64(k.swrPeak.update(v, now)) / 10
|
||||
k.panel.SWR = float64(k.swrPeak.updateSnap(v, now)) / 10
|
||||
}
|
||||
}
|
||||
if k.metersLogged >= 20 {
|
||||
@@ -564,6 +579,16 @@ func (k *Kenwood) SetKenwoodXIT(on bool) error {
|
||||
|
||||
// ClearKenwoodRIT zeroes the RIT/XIT offset, both at once — which is what RC
|
||||
// does and what the operator means by "clear it".
|
||||
// SetKenwoodRITOffset writes the offset as an ABSOLUTE value — what the shared
|
||||
// ShiftRow control speaks. Nudge stays for the keyboard clarifier; both funnel
|
||||
// into the same RO write.
|
||||
func (k *Kenwood) SetKenwoodRITOffset(hz int) error {
|
||||
k.mu.Lock()
|
||||
cur := k.panel.RITOffset
|
||||
k.mu.Unlock()
|
||||
return k.NudgeKenwoodRIT(hz - cur)
|
||||
}
|
||||
|
||||
func (k *Kenwood) ClearKenwoodRIT() error {
|
||||
return k.setPanel("RC;")
|
||||
}
|
||||
@@ -650,3 +675,58 @@ func (k *Kenwood) askNum(cmd, prefix string, digits int) (int, bool) {
|
||||
}
|
||||
return n, true
|
||||
}
|
||||
|
||||
// kenwoodDataSubName decodes DT (K3/K4 programmer's reference).
|
||||
func kenwoodDataSubName(v int) string {
|
||||
switch v {
|
||||
case 0:
|
||||
return "DATA A"
|
||||
case 1:
|
||||
return "AFSK A"
|
||||
case 2:
|
||||
return "FSK D"
|
||||
case 3:
|
||||
return "PSK D"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetKenwoodPanelMode is the panel's mode row: CW / USB / LSB / DATA / RTTY.
|
||||
//
|
||||
// It exists because SetMode is the LOGGER's path — it maps an ADIF mode and
|
||||
// honours the data-mode preference — while a panel button is the operator
|
||||
// saying exactly what the rig should do. The two DATA cases are the point:
|
||||
// "DATA" is MD6 + DT0 (DATA A, the soundcard submode FT8/FT4 modulate through)
|
||||
// and "RTTY" is MD6 + DT2 (FSK D, the K3's direct-keyed RTTY). MD6 alone keeps
|
||||
// whatever submode a prior session left, which is how a K3 "in DATA" transmits
|
||||
// FT8 with no audio — the report behind this row.
|
||||
func (k *Kenwood) SetKenwoodPanelMode(mode string) error {
|
||||
k.mu.Lock()
|
||||
defer k.mu.Unlock()
|
||||
if k.port == nil {
|
||||
return fmt.Errorf("kenwood: not connected")
|
||||
}
|
||||
var cmds []string
|
||||
switch strings.ToUpper(strings.TrimSpace(mode)) {
|
||||
case "CW":
|
||||
cmds = []string{"MD3;"}
|
||||
case "USB":
|
||||
cmds = []string{"MD2;"}
|
||||
case "LSB":
|
||||
cmds = []string{"MD1;"}
|
||||
case "DATA":
|
||||
cmds = []string{"MD6;", "DT0;"}
|
||||
case "RTTY":
|
||||
cmds = []string{"MD6;", "DT2;"}
|
||||
default:
|
||||
return fmt.Errorf("kenwood panel: unknown mode %q", mode)
|
||||
}
|
||||
for _, c := range cmds {
|
||||
if err := k.write(c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Re-read the settings on the next poll so Mode and DataSub confirm at once.
|
||||
k.panelCycle = kenwoodPanelSlowBeat
|
||||
return nil
|
||||
}
|
||||
|
||||
+26
-2
@@ -165,8 +165,7 @@ func (t *TCI) Connect() error {
|
||||
if t.spotsEnabled {
|
||||
debugLog.Printf("TCI: panorama spots are ON — spots will be sent to the radio")
|
||||
}
|
||||
_ = t.send("rx_sensors_enable:true,200;")
|
||||
_ = t.send("tx_sensors_enable:true,200;")
|
||||
t.subscribeSensors("connect")
|
||||
if t.spotsEnabled {
|
||||
// Forget what we thought was on the panorama at the same moment the radio
|
||||
// is told to drop it. Kept, the memory would suppress the next spot for
|
||||
@@ -461,6 +460,24 @@ func (t *TCI) SetTXAudioSource(src string) {
|
||||
}
|
||||
|
||||
// send writes a command to the WebSocket (one writer at a time).
|
||||
// subscribeSensors asks the radio to push its meters. Nothing measures anything
|
||||
// until this goes out — the S-meter, the transmit power and the SWR are all
|
||||
// subscription-only (TCI §4.4) — and it is sent at connect AND again at every
|
||||
// "ready", because a subscription sent during the server's initial dump can be
|
||||
// dropped. 200 ms is the rate the protocol's own examples use.
|
||||
func (t *TCI) subscribeSensors(when string) {
|
||||
// Both cases, deliberately. Every other command this backend sends works in
|
||||
// lower case, but the meters stayed silent on a real SunSDR through two
|
||||
// rounds of fixes — and the protocol document's own examples are upper case
|
||||
// (TX_SENSORS_ENABLE:true,200;). A server that is case-insensitive ignores
|
||||
// the duplicate; one that is not finally hears the subscription.
|
||||
e1 := t.send("rx_sensors_enable:true,200;")
|
||||
e2 := t.send("tx_sensors_enable:true,200;")
|
||||
_ = t.send("RX_SENSORS_ENABLE:true,200;")
|
||||
_ = t.send("TX_SENSORS_ENABLE:true,200;")
|
||||
debugLog.Printf("TCI: sensor subscription sent (%s, both cases): rx=%v tx=%v", when, e1, e2)
|
||||
}
|
||||
|
||||
func (t *TCI) send(cmd string) error {
|
||||
t.mu.Lock()
|
||||
c := t.conn
|
||||
@@ -567,6 +584,13 @@ func (t *TCI) handle(msg string) {
|
||||
}
|
||||
case "ready", "start":
|
||||
t.ready = true
|
||||
// (Re)subscribe to the meters HERE, not only at connect. ExpertSDR3
|
||||
// dumps its whole state and then says "ready"; a unidirectional control
|
||||
// command sent while that dump is still in flight can be ignored, and
|
||||
// the report from a real SunSDR — transmit meters still empty after the
|
||||
// connect-time subscription — has exactly that shape. From a goroutine:
|
||||
// send takes t.mu, which this handler holds.
|
||||
go t.subscribeSensors("ready")
|
||||
case "stop":
|
||||
t.ready = false
|
||||
case "vfo":
|
||||
|
||||
@@ -113,7 +113,8 @@ func (t *TCI) handlePanel(name string, get func(int) string, args string) bool {
|
||||
// it. What the radio actually announces after the command settles whether
|
||||
// this is our reading or its doing, and no amount of reasoning will.
|
||||
switch name {
|
||||
case "mute", "sql_enable", "sql_level", "tx_power", "tx_swr", "tune":
|
||||
case "mute", "sql_enable", "sql_level", "tx_power", "tx_swr", "tune",
|
||||
"tx_sensors", "rx_sensors", "rx_channel_sensors":
|
||||
// Logged on arrival so an ANSWER can be told from a SILENCE: the log
|
||||
// showed the transmit meters being asked for and nothing coming back,
|
||||
// which on its own proves nothing — a reply that arrived and failed to
|
||||
|
||||
@@ -905,3 +905,22 @@ func yaesuSplitCommand(cmd, vfo string, on bool) string {
|
||||
}
|
||||
return cmd + "0;"
|
||||
}
|
||||
|
||||
// updateSnap is update for a meter where lingering is misinformation: the peak
|
||||
// stands for the hold, then the display returns to the live sample AT ONCE.
|
||||
// Made for the K3's SWR — the radio throws a brief SWR spike as an FT8 frame
|
||||
// ends, and the quarter-of-the-gap decay above turned that one bad sample into
|
||||
// twelve seconds of alarming red on the next transmission. A needle's inertia
|
||||
// suits a power meter; an SWR reading is a warning light, and a warning that
|
||||
// fades slowly reads as a fault that is slowly getting better.
|
||||
func (m *meterPeak) updateSnap(sample int, now time.Time) int {
|
||||
if sample >= m.val {
|
||||
m.val, m.at = sample, now
|
||||
return m.val
|
||||
}
|
||||
if now.Sub(m.at) < meterHold {
|
||||
return m.val
|
||||
}
|
||||
m.val, m.at = sample, now
|
||||
return m.val
|
||||
}
|
||||
|
||||
@@ -868,6 +868,44 @@ var bulkEditableCols = map[string]bool{
|
||||
|
||||
// BulkSetField sets one whitelisted column to value on every listed QSO in a
|
||||
// single statement. value "" clears the field. Returns rows affected.
|
||||
// bulkEditableIntCols are the NUMERIC columns the bulk editor may touch. Their
|
||||
// own path, not the text one: the columns are nullable integers, and while
|
||||
// SQLite would coerce "14" quietly, a shared MySQL logbook would not — and an
|
||||
// empty string is NULL here, never "".
|
||||
var bulkEditableIntCols = map[string]bool{
|
||||
"my_dxcc": true,
|
||||
"my_cq_zone": true,
|
||||
"my_itu_zone": true,
|
||||
}
|
||||
|
||||
// BulkSetIntField sets one integer column across the ids; v nil clears it.
|
||||
func (r *Repo) BulkSetIntField(ctx context.Context, ids []int64, column string, v *int) (int64, error) {
|
||||
if !bulkEditableIntCols[column] {
|
||||
return 0, fmt.Errorf("field %q is not bulk-editable", column)
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
ph := make([]string, len(ids))
|
||||
args := make([]any, 0, len(ids)+2)
|
||||
var val any
|
||||
if v != nil {
|
||||
val = *v
|
||||
}
|
||||
args = append(args, val, db.NowISO())
|
||||
for i, id := range ids {
|
||||
ph[i] = "?"
|
||||
args = append(args, id)
|
||||
}
|
||||
res, err := r.db.ExecContext(ctx,
|
||||
"UPDATE qso SET "+column+" = ?, updated_at = ? WHERE id IN ("+strings.Join(ph, ",")+")", args...)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("bulk set %s: %w", column, err)
|
||||
}
|
||||
n, _ := res.RowsAffected()
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (r *Repo) BulkSetField(ctx context.Context, ids []int64, column, value string) (int64, error) {
|
||||
if !bulkEditableCols[column] {
|
||||
return 0, fmt.Errorf("field %q is not bulk-editable", column)
|
||||
@@ -1965,6 +2003,39 @@ func bandStatusCode(callWorked, callConfirmed, entityConfirmed bool) int {
|
||||
|
||||
// modeClass collapses ADIF modes into the three buckets DXers care about.
|
||||
// Anything not voice and not CW is treated as digital.
|
||||
// ModeClass is modeClass for callers outside the package — the watchlist
|
||||
// judges slots at the same grain the cluster does.
|
||||
func ModeClass(mode string) string { return modeClass(mode) }
|
||||
|
||||
// SlotRow is one (callsign, band, mode) triple from SlotsSince.
|
||||
type SlotRow struct {
|
||||
Callsign string
|
||||
Band string
|
||||
Mode string
|
||||
}
|
||||
|
||||
// SlotsSince lists the slots of every contact made since the given instant —
|
||||
// the contest watchlist's "worked today", where the day boundary lives in this
|
||||
// query's bound and nowhere else.
|
||||
func (r *Repo) SlotsSince(ctx context.Context, since time.Time) ([]SlotRow, error) {
|
||||
rows, err := r.db.QueryContext(ctx,
|
||||
"SELECT callsign, band, mode FROM qso WHERE qso_date >= ?",
|
||||
since.UTC().Format(isoMillis))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var out []SlotRow
|
||||
for rows.Next() {
|
||||
var sr SlotRow
|
||||
if err := rows.Scan(&sr.Callsign, &sr.Band, &sr.Mode); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out = append(out, sr)
|
||||
}
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
func modeClass(mode string) string {
|
||||
switch strings.ToUpper(mode) {
|
||||
case "SSB", "USB", "LSB", "AM", "FM", "DIGITALVOICE", "PHONE":
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
package watchlist
|
||||
|
||||
// ClubLog enrichment — phase 2 of the DXHunter port. clublog.org/watch.php
|
||||
// answers, per callsign: is this an expedition, does it run OQRS, is there a
|
||||
// LiveStream, the log's QSO total and the last 24 hours' rate. That block has
|
||||
// been in the Entry schema since phase 1 (the file round-trips DXHunter's);
|
||||
// this file finally fills it.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// WatchData is clublog.org/watch.php's answer, reduced to what the tab shows.
|
||||
type WatchData struct {
|
||||
IsExpedition bool `json:"is_expedition"`
|
||||
HasOQRS bool `json:"has_oqrs"`
|
||||
LiveStream bool `json:"livestream"`
|
||||
ClubLogInfo *struct {
|
||||
TotalQSOs int `json:"total_qsos"`
|
||||
} `json:"clublog_info"`
|
||||
// {} when populated, [] when empty — RawMessage swallows both shapes.
|
||||
QSOsPerBand json.RawMessage `json:"24h_qsos_per_band_mode"`
|
||||
}
|
||||
|
||||
// QSOs24h sums the per-band/per-mode counts.
|
||||
func (d *WatchData) QSOs24h() int {
|
||||
if len(d.QSOsPerBand) == 0 {
|
||||
return 0
|
||||
}
|
||||
var parsed map[string]map[string]int
|
||||
if err := json.Unmarshal(d.QSOsPerBand, &parsed); err != nil {
|
||||
return 0 // "[]" for an empty answer lands here, which is the right zero
|
||||
}
|
||||
n := 0
|
||||
for _, modes := range parsed {
|
||||
for _, c := range modes {
|
||||
n += c
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// FetchWatch asks ClubLog about one callsign. A 404 is "ClubLog has no log for
|
||||
// this call" — an ordinary answer, not an error.
|
||||
func FetchWatch(ctx context.Context, client *http.Client, apiKey, callsign string) (*WatchData, error) {
|
||||
url := fmt.Sprintf("https://clublog.org/watch.php?call=%s&api=%s",
|
||||
strings.ToUpper(strings.TrimSpace(callsign)), apiKey)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Set("User-Agent", "OpsLog")
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode == http.StatusNotFound {
|
||||
return &WatchData{}, nil
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("clublog watch %s: HTTP %d", callsign, resp.StatusCode)
|
||||
}
|
||||
body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(strings.TrimSpace(string(body))) == 0 {
|
||||
return &WatchData{}, nil
|
||||
}
|
||||
var data WatchData
|
||||
if err := json.Unmarshal(body, &data); err != nil {
|
||||
return nil, fmt.Errorf("clublog watch %s: %w", callsign, err)
|
||||
}
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// ApplyClubLog writes one answer into the entry and reports whether anything
|
||||
// the tab shows actually changed — the caller only broadcasts on true.
|
||||
func (s *Store) ApplyClubLog(callsign string, d *WatchData) bool {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
e, ok := s.entries[strings.ToUpper(strings.TrimSpace(callsign))]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
total := e.ClubLogTotalQSOs
|
||||
if d.ClubLogInfo != nil {
|
||||
total = d.ClubLogInfo.TotalQSOs
|
||||
}
|
||||
q24 := d.QSOs24h()
|
||||
changed := e.IsExpedition != d.IsExpedition || e.ClubLogHasOQRS != d.HasOQRS ||
|
||||
e.ClubLogLiveStream != d.LiveStream || e.ClubLogTotalQSOs != total ||
|
||||
e.ClubLogQSOs24h != q24
|
||||
e.IsExpedition = d.IsExpedition
|
||||
e.ClubLogHasOQRS = d.HasOQRS
|
||||
e.ClubLogLiveStream = d.LiveStream
|
||||
e.ClubLogTotalQSOs = total
|
||||
e.ClubLogQSOs24h = q24
|
||||
e.ClubLogUpdatedAt = time.Now()
|
||||
s.scheduleSave()
|
||||
return changed
|
||||
}
|
||||
|
||||
// StaleEntries lists the callsigns whose ClubLog block is due a refresh.
|
||||
// Expeditions age faster — their totals are the interesting number and move by
|
||||
// the hour; a quiet call is asked about four times a day at most.
|
||||
func (s *Store) StaleEntries(expTTL, otherTTL time.Duration) []string {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
now := time.Now()
|
||||
var out []string
|
||||
for call, e := range s.entries {
|
||||
// A starred pattern is a family, not a station — ClubLog has no log
|
||||
// for "VK9*". The base (star stripped) is what gets asked about.
|
||||
ttl := otherTTL
|
||||
if e.IsExpedition {
|
||||
ttl = expTTL
|
||||
}
|
||||
if now.Sub(e.ClubLogUpdatedAt) >= ttl {
|
||||
out = append(out, call)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
// Package watchlist is the DXHunter watchlist, transplanted: a list of
|
||||
// callsigns (or prefixes) the operator is hunting, matched against the live
|
||||
// spot stream, with per-entry state that survives restarts.
|
||||
//
|
||||
// The JSON file is DXHunter's OWN schema, field for field — including the
|
||||
// ClubLog expedition block this phase does not fill yet. Deliberate: the
|
||||
// operator asked to carry their watchlist.json across, and a file that
|
||||
// round-trips unchanged is the whole of "same format". The file is GLOBAL
|
||||
// (dataDir, beside nets.json), not per profile: a DXpedition worth hunting is
|
||||
// worth hunting whichever station is on.
|
||||
//
|
||||
// The CONTEST idea is per entry, not a global mode as in DXHunter: an entry
|
||||
// marked contest is judged against the CURRENT UTC DAY — at midnight UTC
|
||||
// yesterday's contacts stop counting and every slot reads "work today" again.
|
||||
// Nothing resets and nothing is stored for it: the day boundary lives in the
|
||||
// query, which is why it cannot drift or need a timer.
|
||||
package watchlist
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Entry is one watched callsign. JSON tags match DXHunter's watchlist.json
|
||||
// exactly — see the package comment before renaming anything.
|
||||
type Entry struct {
|
||||
Callsign string `json:"callsign"`
|
||||
LastSeen time.Time `json:"lastSeen"`
|
||||
LastSeenStr string `json:"lastSeenStr"`
|
||||
AddedAt time.Time `json:"addedAt"`
|
||||
SpotCount int `json:"spotCount"`
|
||||
IsContest bool `json:"isContest"`
|
||||
Notify bool `json:"notify"`
|
||||
// ClubLog expedition enrichment — phase 2. Carried so a DXHunter file
|
||||
// round-trips; not filled by OpsLog yet.
|
||||
IsExpedition bool `json:"isExpedition"`
|
||||
ClubLogQSOs24h int `json:"clubLogQSOs24h"`
|
||||
ClubLogTotalQSOs int `json:"clubLogTotalQSOs"`
|
||||
ClubLogHasOQRS bool `json:"clubLogHasOQRS"`
|
||||
ClubLogLiveStream bool `json:"clubLogLiveStream"`
|
||||
ClubLogUpdatedAt time.Time `json:"clubLogUpdatedAt,omitempty"`
|
||||
}
|
||||
|
||||
// Store owns the file. All methods are safe for concurrent use; writes are
|
||||
// debounced so a burst of MarkSeen calls costs one disk write.
|
||||
type Store struct {
|
||||
mu sync.RWMutex
|
||||
entries map[string]*Entry
|
||||
path string
|
||||
|
||||
saveMu sync.Mutex
|
||||
saveTimer *time.Timer
|
||||
ioMu sync.Mutex
|
||||
}
|
||||
|
||||
func New(path string) *Store {
|
||||
s := &Store{entries: map[string]*Entry{}, path: path}
|
||||
s.load()
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Store) load() {
|
||||
data, err := os.ReadFile(s.path)
|
||||
if err != nil {
|
||||
return // absent on first run — created on first save
|
||||
}
|
||||
var list []Entry
|
||||
if err := json.Unmarshal(data, &list); err != nil {
|
||||
return // a corrupt file must not take the app down; it is left for repair
|
||||
}
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
for i := range list {
|
||||
e := list[i]
|
||||
e.Callsign = strings.ToUpper(strings.TrimSpace(e.Callsign))
|
||||
if e.Callsign == "" {
|
||||
continue
|
||||
}
|
||||
s.entries[e.Callsign] = &e
|
||||
}
|
||||
}
|
||||
|
||||
// Entries returns a snapshot, watched-first ordering left to the UI.
|
||||
func (s *Store) Entries() []Entry {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
out := make([]Entry, 0, len(s.entries))
|
||||
for _, e := range s.entries {
|
||||
c := *e
|
||||
c.LastSeenStr = lastSeenLabel(c.LastSeen)
|
||||
out = append(out, c)
|
||||
}
|
||||
sort.Slice(out, func(i, j int) bool { return out[i].Callsign < out[j].Callsign })
|
||||
return out
|
||||
}
|
||||
|
||||
// Add creates an entry; contest marks it as re-workable every UTC day. A
|
||||
// trailing * makes the entry a prefix (VK9* catches every VK9…); anywhere else
|
||||
// the star is refused rather than silently matching nothing.
|
||||
func (s *Store) Add(callsign string, contest bool) error {
|
||||
call := strings.ToUpper(strings.TrimSpace(callsign))
|
||||
if call == "" {
|
||||
return fmt.Errorf("callsign required")
|
||||
}
|
||||
if i := strings.Index(call, "*"); i >= 0 && i != len(call)-1 {
|
||||
return fmt.Errorf("* is only allowed at the end (VK9*)")
|
||||
}
|
||||
if call == "*" {
|
||||
return fmt.Errorf("a bare * would match every spot")
|
||||
}
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if _, ok := s.entries[call]; ok {
|
||||
return fmt.Errorf("%s is already on the watchlist", call)
|
||||
}
|
||||
s.entries[call] = &Entry{Callsign: call, AddedAt: time.Now(), IsContest: contest}
|
||||
s.scheduleSave()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Remove deletes an entry.
|
||||
func (s *Store) Remove(callsign string) error {
|
||||
call := strings.ToUpper(strings.TrimSpace(callsign))
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if _, ok := s.entries[call]; !ok {
|
||||
return fmt.Errorf("%s is not on the watchlist", call)
|
||||
}
|
||||
delete(s.entries, call)
|
||||
s.scheduleSave()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetNotify arms or disarms the alert for one entry.
|
||||
func (s *Store) SetNotify(callsign string, on bool) error {
|
||||
return s.patch(callsign, func(e *Entry) { e.Notify = on })
|
||||
}
|
||||
|
||||
// SetContest flips the per-entry contest rule.
|
||||
func (s *Store) SetContest(callsign string, on bool) error {
|
||||
return s.patch(callsign, func(e *Entry) { e.IsContest = on })
|
||||
}
|
||||
|
||||
func (s *Store) patch(callsign string, fn func(*Entry)) error {
|
||||
call := strings.ToUpper(strings.TrimSpace(callsign))
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
e, ok := s.entries[call]
|
||||
if !ok {
|
||||
return fmt.Errorf("%s is not on the watchlist", call)
|
||||
}
|
||||
fn(e)
|
||||
s.scheduleSave()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Match returns the entry a spotted callsign belongs to, or "".
|
||||
//
|
||||
// EXACT unless the entry says otherwise: N8W matches only N8W, and it takes
|
||||
// N8W* to catch N8WCR. The first version prefix-matched everything, DXHunter
|
||||
// style, and a three-letter special-event call swallowed every longer call
|
||||
// sharing its start — N8W lit up for N8WCR, which is a different station
|
||||
// entirely. The operator writes the star when they MEAN a family (VK9*, an
|
||||
// expedition's portable forms via RI0SP*); a bare entry means that call.
|
||||
func (s *Store) Match(callsign string) (string, bool) {
|
||||
call := strings.ToUpper(strings.TrimSpace(callsign))
|
||||
if call == "" {
|
||||
return "", false
|
||||
}
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
for pattern := range s.entries {
|
||||
if PatternMatches(pattern, call) {
|
||||
return pattern, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
// PatternMatches reports whether one watchlist pattern covers a callsign:
|
||||
// exact equality, or — with a trailing * — a prefix.
|
||||
func PatternMatches(pattern, call string) bool {
|
||||
if p, ok := strings.CutSuffix(pattern, "*"); ok {
|
||||
return p != "" && strings.HasPrefix(call, p)
|
||||
}
|
||||
return call == pattern
|
||||
}
|
||||
|
||||
// MarkSeen records a spot against the matching entry and reports whether the
|
||||
// entry wants an alert.
|
||||
func (s *Store) MarkSeen(callsign string) (entry string, notify bool, ok bool) {
|
||||
pattern, found := s.Match(callsign)
|
||||
if !found {
|
||||
return "", false, false
|
||||
}
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
e := s.entries[pattern]
|
||||
if e == nil {
|
||||
return "", false, false
|
||||
}
|
||||
e.LastSeen = time.Now()
|
||||
e.SpotCount++
|
||||
s.scheduleSave()
|
||||
return e.Callsign, e.Notify, true
|
||||
}
|
||||
|
||||
// scheduleSave debounces the write: a burst of spots costs one file write two
|
||||
// seconds after the last of them. Callers hold s.mu.
|
||||
func (s *Store) scheduleSave() {
|
||||
s.saveMu.Lock()
|
||||
defer s.saveMu.Unlock()
|
||||
if s.saveTimer != nil {
|
||||
s.saveTimer.Stop()
|
||||
}
|
||||
s.saveTimer = time.AfterFunc(2*time.Second, func() { s.persist() })
|
||||
}
|
||||
|
||||
func (s *Store) persist() {
|
||||
list := s.Entries()
|
||||
data, err := json.MarshalIndent(list, "", " ")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
s.ioMu.Lock()
|
||||
defer s.ioMu.Unlock()
|
||||
_ = os.WriteFile(s.path, data, 0o644)
|
||||
}
|
||||
|
||||
// Flush writes now — for shutdown, where the two-second debounce would lose
|
||||
// the last edits.
|
||||
func (s *Store) Flush() { s.persist() }
|
||||
|
||||
// lastSeenLabel is DXHunter's "Just now / 5m ago / 3h ago / 2d ago" string,
|
||||
// computed at read time so it never goes stale in the file.
|
||||
func lastSeenLabel(t time.Time) string {
|
||||
if t.IsZero() {
|
||||
return "Never"
|
||||
}
|
||||
d := time.Since(t)
|
||||
switch {
|
||||
case d < time.Minute:
|
||||
return "Just now"
|
||||
case d < time.Hour:
|
||||
return fmt.Sprintf("%dm ago", int(d.Minutes()))
|
||||
case d < 24*time.Hour:
|
||||
return fmt.Sprintf("%dh ago", int(d.Hours()))
|
||||
default:
|
||||
return fmt.Sprintf("%dd ago", int(d.Hours()/24))
|
||||
}
|
||||
}
|
||||
|
||||
// Get returns one entry by its exact name — the alert path needs its contest
|
||||
// flag after MarkSeen named it.
|
||||
func (s *Store) Get(callsign string) (Entry, bool) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
e, ok := s.entries[strings.ToUpper(strings.TrimSpace(callsign))]
|
||||
if !ok {
|
||||
return Entry{}, false
|
||||
}
|
||||
return *e, true
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package watchlist
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGlobMatch(t *testing.T) {
|
||||
s := New(filepath.Join(t.TempDir(), "watchlist.json"))
|
||||
if err := s.Add("RI0SP*", false); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := s.Add("N8W", false); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// A starred entry is a family: the expedition's portable forms.
|
||||
for _, call := range []string{"RI0SP", "RI0SP/MM", "RI0SP/P"} {
|
||||
if _, ok := s.Match(call); !ok {
|
||||
t.Errorf("Match(%q) = false, want true", call)
|
||||
}
|
||||
}
|
||||
// A bare entry is THAT call — the reported bug was N8W lighting up for
|
||||
// N8WCR, a different station entirely.
|
||||
if _, ok := s.Match("N8W"); !ok {
|
||||
t.Error("exact entry must match its own call")
|
||||
}
|
||||
if _, ok := s.Match("N8WCR"); ok {
|
||||
t.Error("exact entry must NOT match a longer call")
|
||||
}
|
||||
if _, ok := s.Match("RI0S"); ok {
|
||||
t.Error("a SHORTER call must not match a starred entry")
|
||||
}
|
||||
if err := s.Add("VK*9", false); err == nil {
|
||||
t.Error("a mid-string star must be refused")
|
||||
}
|
||||
if err := s.Add("*", false); err == nil {
|
||||
t.Error("a bare star must be refused")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDXHunterFileRoundTrips(t *testing.T) {
|
||||
// A real DXHunter entry, ClubLog block included. It must survive
|
||||
// load → save byte-meaningfully: same keys, values preserved.
|
||||
src := `[{"callsign":"C5SP","lastSeen":"0001-01-01T00:00:00Z","lastSeenStr":"Never",
|
||||
"addedAt":"2026-01-17T00:18:43.89Z","spotCount":7,"isContest":true,"notify":true,
|
||||
"isExpedition":true,"clubLogQSOs24h":120,"clubLogTotalQSOs":30500,
|
||||
"clubLogHasOQRS":true,"clubLogLiveStream":true,"clubLogUpdatedAt":"2026-08-28T22:32:18Z"}]`
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "watchlist.json")
|
||||
if err := os.WriteFile(path, []byte(src), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s := New(path)
|
||||
s.Flush()
|
||||
out, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var list []map[string]any
|
||||
if err := json.Unmarshal(out, &list); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(list) != 1 {
|
||||
t.Fatalf("got %d entries", len(list))
|
||||
}
|
||||
e := list[0]
|
||||
for k, want := range map[string]any{
|
||||
"callsign": "C5SP", "isContest": true, "notify": true,
|
||||
"isExpedition": true, "clubLogQSOs24h": float64(120),
|
||||
"clubLogTotalQSOs": float64(30500), "clubLogHasOQRS": true,
|
||||
} {
|
||||
if e[k] != want {
|
||||
t.Errorf("%s = %v, want %v", k, e[k], want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarkSeenAndNotify(t *testing.T) {
|
||||
s := New(filepath.Join(t.TempDir(), "watchlist.json"))
|
||||
_ = s.Add("HB040A", false)
|
||||
_ = s.SetNotify("HB040A", true)
|
||||
entry, notify, ok := s.MarkSeen("HB040A")
|
||||
if !ok || !notify || entry != "HB040A" {
|
||||
t.Fatalf("MarkSeen = %q %v %v", entry, notify, ok)
|
||||
}
|
||||
list := s.Entries()
|
||||
if list[0].SpotCount != 1 || list[0].LastSeenStr != "Just now" {
|
||||
t.Errorf("entry after MarkSeen: %+v", list[0])
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
// appVersion is stamped on every heartbeat (and could feed the About box).
|
||||
appVersion = "0.26.22"
|
||||
appVersion = "0.27.0"
|
||||
|
||||
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
|
||||
// to https://us.i.posthog.com for a US project.
|
||||
|
||||
Reference in New Issue
Block a user