Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
242a68080a | ||
|
|
8c7e1c1a3d | ||
|
|
47ddbed665 | ||
|
|
fd7ae77a61 | ||
|
|
3e794f57e0 | ||
|
|
30f74583ff | ||
|
|
f7b9aa2181 | ||
|
|
766b0f95a4 | ||
|
|
8bc4ed68d4 | ||
|
|
d534825e92 | ||
|
|
08d6492df1 | ||
|
|
a156b6ad10 | ||
|
|
3bb92f79b2 | ||
|
|
65cae0d822 | ||
|
|
b24f880d62 | ||
|
|
ef71ddb648 | ||
|
|
0143a84cee | ||
|
|
82721110ed | ||
|
|
aec363b152 | ||
|
|
9a21c936b1 | ||
|
|
d8f0fd7b4f | ||
|
|
4a942a04c3 | ||
|
|
ecae68ca79 | ||
|
|
9270b227b0 | ||
|
|
cff590fe8a | ||
|
|
4366083152 | ||
|
|
8865af35fd | ||
|
|
bfad51268b | ||
|
|
0e77e8d61f | ||
|
|
08d316b1e0 | ||
|
|
b8796369ba | ||
|
|
fa1c41388d | ||
|
|
d2cfad490a | ||
|
|
69d78ba8c0 | ||
|
|
9cf1984fb2 | ||
|
|
ee8fd32bf7 | ||
|
|
f357dad629 | ||
|
|
b3547364d4 | ||
|
|
965ed4c792 | ||
|
|
32dbfbd04e | ||
|
|
a930a4f02d | ||
|
|
f98a831195 | ||
|
|
9d21af9f7c | ||
|
|
0680181016 | ||
|
|
afd0714301 | ||
|
|
8855eaf05a | ||
|
|
2594697e00 | ||
|
|
cf5efea3e4 | ||
|
|
4689505fb9 | ||
|
|
23f425f95f |
@@ -1,77 +1,414 @@
|
|||||||
# Transceiver Control Interface
|
# OpsLog
|
||||||
|
|
||||||
## Introduction
|
<a href="https://discord.gg/tmVPdQ5A8" target="_blank">
|
||||||
|
<img src="https://img.shields.io/badge/Discord-Join%20the%20server-5865F2?logo=discord&logoColor=white" alt="Join our Discord" />
|
||||||
|
</a>
|
||||||
|
|
||||||
TCI (Transceiver Control Interface) is a network interface for control, data transfer and
|
A modern, fast ham-radio logger for Windows — single-strip entry, real-time CAT
|
||||||
synchronization between transceiver/receiver, contest loggers, digital mode software, skimmers
|
for **OmniRig**, native **FlexRadio/SmartSDR**, native **Icom CI-V** (USB **and**
|
||||||
and other software, as well as external power amplifiers, bandpass filter units, antenna switches,
|
remote-over-internet, replacing RS-BA1) and **TCI** (SunSDR / Expert Electronics),
|
||||||
radio controllers and other devices.
|
DX cluster with spot alerts, awards tracking, maps, contest logging, QSL
|
||||||
|
management and a QSL-card designer. Built with **Wails v2** (Go backend +
|
||||||
|
React/TypeScript frontend), **pure Go** (no CGO): SQLite for configuration,
|
||||||
|
optional **shared MySQL** for the logbook so several operators can run one log.
|
||||||
|
Fully themeable and bilingual (English / French).
|
||||||
|
|
||||||
TCI was created as a modern alternative to the outdated COM port and audio cable
|
Developed by **F4BPO**.
|
||||||
interfaces, it uses a full duplex web socket protocol that runs on top of a TCP connection and
|
|
||||||
serves for server-client communications, providing cross-platform connectivity. Transceiver works
|
|
||||||
as a server, all other software and devices as clients. The server and clients can be inside the
|
|
||||||
same computer (program-server, hardware log, etc.-clients) and/or in separate physical devices
|
|
||||||
connected through the local network (classical transceiver, power amplifier, antenna switch, FFT
|
|
||||||
unit, etc.).
|
|
||||||
|
|
||||||
The TCI interface contains basic transceiver control commands (analog of CAT system),
|
---
|
||||||
receives CW macros from clients and broadcasts them, outputs transceiver IQ stream to clients,
|
|
||||||
receives spots from skimmers and Internet clusters, receives/outputs audio signal to work in
|
|
||||||
digital modes.
|
|
||||||
|
|
||||||
The TCI uses an extensible architecture and can be supplemented with new functions and
|
## Building / developing
|
||||||
commands, while keeping the old ones operational. Thus, the TCI interface can be extended and
|
|
||||||
supplemented to meet the specific needs of any software manufacturer and/or device
|
|
||||||
manufacturer (receivers, transceivers, power amplifiers, switches, etc.). The presence of a device
|
|
||||||
identifier allows the manufacturers of transceivers and receivers to switch to the TCI interface
|
|
||||||
while maintaining the device model designation. The extensibility of the TCI interface allows you
|
|
||||||
to create an individual set of commands and functions for each device model, while maintaining
|
|
||||||
the basic command set inherent to all transceivers.
|
|
||||||
|
|
||||||
Our company advocates universal unification of data exchange between devices and
|
- **Dev:** `wails dev` (Vite hot-reload; Go methods reachable at http://localhost:34115).
|
||||||
software by creating the TCI interface for this purpose. Modern transceivers and software must
|
- **Build:** `wails build` (use the project's wails v2.11 — `~/go/bin/wails.exe`).
|
||||||
communicate using one protocol - the TCI protocol.
|
- **Regenerate Go↔TS bindings** after changing exported `App` methods:
|
||||||
|
`wails generate module`.
|
||||||
|
- **Release:** `.vscode/release.ps1` (Ctrl+Shift+P → *Tasks: Run Task* →
|
||||||
|
*Release OpsLog*) — bumps the version, pushes source to Gitea, builds the exe
|
||||||
|
and publishes it to Gitea + GitHub releases.
|
||||||
|
|
||||||
## Interface description
|
---
|
||||||
|
|
||||||
Any command represents an ASCII string that contains a command name and a list of
|
## Logging
|
||||||
arguments corresponding to this command. There are reserved characters that cannot be
|
|
||||||
included in the command name and command arguments.
|
|
||||||
|
|
||||||
List of reserved characters: «:», «,», «;».
|
- **Single-strip entry:** callsign, RST tx/rx, name/QTH/grid, band/mode,
|
||||||
|
TX/RX frequency (split), start/end time, comment/note. The contacted entity's
|
||||||
|
**flag** is shown large next to the RST fields.
|
||||||
|
- **Callsign lookup** (QRZ.com / HamQTH) with photo, auto-fill of name/QTH/grid
|
||||||
|
and the QRZ.com tab.
|
||||||
|
- **Offline DXCC** resolution from `cty.dat` (country, CQ/ITU zones, continent),
|
||||||
|
with `/MM` `/AM` `/B` (beacon) and call-area (`/8`, `/W6`) handling, plus
|
||||||
|
ClubLog DXpedition date overrides.
|
||||||
|
- **Editable lists** for bands, modes (with their default RST) and **satellites**
|
||||||
|
— the satellite name on the entry form is offered as a dropdown, because
|
||||||
|
SAT_NAME is compared character for character by the awards and by LoTW.
|
||||||
|
- **Recent QSOs**, **Worked-before** matrix (per band/mode slot), bulk re-resolve
|
||||||
|
from cty/QRZ/ClubLog, bulk send to QSL services. A live **selection count**, a
|
||||||
|
**Select all / Unselect all** toggle, and a row limit that keeps the full log
|
||||||
|
fast **but is lifted while a filter is active** (every match is shown, not just
|
||||||
|
the first page).
|
||||||
|
- **Advanced QSO filter builder** (field / operator / value, AND / OR, saved
|
||||||
|
presets) with filtered- and selected-row **ADIF export**.
|
||||||
|
- **Find duplicates** (Tools) — groups QSOs by same call + band + mode (optionally
|
||||||
|
same day / minute) and lets you pick which to delete.
|
||||||
|
- **ADIF 3.1.7 compliant** import/export: a full field dictionary, 30 promoted
|
||||||
|
columns, a generic "extra fields" editor and standard/all export modes.
|
||||||
|
- **Profiles:** every setting is per-profile; each profile can point its logbook
|
||||||
|
at the local SQLite file or a **shared MySQL** database (multi-operator).
|
||||||
|
|
||||||
Command structure:
|
## Maps & antenna
|
||||||
1. Name of the command;
|
|
||||||
2. Separating character between command name and arguments «:»;
|
|
||||||
3. Separating character between arguments «,»;
|
|
||||||
4. End of the command character «;».
|
|
||||||
|
|
||||||
If a command has no arguments, an end of command symbol is placed after the command
|
- **Main view = two configurable panes** (per profile, Settings → General →
|
||||||
name. If the command is invalid, it is ignored. The case of letters does not matter.
|
*Main view*): great-circle map, locator (street) map, the cluster grid, the
|
||||||
|
worked-before grid, recent QSOs, the **FT decodes**, or any of the radio
|
||||||
|
consoles — **FlexRadio**, **Icom**, **Yaesu**, **Elecraft K3/K4**, **SunSDR
|
||||||
|
(TCI)** — and the **Net control** panel. Up to four panes, in columns or a
|
||||||
|
quadrant.
|
||||||
|
- **Great-circle map** with short/long-path distance & azimuth, selectable
|
||||||
|
basemaps (Light / Topo / Street / Satellite — Esri tiles, key-free and
|
||||||
|
labelled) and the **antenna beam lobe(s)** drawn from the rotor azimuth.
|
||||||
|
- **Rotor compass** (azimuthal-equidistant, click-to-turn) driven by
|
||||||
|
**PstRotator** (UDP), a **4O3A Rotator Genius** (native TCP) or a **microHAM
|
||||||
|
ARCO** controlled natively — no PstRotator needed — over the **LAN** or **USB**
|
||||||
|
using its Yaesu GS-232A protocol.
|
||||||
|
- **Ultrabeam** support (Normal / 180° reverse / Bidirectional): the radiating
|
||||||
|
direction is shown in green and the **mechanical boom** in grey, on both the
|
||||||
|
compass and the map, so you never lose track of where the antenna points.
|
||||||
|
|
||||||
The ExpertSDR3 program acts as a server, which can have several client connections at
|
## DX Cluster
|
||||||
the same time, they will be synchronized with each other by the server. When connecting to the
|
|
||||||
ExpertSDR3, the client receives the current status of the ExpertSDR3, first sending initialization
|
|
||||||
commands, then parameters to set the status, such as frequency, modulation, etc.
|
|
||||||
|
|
||||||
When a parameter change occurs in the ExpertSDR3 (server) program, the server notifies
|
- Multiple cluster servers with auto-reconnect, a master for commands.
|
||||||
all connected clients, i.e., clients do not need to poll the server constantly, any change of state
|
- **Filter sidebar** (callsign search, hide-worked, group duplicates, band /
|
||||||
will be sent in time to all clients. If the client sends a new state, the server will set it to itself, as
|
mode / status / source) shared by the Cluster tab and the Main-view cluster
|
||||||
well as send it to all clients, that is, the server acts as a synchronizer. All clients connected to the
|
pane, with a show/hide toggle.
|
||||||
server will be automatically synchronized. This way of work allows to minimize network load,
|
- Per-spot **status** (new / new-band / new-slot / worked), click-to-tune the
|
||||||
reducing traffic.
|
rig, and a multi-band **Band Map** (panadapter-style strips). Optionally, all
|
||||||
|
**digital modes count as one** (DXCC-style) for the new/new-slot colouring and
|
||||||
|
the worked-before matrix badges (Settings → General).
|
||||||
|
- **POTA** spots are tagged with their park reference (via `api.pota.app`).
|
||||||
|
- **Spot alerts:** rules on call / country / band / mode /
|
||||||
|
spotter, with sound, visual and e-mail notification (Tools → *Alert
|
||||||
|
management*).
|
||||||
|
|
||||||
The TCI protocol implements the transmission of receiver IQ stream to clients, which is
|
## CAT control
|
||||||
necessary for the work of special skimmer software, they automatically find the station and
|
|
||||||
decode it throughout the band, and it also allows you to record radio signals in the file.
|
|
||||||
|
|
||||||
TCI is also used to transmit audio signals of the receiver to clients and to receive audio
|
Six native backends (Settings → CAT), each with auto-reconnect and a fast,
|
||||||
signals from clients, i.e., the client can transmit audio signals to ExpertSDR3 for radio
|
non-blocking connect so a powered-off radio never freezes the app. The settings
|
||||||
transmission. The audio stream exchange is designed to work with digital modes, where encoding
|
ask two questions rather than one — **which radio**, then **how it is
|
||||||
and decoding is performed by third-party software, as well as in voice modes, where audio macros
|
connected** — and only offer the links that radio actually has:
|
||||||
can be broadcasted, which is very much in demand in contest loggers.
|
|
||||||
|
|
||||||
When working in contests, it is important to record all on the air operation, for this purpose
|
- **OmniRig** (Rig 1/2, hot-swap) — works with any OmniRig-supported rig.
|
||||||
the audio stream from the line-output is sent to all clients. The resulting audio stream can be
|
- **FlexRadio (SmartSDR)** over the radio's TCP API — real-time slice freq /
|
||||||
recorded to a file or played back with a PC sound card.
|
mode / split, UDP discovery, and **panadapter spots** (cluster spots pushed to
|
||||||
|
the Flex display; a click fills the call and **tunes the rig to the right
|
||||||
|
frequency AND mode**).
|
||||||
|
- **Icom CI-V** — native, over the radio's **USB** port *or* over the internet
|
||||||
|
via the radio's **built-in LAN server** (see *Remote Icom* below). No RS-BA1 or
|
||||||
|
Remote Utility needed.
|
||||||
|
- **Kenwood / Elecraft** — native ASCII CAT over USB or an RS232-to-Ethernet
|
||||||
|
bridge, for the K3 / K4 and the Kenwood dialect they share.
|
||||||
|
- **Yaesu** — native ASCII CAT (FA/FB/MD/VS…), which replaces OmniRig for an
|
||||||
|
FTDX and gives the Yaesu console below.
|
||||||
|
- **TCI** (WebSocket) — SunSDR / ExpertSDR3 and any TCI-compatible server:
|
||||||
|
freq / mode / PTT / split, panorama spots, **audio in both directions** and a
|
||||||
|
full console. See *TCI audio* below.
|
||||||
|
|
||||||
|
**CAT sharing:** OpsLog can hand the radio on to other programs while it holds
|
||||||
|
the port — a **Hamlib NET rigctl** server (WSJT-X, JTDX, MSHV, fldigi…) or a
|
||||||
|
**TCI** server. One or the other, on a port you choose.
|
||||||
|
|
||||||
|
Mode is taken from the radio; the digital sub-mode (FT4 vs FT8) is inferred from
|
||||||
|
the frequency. **Per-band Flex RX/TX antennas** can be configured and are applied
|
||||||
|
automatically on band change.
|
||||||
|
|
||||||
|
### FlexRadio control tab (SmartSDR-style)
|
||||||
|
|
||||||
|
Shown only when the CAT backend is a FlexRadio:
|
||||||
|
|
||||||
|
- **Transmit:** RF power, tune power, TUNE, MOX, speech processor (NOR/DX/DX+),
|
||||||
|
VOX (+ level + delay), monitor (+ level), mic gain.
|
||||||
|
- **Receive (active slice):** RX/TX **antenna** selectors and a **DAX** toggle
|
||||||
|
(TX audio through DAX, for WSJT-X & co), AGC mode/threshold, audio level,
|
||||||
|
NB / WNB / NR / ANF, and — on **SmartSDR v4** radios (8000 / Aurora series) —
|
||||||
|
the extra DSP tools **NRL, NRS, NRF** (with level) plus **RNN** (AI noise
|
||||||
|
reduction) and **ANFT** (FFT auto-notch), shown automatically when the radio
|
||||||
|
supports them. **RIT / XIT** with wheel / ± tuning.
|
||||||
|
- **Antenna tuner (ATU):** tune / bypass / memories.
|
||||||
|
- **Amplifier:** the amp card follows whichever amplifier is configured, with a
|
||||||
|
dropdown to pick it when **several amplifiers** are set up (e.g. two SPEs run
|
||||||
|
in parallel). See *Amplifiers & switches* below.
|
||||||
|
- **Live meters** over the UDP VITA-49 stream: S-meter (S-units), forward power
|
||||||
|
(W), SWR, ALC, PA temperature, voltage, plus the amplifier's meters.
|
||||||
|
|
||||||
|
### Elecraft K3 / K4 control tab
|
||||||
|
|
||||||
|
Shown for the Elecraft and Kenwood backends: power, AF/RF gain, mic gain,
|
||||||
|
squelch, preamp/attenuator, NB/NR/AGC, filter widths (200 Hz to 4.0 kHz, the
|
||||||
|
K3 maximum and the one FT8 wants), antenna selection, MOX and the ATU
|
||||||
|
(tap to tune, hold for in/out), RIT/XIT with ±10 / ±100 steps, key speed, and
|
||||||
|
live S / power / SWR meters. The SWR is read from the radio's own `SW;`.
|
||||||
|
|
||||||
|
### Yaesu control tab
|
||||||
|
|
||||||
|
Shown for the Yaesu backend: power, mic gain, AGC, NB/NR, preamp/attenuator,
|
||||||
|
filter width, RIT/XIT and the meters — the same shape as the others, driven by
|
||||||
|
the FTDX's own CAT set.
|
||||||
|
|
||||||
|
### SunSDR console (TCI)
|
||||||
|
|
||||||
|
Shown for the TCI backend. Drive and tune drive, mic gain, TUNE, power and SWR
|
||||||
|
while transmitting, volume, mute, squelch and its threshold, NB / NR / ANF,
|
||||||
|
APF in CW, AGC speed, filter widths **offered per mode**, RIT and XIT, and the
|
||||||
|
VFO lock. Levels can be dragged, scrolled, stepped or typed. The S-meter reads
|
||||||
|
real dBm, so its S-units are arithmetic rather than a calibration guess.
|
||||||
|
|
||||||
|
It costs nothing to keep open: TCI **pushes** every setting as it changes —
|
||||||
|
including changes made in the radio's own window, which the console follows
|
||||||
|
without asking anything.
|
||||||
|
|
||||||
|
### Icom control tab
|
||||||
|
|
||||||
|
Shown when the CAT backend is Icom (USB or network). A full RS-BA1-style console:
|
||||||
|
|
||||||
|
- **Twin VFO readout** (MAIN / SUB) with the big tabular frequency, mode badge,
|
||||||
|
band and RIT/ΔTX offset, and a **mode-button row** (SSB / CW / RTTY / PSK /
|
||||||
|
AM / FM).
|
||||||
|
- **Spectrum scope + waterfall** (panadapter): ON/OFF, CTR/FIX, double-click to
|
||||||
|
tune, and **◀ ⊙ ▶** buttons to centre the scope on the current frequency
|
||||||
|
(±50 kHz) and pan left/right.
|
||||||
|
- **Live meters** always visible: S-meter (click → fill RST), power in watts, SWR.
|
||||||
|
- **Receive DSP:** AF / RF gain, squelch, AGC, preamp, attenuator, filter
|
||||||
|
(FIL1/2/3), NB, NR, ANF and — **on CW only** — the **APF** (audio peak filter).
|
||||||
|
- **Passband / notch:** Twin PBT (inner / outer), manual notch + position.
|
||||||
|
- **Transmit:** RF power, MOX, TUNE, **split with an automatic offset**
|
||||||
|
(+5 kHz on SSB, +1 kHz on CW), and monitor. On **voice modes only**: mic gain,
|
||||||
|
speech compressor, VOX (+ gain + anti-VOX). Controls that don't apply to the
|
||||||
|
current mode are hidden automatically.
|
||||||
|
- **Bands & antenna:** one-touch band buttons and ANT1/ANT2 selection.
|
||||||
|
- **Clarifiers:** RIT and ΔTX with wheel / ± tuning (Ctrl+←/→ nudges RIT).
|
||||||
|
- **Power ON / OFF** buttons (manual by design — the app never wakes the rig on
|
||||||
|
connect).
|
||||||
|
- **CW keying** can run through the radio's own keyer (see *Keyers* below).
|
||||||
|
|
||||||
|
### Remote Icom (over the internet, no RS-BA1)
|
||||||
|
|
||||||
|
OpsLog speaks the IC-7610's built-in network protocol directly — it **replaces
|
||||||
|
both the Icom Remote Utility and RS-BA1**. Enter the radio's IP, the Network
|
||||||
|
User1 name/password and the CI-V address, and the whole Icom console works over
|
||||||
|
the LAN/internet: login + token (auto-renewed), CI-V tunnel, receive-side
|
||||||
|
retransmit for a rock-solid link even with the panadapter streaming, and manual
|
||||||
|
power ON/OFF. (Audio is out of scope — use the radio in USB + a voice link such
|
||||||
|
as Mumble.)
|
||||||
|
|
||||||
|
## Keyers & audio
|
||||||
|
|
||||||
|
- **CW keyer** with macros and F-key macros. The keyer engine is selectable:
|
||||||
|
**WinKeyer** (K1EL WK1/2/3 over a COM port), **FlexRadio CWX** (the radio's
|
||||||
|
built-in keyer over the SmartSDR API — type-ahead and backspace, no WinKeyer or
|
||||||
|
SmartCAT needed), **Icom** (the radio's own keyer over CI-V — no extra hardware,
|
||||||
|
works over the remote link too) or **TCI**.
|
||||||
|
- **Digital Voice Keyer** (DVK): record F1–F6 voice messages and transmit them.
|
||||||
|
- **QSO audio recording:** continuous rolling capture; on *Log QSO* the contact
|
||||||
|
is saved to a per-QSO WAV (`CALL_YYYYMMDD_HHMMSS.wav`); mixes RX + mic.
|
||||||
|
|
||||||
|
### TCI audio — no virtual cable
|
||||||
|
|
||||||
|
A SunSDR carries its audio on the same WebSocket as its commands, so OpsLog can
|
||||||
|
take it directly. Pick **Radio (TCI network audio)** as the *From radio* or
|
||||||
|
*To radio* device and the QSO recorder and the voice keyer work with no virtual
|
||||||
|
audio cable, no second sound card and nothing to set in the Windows mixer.
|
||||||
|
|
||||||
|
Transmit needs no setting up in ExpertSDR3 either: the audio source is named on
|
||||||
|
each key-down, so it works in SSB as well as the digital modes, and the
|
||||||
|
microphone stays the source for every transmission that is not a voice message.
|
||||||
|
|
||||||
|
## Amplifiers & switches
|
||||||
|
|
||||||
|
- **Amplifiers** — configure **one or several** amps (Settings → Amplifier is a
|
||||||
|
list; e.g. two SPEs run in parallel for more power). Each amp's control card
|
||||||
|
appears on the FlexRadio tab and in **Station Control**, with a dropdown to
|
||||||
|
choose which one it shows; the bottom status bar carries **one clickable chip
|
||||||
|
per amp** (green = OPERATE, orange = STANDBY, red = offline). Supported:
|
||||||
|
- **PowerGenius XL** (4O3A) over direct TCP — operate/standby, fan-mode
|
||||||
|
selector and fault display.
|
||||||
|
- **SPE Expert** (1.3K-FA / 1.5K-FA / 2K-FA) over **USB** (virtual COM) or the
|
||||||
|
**network** (RS232-to-Ethernet bridge) — operate/standby, ON/OFF,
|
||||||
|
Low / Mid / High output level, an output-power bar and live status (band,
|
||||||
|
SWR, PA current, temperature, warnings/alarms).
|
||||||
|
- **Acom** (500S / 600S / 700S / 1200S / 2020S) over **USB** or the **network**
|
||||||
|
(RS232-to-Ethernet bridge) — operate/standby/off and live telemetry (forward
|
||||||
|
& reflected power, SWR, PA temperature, band, fan, faults). Power-ON works
|
||||||
|
over a serial cable that wires the DTR/RTS lines.
|
||||||
|
- **Elecraft KPA500 / KPA1500** over **USB** (serial) or — on the KPA1500 —
|
||||||
|
over the **network**. Operate/standby, on/off, forward power, SWR,
|
||||||
|
temperature, supply voltage and current, the band, and faults named in plain
|
||||||
|
words rather than as a code. The amplifier follows the radio's band by
|
||||||
|
itself, on the link already open — it has a band command of its own, so no
|
||||||
|
second serial port is involved.
|
||||||
|
|
||||||
|
An amplifier that takes its band from a transceiver instead (Acom, SPE) can be
|
||||||
|
followed a second way: OpsLog answers its frequency polls as a Kenwood rig on
|
||||||
|
a **second COM port**, independent of the control link.
|
||||||
|
- **Antenna Genius** (4O3A) antenna switch over TCP/GSCP — a docked A/B
|
||||||
|
antenna-switch widget, and an option to write the **selected antenna into
|
||||||
|
MY_ANTENNA** under the name the switch itself carries.
|
||||||
|
- **Tuner Genius XL** (4O3A) over TCP — SWR and power, TUNE / BYPASS / OPERATE.
|
||||||
|
- **Station Control** panel (dockable, drag-to-reorder widgets): the **rotator**,
|
||||||
|
**Ultrabeam** element control and **relay boards** — WebSwitch 1216H, KMTronic,
|
||||||
|
**Denkovi** USB (FT245 D2XX bit-bang, 4 or 8 relays) and generic USB-serial
|
||||||
|
(CH340 / LCUS, A0 protocol) — for station power, antennas and accessories.
|
||||||
|
- **Relay auto-control** (Settings): switch Station-Control relays automatically
|
||||||
|
from the rig frequency / band (like PstRotator) — per relay, a frequency window
|
||||||
|
or a set of bands.
|
||||||
|
|
||||||
|
## QSL & awards
|
||||||
|
|
||||||
|
- **Awards engine:** built-in + custom award definitions (shared **globally**
|
||||||
|
across profiles) — DXCC, WAS / WAZ / WAC, WPX, IOTA / POTA / SOTA / WWFF,
|
||||||
|
**DDFM**, worked/confirmed/validated by band & mode, OR rules and manual
|
||||||
|
reference assignment, live reference detection on call entry, **reference-list
|
||||||
|
import** for totals/names, and a **Rescan** that re-pulls the logbook (picks up
|
||||||
|
fresh LoTW/QRZ confirmations).
|
||||||
|
- **Award statistics** by band and by mode class, with the **DXCC Challenge**
|
||||||
|
worked out where it can be compared to LoTW's own figure — it counts confirmed
|
||||||
|
band-slots on ten bands, and 60 m is not one of them, which is the whole of the
|
||||||
|
usual discrepancy. The band columns follow the bands you actually have contacts
|
||||||
|
on, up to and beyond 23 cm.
|
||||||
|
- **Russian districts (RDA):** an offline district database that knows where a
|
||||||
|
callsign was **on the day of the contact**, a bulk fill for existing QSOs, and
|
||||||
|
a comparison against the district an imported log carries — each disagreement
|
||||||
|
settled on its own row, with the choice written into the contact.
|
||||||
|
- **QSL services:** ClubLog (batched ADIF upload), LoTW, QRZ.com, eQSL,
|
||||||
|
**Cloudlog / Wavelog** and **HAMLOG.online** — upload and **confirmation
|
||||||
|
download** (which auto-refreshes the award stats).
|
||||||
|
- **QSL Card Designer** (see below).
|
||||||
|
- **E-mail eQSL:** right-click a QSO → *Send eQSL by e-mail* via the configured
|
||||||
|
SMTP account. (Outlook/Hotmail disable basic-auth SMTP — use Gmail with an app
|
||||||
|
password, or a Microsoft app password.)
|
||||||
|
|
||||||
|
## Contest logging
|
||||||
|
|
||||||
|
- **Contest tab:** pick a contest (built-in ADIF `CONTEST_ID` list) and an
|
||||||
|
exchange (running serial or a fixed exchange). OpsLog auto-fills `CONTEST_ID`
|
||||||
|
and the sent/received serials (`STX` / `SRX`), enforces a window start/end,
|
||||||
|
flags dupes and keeps a live scoreboard.
|
||||||
|
|
||||||
|
## Statistics
|
||||||
|
|
||||||
|
- **Logbook statistics dashboard:** headline tiles (QSOs, unique callsigns, DXCC
|
||||||
|
entities, continents, % confirmed) plus charts — QSOs **by mode**, a per-band
|
||||||
|
**CW / phone / data** split, **activity over time** (rolling day / 7-day /
|
||||||
|
30-day / 12-month views), by operator and by continent. Date-range, per-operator
|
||||||
|
and per-contest filters, and a **Table** view that mirrors every chart.
|
||||||
|
|
||||||
|
## Multi-operator live status (special events)
|
||||||
|
|
||||||
|
For a multi-op special-event call on a shared MySQL logbook (e.g. **TM74TFR**),
|
||||||
|
publishing is **automatic** — no setting to turn on. Each OpsLog instance
|
||||||
|
heartbeats its current activity (operator call, band, frequency, mode) into a
|
||||||
|
`live_status` table every ~15 s, and drops back to *off air* automatically 5 min
|
||||||
|
after the last logged QSO. A small PHP renderer
|
||||||
|
([`docs/livestatus/tm74-status.php`](docs/livestatus/tm74-status.php)) on your
|
||||||
|
own web server reads that table and produces a live page/image you can embed on
|
||||||
|
the station's **QRZ.com** bio (`<img src="…/tm74-status.php?img=1">`). OpsLog
|
||||||
|
only writes to the DB — it is not a web server.
|
||||||
|
|
||||||
|
## Net control
|
||||||
|
|
||||||
|
- **Directed-net logging** (Tools → Net): a global roster (`nets.json`) plus an
|
||||||
|
in-memory active session — check stations in, then log them individually or the
|
||||||
|
whole net at once (**Log everyone**) using the CAT frequency. **Drag & drop**
|
||||||
|
between the two lists (roster → on-air starts a QSO, on-air → roster logs it),
|
||||||
|
and after each log the next on-air station is selected automatically so you can
|
||||||
|
chain contacts.
|
||||||
|
|
||||||
|
## Appearance & language
|
||||||
|
|
||||||
|
- **Themes:** four complete themes (Warm light, Warm dark, Graphite dark, High
|
||||||
|
contrast) plus **Auto** (follows the OS light/dark preference), selectable in
|
||||||
|
Settings → General. Every panel and every AG-Grid table follows the theme.
|
||||||
|
- **Bilingual:** full **English / French** UI, with a first-run flag chooser and
|
||||||
|
a switcher in Settings → General.
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
- **Secret vault:** opt-in passphrase encryption of the stored passwords
|
||||||
|
(AES-GCM + PBKDF2). Encrypted values are portable; a single unlock prompt at
|
||||||
|
launch decrypts them for the session.
|
||||||
|
|
||||||
|
## Integrations (outbound)
|
||||||
|
|
||||||
|
- **UDP emitters:** push the current frequency to **PstRotator**, radio info in
|
||||||
|
**N1MM `RadioInfo`** format, or an **ADIF record on each logged QSO** — so
|
||||||
|
external tools (rotator control, digital apps, other loggers) stay in sync.
|
||||||
|
- **CAT sharing:** a **Hamlib NET rigctl** or **TCI** server, so WSJT-X, JTDX,
|
||||||
|
MSHV, fldigi and the rest still reach the radio while OpsLog holds the port.
|
||||||
|
- **WSJT-X / JTDX / MSHV** decodes over UDP: the heard stations feed the band
|
||||||
|
map, the alerts and — on a FlexRadio — the panadapter.
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- **Autostart:** launch external programs (WSJT-X, JTAlert, rotator control…) at
|
||||||
|
OpsLog startup, skipping any already running.
|
||||||
|
- **Backup:** optional database + ADIF backup at shutdown.
|
||||||
|
- **Update check** at startup and every 5 minutes (and on opening Help → About),
|
||||||
|
with a toast (toggleable), plus a **What's new** dialog that shows the changelog
|
||||||
|
(English / French) on the first launch after an update — reopenable any time
|
||||||
|
from the Help menu.
|
||||||
|
- **Anonymous usage telemetry** (a once-a-day heartbeat: random install ID +
|
||||||
|
version + OS — no callsign or QSO data; opt-out in Preferences).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## QSL Card Designer
|
||||||
|
|
||||||
|
Tools → *QSL Card Designer…* turns a few photos into a polished eQSL card:
|
||||||
|
|
||||||
|
1. Pick 1–6 photos (jpeg/png). OpsLog analyzes them offline (detail/luminance
|
||||||
|
grid) and proposes **3 designs** — callsign in the calmest zone of the best
|
||||||
|
photo, operator name, CQ/ITU zones + locator line, country flag, the other
|
||||||
|
photos as bordered inserts, and a per-QSO confirmation box.
|
||||||
|
2. Pick a proposal and fine-tune it: click an element to select, drag to move,
|
||||||
|
change font / style preset (gel gold, gel silver, classic white outline,
|
||||||
|
script, flat) and per-preset knobs in the right panel.
|
||||||
|
3. Save the template (photos are copied into `data/qsl/templates/<id>/`, so the
|
||||||
|
originals can move). One template can be the default per profile.
|
||||||
|
|
||||||
|
Sending: right-click a QSO → *Send eQSL by e-mail*. The card is rendered with
|
||||||
|
that QSO's data, rasterized to a ≤ 800 KB JPEG, archived in `data/qsl/outbox/`
|
||||||
|
and sent through the configured SMTP account to the address found by the
|
||||||
|
QRZ/HamQTH lookup. On success the QSO is stamped `EQSL_SENT=Y` (ADIF). The
|
||||||
|
e-mail subject/body templates live in the designer
|
||||||
|
(`{CALL} {DATE} {BAND} {MODE} {MYCALL}` variables).
|
||||||
|
|
||||||
|
Fonts: Archivo Black, Lilita One, Baloo 2, Oswald, Great Vibes, Allura (all
|
||||||
|
OFL, embedded — licenses in `internal/qslcard/assets/fonts/`); Cooper Black is
|
||||||
|
offered when MS Office installed it. Flags: flag-icons (MIT), embedded for the
|
||||||
|
commonly-worked DXCC entities.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Importing a log
|
||||||
|
|
||||||
|
- **ADIF import** with duplicate handling (skip / update / import anyway) and an
|
||||||
|
optional field mapping for exports that use their own names.
|
||||||
|
- Optionally recompute country / continent / DXCC / zones from **cty.dat** and
|
||||||
|
the **ClubLog date-ranged exceptions** — which know that a callsign belonged to
|
||||||
|
a different entity on an older date.
|
||||||
|
- **Deleted DXCC entities are left alone.** cty.dat only knows where a callsign
|
||||||
|
is *today*: R1MVI resolves to European Russia now, but a 2004 contact was Malyj
|
||||||
|
Vysotskij — an entity the ARRL deleted in 2012 and which can never be worked
|
||||||
|
again. Where a record names one of the sixty-odd deleted entities, its own
|
||||||
|
number is kept.
|
||||||
|
|
||||||
|
## Data & storage
|
||||||
|
|
||||||
|
- **Config** (settings, profiles, rigs/antennas, cluster nodes, lookup cache,
|
||||||
|
award lists, QSL templates) always lives in the local SQLite file under
|
||||||
|
`data/` — instant even when the logbook is on a far-away MySQL.
|
||||||
|
- **Logbook** (QSOs) lives where the active profile points it: the local SQLite
|
||||||
|
file or a per-profile shared **MySQL** database.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*A French version of this document is available in [README.fr.md](README.fr.md).*
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ import (
|
|||||||
"hamlog/internal/tunergenius"
|
"hamlog/internal/tunergenius"
|
||||||
"hamlog/internal/uls"
|
"hamlog/internal/uls"
|
||||||
"hamlog/internal/ultrabeam"
|
"hamlog/internal/ultrabeam"
|
||||||
|
"hamlog/internal/watchlist"
|
||||||
"hamlog/internal/winkeyer"
|
"hamlog/internal/winkeyer"
|
||||||
|
|
||||||
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
@@ -97,6 +98,7 @@ const (
|
|||||||
|
|
||||||
keyStationCallsign = "station.callsign"
|
keyStationCallsign = "station.callsign"
|
||||||
keyStationOperator = "station.operator"
|
keyStationOperator = "station.operator"
|
||||||
|
keyWatchlistContestPattern = "watchlist.contest_pattern" // auto-add contest calls containing this
|
||||||
keyStationMyGrid = "station.my_grid"
|
keyStationMyGrid = "station.my_grid"
|
||||||
keyStationCountry = "station.my_country"
|
keyStationCountry = "station.my_country"
|
||||||
keyStationSOTA = "station.my_sota_ref"
|
keyStationSOTA = "station.my_sota_ref"
|
||||||
@@ -402,6 +404,8 @@ const (
|
|||||||
|
|
||||||
keyExtLoTWTQSLPath = "extsvc.lotw.tqsl_path"
|
keyExtLoTWTQSLPath = "extsvc.lotw.tqsl_path"
|
||||||
keyExtLoTWStationLoc = "extsvc.lotw.station_location"
|
keyExtLoTWStationLoc = "extsvc.lotw.station_location"
|
||||||
|
keyExtLoTWQSLDetail = "extsvc.lotw.qsl_detail" // ask LoTW for the QSL dates and station details (an order of magnitude slower)
|
||||||
|
keyExtLoTWAllCalls = "extsvc.lotw.download_all_calls" // download confirmations for EVERY call on the account, not just this profile's
|
||||||
keyExtLoTWForceCall = "extsvc.lotw.force_station_callsign" // override STATION_CALLSIGN at sign time (e.g. F4BPO/P on the F4BPO cert)
|
keyExtLoTWForceCall = "extsvc.lotw.force_station_callsign" // override STATION_CALLSIGN at sign time (e.g. F4BPO/P on the F4BPO cert)
|
||||||
keyExtLoTWKeyPassword = "extsvc.lotw.key_password"
|
keyExtLoTWKeyPassword = "extsvc.lotw.key_password"
|
||||||
keyExtLoTWUploadFlag = "extsvc.lotw.upload_flag" // legacy single flag (migrated to upload_flags)
|
keyExtLoTWUploadFlag = "extsvc.lotw.upload_flag" // legacy single flag (migrated to upload_flags)
|
||||||
@@ -733,6 +737,10 @@ type App struct {
|
|||||||
uls *uls.Store // US callsign→county/grid (offline FCC ULS), lazily opened
|
uls *uls.Store // US callsign→county/grid (offline FCC ULS), lazily opened
|
||||||
awardRefs *awardref.Repo
|
awardRefs *awardref.Repo
|
||||||
qslTemplates *qslcard.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
|
operating *operating.Repo
|
||||||
udp *udp.Manager
|
udp *udp.Manager
|
||||||
udpRepo *udp.Repo
|
udpRepo *udp.Repo
|
||||||
@@ -1013,6 +1021,13 @@ func (a *App) startup(ctx context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
a.dataDir = dataDir
|
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/config database (settings + profiles). Fresh installs use
|
||||||
// settings.db; existing installs keep their opslog.db (which also held the
|
// settings.db; existing installs keep their opslog.db (which also held the
|
||||||
// QSOs before they were split into a dedicated logbook file — see below).
|
// QSOs before they were split into a dedicated logbook file — see below).
|
||||||
@@ -1383,6 +1398,8 @@ func (a *App) startup(ctx context.Context) {
|
|||||||
// POTA: background poller of api.pota.app so cluster spots can be tagged
|
// POTA: background poller of api.pota.app so cluster spots can be tagged
|
||||||
// when the DX station is currently activating a park. Best-effort.
|
// 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.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)
|
go a.pota.Run(a.ctx)
|
||||||
|
|
||||||
// DX Cluster (multi-server): the spot callback enriches each spot
|
// DX Cluster (multi-server): the spot callback enriches each spot
|
||||||
@@ -1794,6 +1811,9 @@ func (a *App) setSettingGlobal(key, val string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) shutdown(ctx context.Context) {
|
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,
|
// If the user managed to skip beforeClose (force kill, OS shutdown,
|
||||||
// crash recovery) we still try the backup here as a best-effort
|
// crash recovery) we still try the backup here as a best-effort
|
||||||
// safety net. HasBackupToday makes a double-run a no-op.
|
// safety net. HasBackupToday makes a double-run a no-op.
|
||||||
@@ -2122,6 +2142,21 @@ func (a *App) saveWindowState() {
|
|||||||
// position — which options can't express — remains, and it is set here while the
|
// position — which options can't express — remains, and it is set here while the
|
||||||
// window is still hidden, so there is no visible jump. Nothing to do for a
|
// window is still hidden, so there is no visible jump. Nothing to do for a
|
||||||
// maximised or first-run window.
|
// maximised or first-run window.
|
||||||
|
// moveWindowTo places the window at an ABSOLUTE desktop coordinate — the same
|
||||||
|
// coordinate system WindowGetPosition reports and window.json stores.
|
||||||
|
//
|
||||||
|
// Wails' WindowSetPosition is relative to the current monitor's work area (see
|
||||||
|
// windowpos_windows.go), so on a monitor left of the primary one it added that
|
||||||
|
// monitor's negative origin to an already-absolute value and the window walked
|
||||||
|
// one screen further off the desktop at every launch. Fall back to it only when
|
||||||
|
// we cannot place the window ourselves — on the primary monitor the two agree.
|
||||||
|
func (a *App) moveWindowTo(x, y int) {
|
||||||
|
if setWindowPosAbsolute(x, y) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wruntime.WindowSetPosition(a.ctx, x, y)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *App) restoreWindowPosition() {
|
func (a *App) restoreWindowPosition() {
|
||||||
if a.ctx == nil {
|
if a.ctx == nil {
|
||||||
return
|
return
|
||||||
@@ -2149,7 +2184,7 @@ func (a *App) restoreWindowPosition() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
wruntime.WindowUnmaximise(a.ctx)
|
wruntime.WindowUnmaximise(a.ctx)
|
||||||
wruntime.WindowSetPosition(a.ctx, ws.X, ws.Y)
|
a.moveWindowTo(ws.X, ws.Y)
|
||||||
wruntime.WindowMaximise(a.ctx)
|
wruntime.WindowMaximise(a.ctx)
|
||||||
gx, gy := wruntime.WindowGetPosition(a.ctx)
|
gx, gy := wruntime.WindowGetPosition(a.ctx)
|
||||||
applog.Printf("window: re-maximised at the saved corner — now at %d,%d", gx, gy)
|
applog.Printf("window: re-maximised at the saved corner — now at %d,%d", gx, gy)
|
||||||
@@ -2177,10 +2212,13 @@ func (a *App) restoreWindowPosition() {
|
|||||||
}
|
}
|
||||||
applog.Printf("window: saved position %d,%d is off every monitor (%s) — moved to %d,%d",
|
applog.Printf("window: saved position %d,%d is off every monitor (%s) — moved to %d,%d",
|
||||||
ws.X, ws.Y, describeMonitors(monitorRects()), nx, ny)
|
ws.X, ws.Y, describeMonitors(monitorRects()), nx, ny)
|
||||||
wruntime.WindowSetPosition(a.ctx, nx, ny)
|
a.moveWindowTo(nx, ny)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
wruntime.WindowSetPosition(a.ctx, ws.X, ws.Y)
|
a.moveWindowTo(ws.X, ws.Y)
|
||||||
|
if gx, gy := wruntime.WindowGetPosition(a.ctx); gx != ws.X || gy != ws.Y {
|
||||||
|
applog.Printf("window: asked for %d,%d and the window reports %d,%d", ws.X, ws.Y, gx, gy)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// onSomeMonitor reports whether a window at these coordinates would land on the
|
// onSomeMonitor reports whether a window at these coordinates would land on the
|
||||||
@@ -3338,6 +3376,10 @@ func (a *App) applyStationDefaults(q *qso.QSO, includeIdentity bool) {
|
|||||||
// Per-band rig/antenna from Operating conditions (the antenna ticked as
|
// Per-band rig/antenna from Operating conditions (the antenna ticked as
|
||||||
// DEFAULT for this band) — the same auto-fill the entry strip does, applied
|
// DEFAULT for this band) — the same auto-fill the entry strip does, applied
|
||||||
// here so imported QSOs get MY_RIG / MY_ANTENNA from the band defaults.
|
// here so imported QSOs get MY_RIG / MY_ANTENNA from the band defaults.
|
||||||
|
// The radio that is CONNECTED names itself first — see activeRadioMyRig.
|
||||||
|
if q.MyRig == "" {
|
||||||
|
q.MyRig = a.activeRadioMyRig()
|
||||||
|
}
|
||||||
if a.operating != nil && q.Band != "" && (q.MyRig == "" || q.MyAntenna == "") {
|
if a.operating != nil && q.Band != "" && (q.MyRig == "" || q.MyAntenna == "") {
|
||||||
if d, ok, _ := a.operating.BandDefault(a.ctx, p.ID, q.Band); ok {
|
if d, ok, _ := a.operating.BandDefault(a.ctx, p.ID, q.Band); ok {
|
||||||
if q.MyRig == "" {
|
if q.MyRig == "" {
|
||||||
@@ -6914,6 +6956,28 @@ func (a *App) BulkUpdateField(ids []int64, field, value string) (int64, error) {
|
|||||||
if field == "freq" {
|
if field == "freq" {
|
||||||
return a.bulkSetFrequency(ids, value)
|
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
|
// 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
|
// (OWNER_CALLSIGN) — those take the JSON path so the rest of the extras on
|
||||||
// each QSO survive the edit.
|
// each QSO survive the edit.
|
||||||
@@ -7228,7 +7292,9 @@ func (a *App) SetCompactMode(on bool) {
|
|||||||
wruntime.WindowSetMinSize(a.ctx, normalMinW, normalMinH)
|
wruntime.WindowSetMinSize(a.ctx, normalMinW, normalMinH)
|
||||||
if a.preCompactValid {
|
if a.preCompactValid {
|
||||||
wruntime.WindowSetSize(a.ctx, a.preCompactW, a.preCompactH)
|
wruntime.WindowSetSize(a.ctx, a.preCompactW, a.preCompactH)
|
||||||
wruntime.WindowSetPosition(a.ctx, a.preCompactX, a.preCompactY)
|
// Absolute, like the capture — see moveWindowTo. Leaving compact mode on a
|
||||||
|
// monitor left of the primary one moved the window a screen further out.
|
||||||
|
a.moveWindowTo(a.preCompactX, a.preCompactY)
|
||||||
if a.preCompactMax {
|
if a.preCompactMax {
|
||||||
wruntime.WindowMaximise(a.ctx)
|
wruntime.WindowMaximise(a.ctx)
|
||||||
}
|
}
|
||||||
@@ -8324,6 +8390,12 @@ func (a *App) SaveCATSettings(s CATSettings) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// The saved radio follows what was just edited.
|
||||||
|
//
|
||||||
|
// Without this, an operator with two rigs edits the one on the air, switches
|
||||||
|
// to the other and back, and finds the edit gone — the list would still hold
|
||||||
|
// what that entry looked like when it was created. See app_radios.go.
|
||||||
|
a.syncActiveRadio(s)
|
||||||
a.restartAsync("cat", a.reloadCAT)
|
a.restartAsync("cat", a.reloadCAT)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -8921,6 +8993,11 @@ func (a *App) clusterEventWorker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// SOTA: the summit is in the spot's own text — the SOTA feeds put it
|
||||||
|
// there — so it costs a regex rather than an API lookup.
|
||||||
|
if s.SOTARef == "" {
|
||||||
|
s.SOTARef = cluster.SOTARefFrom(s.Comment)
|
||||||
|
}
|
||||||
// POTA: tag the spot when the DX station is currently activating a park.
|
// POTA: tag the spot when the DX station is currently activating a park.
|
||||||
if a.pota != nil {
|
if a.pota != nil {
|
||||||
if info, ok := a.pota.Lookup(s.DXCall); ok {
|
if info, ok := a.pota.Lookup(s.DXCall); ok {
|
||||||
@@ -8944,6 +9021,10 @@ func (a *App) clusterEventWorker() {
|
|||||||
a.detectBandOpening(s)
|
a.detectBandOpening(s)
|
||||||
// Fire any matching alert rules (sound / visual / e-mail).
|
// Fire any matching alert rules (sound / visual / e-mail).
|
||||||
a.evaluateAlerts(s)
|
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
|
// 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
|
// 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,
|
// panadapter tunes AND switches mode — a DX cluster line carries no mode,
|
||||||
@@ -11289,11 +11370,19 @@ func (a *App) runManualUpload(svc extsvc.Service, ids []int64, cfg extsvc.Extern
|
|||||||
}
|
}
|
||||||
res, err := extsvc.UploadLoTW(ctx, cfg.LoTW, "", strings.Join(recs, "\n"))
|
res, err := extsvc.UploadLoTW(ctx, cfg.LoTW, "", strings.Join(recs, "\n"))
|
||||||
if err != nil || !res.OK {
|
if err != nil || !res.OK {
|
||||||
msg := res.Message
|
// The DETAIL wins over the error string. UploadLoTW returns both: a
|
||||||
if err != nil {
|
// terse error ("no QSOs processed") and a Message carrying TQSL's own
|
||||||
|
// account of what happened to the contacts ("…already uploaded", "…out
|
||||||
|
// of date range"). Taking the error whenever there was one threw the
|
||||||
|
// answer away and showed the operator the half that explains nothing.
|
||||||
|
msg := strings.TrimSpace(res.Message)
|
||||||
|
if msg == "" && err != nil {
|
||||||
msg = err.Error()
|
msg = err.Error()
|
||||||
|
} else if err != nil && !strings.Contains(msg, err.Error()) {
|
||||||
|
msg = msg + " (" + err.Error() + ")"
|
||||||
}
|
}
|
||||||
emit("LoTW upload failed: " + msg)
|
emit("LoTW upload failed: " + msg)
|
||||||
|
emit(" The station location OpsLog signs with must match the callsign on these contacts, and their dates must fall inside the certificate's validity — TQSL refuses the whole batch otherwise.")
|
||||||
// The qslmgr:log console is only visible in the QSL Manager — a failure
|
// The qslmgr:log console is only visible in the QSL Manager — a failure
|
||||||
// triggered from the Recent QSOs right-click was completely silent, which
|
// triggered from the Recent QSOs right-click was completely silent, which
|
||||||
// read as "send to LoTW does nothing". Surface it as a toast too.
|
// read as "send to LoTW does nothing". Surface it as a toast too.
|
||||||
@@ -11531,6 +11620,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.
|
// with award-style NEW flags computed against the log's prior confirmations.
|
||||||
type ConfirmationItem struct {
|
type ConfirmationItem struct {
|
||||||
Callsign string `json:"callsign"`
|
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
|
QSODate string `json:"qso_date"` // ISO UTC
|
||||||
Band string `json:"band"`
|
Band string `json:"band"`
|
||||||
Mode string `json:"mode"`
|
Mode string `json:"mode"`
|
||||||
@@ -12081,6 +12174,27 @@ func manualRefFor(existing, code string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLoTWQSLDetail reports whether the download asks LoTW for the QSL detail.
|
||||||
|
func (a *App) GetLoTWQSLDetail() bool {
|
||||||
|
return a.settingOr(keyExtLoTWQSLDetail, "") == "1"
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLoTWQSLDetail stores that choice.
|
||||||
|
func (a *App) SetLoTWQSLDetail(on bool) {
|
||||||
|
a.setSetting(keyExtLoTWQSLDetail, map[bool]string{true: "1", false: "0"}[on])
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLoTWDownloadAllCalls reports whether the LoTW download ignores the
|
||||||
|
// profile's own call and pulls every callsign on the account.
|
||||||
|
func (a *App) GetLoTWDownloadAllCalls() bool {
|
||||||
|
return a.settingOr(keyExtLoTWAllCalls, "") == "1"
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLoTWDownloadAllCalls stores that choice.
|
||||||
|
func (a *App) SetLoTWDownloadAllCalls(on bool) {
|
||||||
|
a.setSetting(keyExtLoTWAllCalls, map[bool]string{true: "1", false: "0"}[on])
|
||||||
|
}
|
||||||
|
|
||||||
// DownloadConfirmations pulls confirmed QSOs from a service and updates the
|
// DownloadConfirmations pulls confirmed QSOs from a service and updates the
|
||||||
// matching local QSOs' received status. LoTW only for now (the canonical
|
// matching local QSOs' received status. LoTW only for now (the canonical
|
||||||
// confirmation system); runs in the background emitting the same
|
// confirmation system); runs in the background emitting the same
|
||||||
@@ -12152,7 +12266,30 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
|
|||||||
case extsvc.ServiceLoTW:
|
case extsvc.ServiceLoTW:
|
||||||
sinceDate := resolveSince(keyExtLoTWLastDownload)
|
sinceDate := resolveSince(keyExtLoTWLastDownload)
|
||||||
ownCall := a.uploadOwnerCall(extsvc.ServiceLoTW)
|
ownCall := a.uploadOwnerCall(extsvc.ServiceLoTW)
|
||||||
|
// A LoTW account holds every call its owner operates — F4BPO, F4BPO/P,
|
||||||
|
// TM2Q — and the download is normally scoped to the profile's own call so
|
||||||
|
// one profile does not pull another's confirmations. That scope also
|
||||||
|
// silently hides them: a QSO made as F4BPO/P is confirmed at LoTW and can
|
||||||
|
// never be downloaded from the F4BPO profile, so it stays unconfirmed here
|
||||||
|
// for good while the ARRL counts it. Off by default, because the scope is
|
||||||
|
// right for anyone whose profiles are separate stations.
|
||||||
|
if a.settingOr(keyExtLoTWAllCalls, "") == "1" {
|
||||||
|
ownCall = ""
|
||||||
|
}
|
||||||
callLabel := ownCall
|
callLabel := ownCall
|
||||||
|
// Unscoped, the report carries every station on the account — including
|
||||||
|
// the ones belonging to ANOTHER profile's logbook (a Vietnam expedition,
|
||||||
|
// say). Those confirmations have nothing to match here, and with "add the
|
||||||
|
// ones not found" ticked they would pour a second log into this one. So
|
||||||
|
// the station callsigns this logbook actually holds become the filter:
|
||||||
|
// F4BPO/P is kept because it was worked here, XV9Q is skipped because it
|
||||||
|
// never was.
|
||||||
|
var ownStations map[string]bool
|
||||||
|
if ownCall == "" {
|
||||||
|
if st, e := a.qso.StationCallsigns(ctx); e == nil && len(st) > 0 {
|
||||||
|
ownStations = st
|
||||||
|
}
|
||||||
|
}
|
||||||
if callLabel == "" {
|
if callLabel == "" {
|
||||||
callLabel = "all callsigns"
|
callLabel = "all callsigns"
|
||||||
}
|
}
|
||||||
@@ -12162,13 +12299,36 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
|
|||||||
emit(fmt.Sprintf("Downloading all LoTW confirmations for %s…", callLabel))
|
emit(fmt.Sprintf("Downloading all LoTW confirmations for %s…", callLabel))
|
||||||
}
|
}
|
||||||
emit(fmt.Sprintf("Window: since=%q → resolved=%q (scope owncall=%q)", since, sinceDate, ownCall))
|
emit(fmt.Sprintf("Window: since=%q → resolved=%q (scope owncall=%q)", since, sinceDate, ownCall))
|
||||||
adifText, err := extsvc.DownloadLoTWConfirmations(ctx, nil, cfg.LoTW, sinceDate, ownCall)
|
// The report arrives over minutes, and a window that says nothing while it
|
||||||
|
// does is indistinguishable from one that has hung — which is what it was
|
||||||
|
// being reported as. Every half-megabyte, say how much has landed.
|
||||||
|
// Adding the QSOs LoTW knows and we do not is the one job that needs the
|
||||||
|
// slow report: without the detail those records would come in with no
|
||||||
|
// grid, state or county, and nothing else would ever fill them.
|
||||||
|
detail := addNotFound || a.settingOr(keyExtLoTWQSLDetail, "") == "1"
|
||||||
|
if detail {
|
||||||
|
emit("Asking for the QSL details too — LoTW takes considerably longer to build that report.")
|
||||||
|
}
|
||||||
|
adifText, err := extsvc.DownloadLoTWConfirmations(ctx, nil, cfg.LoTW, sinceDate, ownCall, detail, emit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
emit("Download failed: " + err.Error())
|
emit("Download failed: " + err.Error())
|
||||||
done(matched, total)
|
done(matched, total)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
emit(fmt.Sprintf("LoTW returned %d KB of ADIF", len(adifText)/1024))
|
emit(fmt.Sprintf("LoTW returned %d KB of ADIF", len(adifText)/1024))
|
||||||
|
// A report far smaller than the account justifies is the one failure that
|
||||||
|
// looks like success: LoTW answers 200 with a near-empty ADIF when it
|
||||||
|
// disagrees with the query (an unknown callsign in qso_owncall, a login
|
||||||
|
// that half-worked). Show its own header rather than leaving "matched 1 of
|
||||||
|
// 1" to be read as "you have one confirmation".
|
||||||
|
if len(adifText) < 4096 {
|
||||||
|
head := strings.TrimSpace(adifText)
|
||||||
|
if len(head) > 400 {
|
||||||
|
head = head[:400]
|
||||||
|
}
|
||||||
|
emit("The report is unexpectedly small — what LoTW actually sent:")
|
||||||
|
emit(" " + strings.Join(strings.Fields(head), " "))
|
||||||
|
}
|
||||||
keyIDs, kerr := a.qso.DedupeKeyIDs(ctx)
|
keyIDs, kerr := a.qso.DedupeKeyIDs(ctx)
|
||||||
if kerr != nil {
|
if kerr != nil {
|
||||||
emit("Error reading local log: " + kerr.Error())
|
emit("Error reading local log: " + kerr.Error())
|
||||||
@@ -12186,6 +12346,7 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
|
|||||||
sets, _ := a.qso.ConfirmedSlots(ctx, []string{"lotw_rcvd", "qsl_rcvd"})
|
sets, _ := a.qso.ConfirmedSlots(ctx, []string{"lotw_rcvd", "qsl_rcvd"})
|
||||||
var items []ConfirmationItem
|
var items []ConfirmationItem
|
||||||
var unmatched []string
|
var unmatched []string
|
||||||
|
skippedOtherStation := 0
|
||||||
perr := adif.Parse(strings.NewReader(adifText), func(rec adif.Record) error {
|
perr := adif.Parse(strings.NewReader(adifText), func(rec adif.Record) error {
|
||||||
if ctx.Err() != nil {
|
if ctx.Err() != nil {
|
||||||
return ctx.Err() // window closed / superseded
|
return ctx.Err() // window closed / superseded
|
||||||
@@ -12194,6 +12355,16 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
// Another station's confirmation — see ownStations above. Counted so
|
||||||
|
// the report says how many were left alone rather than silently
|
||||||
|
// dropping a third of the file.
|
||||||
|
if ownStations != nil {
|
||||||
|
st := strings.ToUpper(strings.TrimSpace(rec["station_callsign"]))
|
||||||
|
if st != "" && !ownStations[st] {
|
||||||
|
skippedOtherStation++
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
total++
|
total++
|
||||||
date := rec["qslrdate"]
|
date := rec["qslrdate"]
|
||||||
if date == "" {
|
if date == "" {
|
||||||
@@ -12242,6 +12413,7 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
|
|||||||
}
|
}
|
||||||
it := ConfirmationItem{
|
it := ConfirmationItem{
|
||||||
Callsign: q.Callsign,
|
Callsign: q.Callsign,
|
||||||
|
Station: strings.ToUpper(strings.TrimSpace(rec["station_callsign"])),
|
||||||
QSODate: q.QSODate.UTC().Format(time.RFC3339),
|
QSODate: q.QSODate.UTC().Format(time.RFC3339),
|
||||||
Band: q.Band,
|
Band: q.Band,
|
||||||
Mode: q.Mode,
|
Mode: q.Mode,
|
||||||
@@ -12274,6 +12446,9 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
|
|||||||
} else {
|
} else {
|
||||||
emit(fmt.Sprintf("Matched %d of %d confirmed QSO(s)", matched, total))
|
emit(fmt.Sprintf("Matched %d of %d confirmed QSO(s)", matched, total))
|
||||||
}
|
}
|
||||||
|
if skippedOtherStation > 0 {
|
||||||
|
emit(fmt.Sprintf(" (%d confirmation(s) skipped — made under a callsign this logbook has never used)", skippedOtherStation))
|
||||||
|
}
|
||||||
if byClass > 0 {
|
if byClass > 0 {
|
||||||
// Said out loud rather than folded silently into the total: these
|
// Said out loud rather than folded silently into the total: these
|
||||||
// matched on the mode CLASS, not the mode. LoTW hands back "DATA" for
|
// matched on the mode CLASS, not the mode. LoTW hands back "DATA" for
|
||||||
@@ -13395,7 +13570,12 @@ func (a *App) LogUDPLoggedADIF(adifText string) (int64, error) {
|
|||||||
|
|
||||||
// ── Operating-conditions stamp ──
|
// ── Operating-conditions stamp ──
|
||||||
// Pre-fill MY_RIG / MY_ANTENNA / TX_PWR from the default antenna for
|
// Pre-fill MY_RIG / MY_ANTENNA / TX_PWR from the default antenna for
|
||||||
// this band (if the user has configured Operating conditions).
|
// this band (if the user has configured Operating conditions) — after the
|
||||||
|
// connected radio has had its say, since it knows which rig is keying and
|
||||||
|
// the band default only knows which one was planned.
|
||||||
|
if q.MyRig == "" {
|
||||||
|
q.MyRig = a.activeRadioMyRig()
|
||||||
|
}
|
||||||
if a.operating != nil && a.profiles != nil {
|
if a.operating != nil && a.profiles != nil {
|
||||||
if p, err := a.profiles.Active(a.ctx); err == nil {
|
if p, err := a.profiles.Active(a.ctx); err == nil {
|
||||||
if d, ok2, _ := a.operating.BandDefault(a.ctx, p.ID, q.Band); ok2 {
|
if d, ok2, _ := a.operating.BandDefault(a.ctx, p.ID, q.Band); ok2 {
|
||||||
@@ -14496,6 +14676,36 @@ func (a *App) FlexBackspaceCW(n int) error {
|
|||||||
return a.cat.FlexDo(func(fc cat.FlexController) error { return fc.BackspaceCW(n) })
|
return a.cat.FlexDo(func(fc cat.FlexController) error { return fc.BackspaceCW(n) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TCISendCW keys a CW message through the SunSDR's own macro keyer, so a TCI
|
||||||
|
// station needs no WinKeyer and no second serial port. Text is already
|
||||||
|
// variable-resolved by the UI.
|
||||||
|
func (a *App) TCISendCW(text string) error {
|
||||||
|
if a.cat == nil {
|
||||||
|
return fmt.Errorf("cat not initialized")
|
||||||
|
}
|
||||||
|
err := a.cat.TCICWDo(func(tc cat.TCICWController) error { return tc.SendCW(text) })
|
||||||
|
if err != nil {
|
||||||
|
applog.Printf("tci cw: TCISendCW(%q) failed: %v", text, err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TCIStopCW aborts whatever the keyer is sending.
|
||||||
|
func (a *App) TCIStopCW() error {
|
||||||
|
if a.cat == nil {
|
||||||
|
return fmt.Errorf("cat not initialized")
|
||||||
|
}
|
||||||
|
return a.cat.TCICWDo(func(tc cat.TCICWController) error { return tc.StopCW() })
|
||||||
|
}
|
||||||
|
|
||||||
|
// TCISetKeySpeed sets the macro keyer speed in WPM.
|
||||||
|
func (a *App) TCISetKeySpeed(wpm int) error {
|
||||||
|
if a.cat == nil {
|
||||||
|
return fmt.Errorf("cat not initialized")
|
||||||
|
}
|
||||||
|
return a.cat.TCICWDo(func(tc cat.TCICWController) error { return tc.SetCWSpeed(wpm) })
|
||||||
|
}
|
||||||
|
|
||||||
// IcomStopCW aborts the CW message currently being sent.
|
// IcomStopCW aborts the CW message currently being sent.
|
||||||
func (a *App) IcomStopCW() error {
|
func (a *App) IcomStopCW() error {
|
||||||
if a.cat == nil {
|
if a.cat == nil {
|
||||||
@@ -19518,7 +19728,8 @@ type SpotStatus struct {
|
|||||||
type clusterStatusCache struct {
|
type clusterStatusCache struct {
|
||||||
entities map[int]*qso.EntitySlot
|
entities map[int]*qso.EntitySlot
|
||||||
workedCalls map[string]struct{}
|
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{}
|
workedCounties map[string]struct{}
|
||||||
// callCounties holds callsign → "STATE,County" for stations already logged
|
// callCounties holds callsign → "STATE,County" for stations already logged
|
||||||
// with a county, so a spot shows the county the entry panel showed rather
|
// with a county, so a spot shows the county the entry panel showed rather
|
||||||
@@ -19602,8 +19813,18 @@ func (a *App) clusterStatusMaps() *clusterStatusCache {
|
|||||||
// "Already worked only on the same slot" option (Settings → DX Cluster): the
|
// "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
|
// 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.
|
// 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)
|
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
|
// Orthogonal dimensions: worked US counties (for the ULS callsign→county
|
||||||
// lookup) and worked POTA parks.
|
// lookup) and worked POTA parks.
|
||||||
|
|||||||
@@ -24,6 +24,17 @@ func (a *App) GetKenwoodState() cat.KenwoodTXState {
|
|||||||
return st
|
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 {
|
func (a *App) SetKenwoodPower(w int) error {
|
||||||
return a.kenwoodPanelDo(func(k cat.KenwoodPanelController) error { return k.SetKenwoodPower(w) })
|
return a.kenwoodPanelDo(func(k cat.KenwoodPanelController) error { return k.SetKenwoodPower(w) })
|
||||||
}
|
}
|
||||||
|
|||||||
+237
@@ -0,0 +1,237 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// Several radios, and the one that is on the air.
|
||||||
|
//
|
||||||
|
// Until now the answer to "I have two rigs" was "make two profiles", which is a
|
||||||
|
// heavy instrument for a light question: a profile carries the whole station —
|
||||||
|
// logbook, callsign, awards, cluster, macros — and switching one to change
|
||||||
|
// which radio is connected takes all of that with it, including a logbook
|
||||||
|
// change if the profiles point at different databases.
|
||||||
|
//
|
||||||
|
// So radios are a LIST, the way amplifiers already are, and switching is one
|
||||||
|
// click on the CAT chip in the status bar. Nothing else about the station
|
||||||
|
// moves.
|
||||||
|
//
|
||||||
|
// The storage deliberately keeps the ACTIVE radio in the settings keys the rest
|
||||||
|
// of OpsLog already reads (cat.backend, cat.icom_port, …). Switching writes the
|
||||||
|
// chosen entry into those keys and reloads the link, so every consumer — the
|
||||||
|
// consoles, the CAT sharing, the band-follow, the panels — sees exactly what it
|
||||||
|
// saw before and needed no change at all. The list is a second store beside it,
|
||||||
|
// not a replacement for it.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"hamlog/internal/applog"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// keyRadiosList holds the saved radios as JSON.
|
||||||
|
keyRadiosList = "cat.radios.json"
|
||||||
|
// keyRadioActive is the id of the one currently connected.
|
||||||
|
keyRadioActive = "cat.radios.active"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RadioConfig is one saved radio: a name and the CAT settings that reach it.
|
||||||
|
type RadioConfig struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
// Settings is the whole CAT configuration for this radio — the same shape
|
||||||
|
// the CAT panel has always edited, so a saved radio is exactly "what the
|
||||||
|
// settings said the day it was saved".
|
||||||
|
Settings CATSettings `json:"settings"`
|
||||||
|
// MyRig is what goes into MY_RIG on a QSO made with this radio.
|
||||||
|
//
|
||||||
|
// It belongs here rather than in Operating conditions once there is more
|
||||||
|
// than one rig: the operating conditions describe a PLAN — "on 20 m I use
|
||||||
|
// the beam and the 7300" — while this is the fact of which radio is keying.
|
||||||
|
// Left empty, nothing changes: the old chain (band default, then the
|
||||||
|
// profile's rig) answers exactly as it did.
|
||||||
|
MyRig string `json:"my_rig"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// radioLabel is what the status bar shows when the operator never named one.
|
||||||
|
func radioLabel(c RadioConfig, i int) string {
|
||||||
|
if n := strings.TrimSpace(c.Name); n != "" {
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
if b := strings.TrimSpace(c.Settings.Backend); b != "" {
|
||||||
|
return strings.ToUpper(b)
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("Radio %d", i+1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRadios returns the saved radios.
|
||||||
|
//
|
||||||
|
// When nothing was ever saved, the CURRENT settings are presented as the single
|
||||||
|
// entry — so an operator who has been running one rig for a year opens the list
|
||||||
|
// and finds it there, rather than an empty box suggesting their configuration
|
||||||
|
// has been lost. It is persisted on the next save, not here: reading a list
|
||||||
|
// should not write one.
|
||||||
|
func (a *App) GetRadios() ([]RadioConfig, error) {
|
||||||
|
if a.settings == nil {
|
||||||
|
return nil, fmt.Errorf("db not initialized")
|
||||||
|
}
|
||||||
|
raw := a.settingOr(keyRadiosList, "")
|
||||||
|
if strings.TrimSpace(raw) != "" {
|
||||||
|
var list []RadioConfig
|
||||||
|
if err := json.Unmarshal([]byte(raw), &list); err == nil && len(list) > 0 {
|
||||||
|
return list, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cur, err := a.GetCATSettings()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return []RadioConfig{{ID: "radio-1", Name: "", Settings: cur}}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveRadios stores the list, giving an id to anything new.
|
||||||
|
func (a *App) SaveRadios(list []RadioConfig) error {
|
||||||
|
if a.settings == nil {
|
||||||
|
return fmt.Errorf("db not initialized")
|
||||||
|
}
|
||||||
|
for i := range list {
|
||||||
|
if strings.TrimSpace(list[i].ID) == "" {
|
||||||
|
list[i].ID = fmt.Sprintf("radio-%d-%d", time.Now().Unix(), i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b, err := json.Marshal(list)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return a.settings.Set(a.ctx, keyRadiosList, string(b))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ActiveRadioID is the id of the radio currently on the air, or the first one
|
||||||
|
// when nothing was ever chosen.
|
||||||
|
func (a *App) ActiveRadioID() string {
|
||||||
|
id := strings.TrimSpace(a.settingOr(keyRadioActive, ""))
|
||||||
|
list, err := a.GetRadios()
|
||||||
|
if err != nil || len(list) == 0 {
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
for _, r := range list {
|
||||||
|
if r.ID == id {
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// The stored id names a radio that has since been deleted. The first one is
|
||||||
|
// a better answer than an empty selection: the CAT link is up, and it is up
|
||||||
|
// on SOMETHING.
|
||||||
|
return list[0].ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// RadioListEntry is what the status-bar menu needs: enough to draw a row.
|
||||||
|
//
|
||||||
|
// Name is what the OPERATOR typed, empty when they typed nothing; Label is what
|
||||||
|
// to draw when there is no better idea. The two are separate because the caller
|
||||||
|
// has a better idea than we do: the status bar knows what the radio calls
|
||||||
|
// itself over CAT, and "FTDX10" beats "Radio 2" — but only where the operator
|
||||||
|
// has not given it a name of their own, which beats both.
|
||||||
|
type RadioListEntry struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Label string `json:"label"`
|
||||||
|
Backend string `json:"backend"`
|
||||||
|
Active bool `json:"active"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListRadios is the status bar's view of the list.
|
||||||
|
func (a *App) ListRadios() []RadioListEntry {
|
||||||
|
list, err := a.GetRadios()
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
active := a.ActiveRadioID()
|
||||||
|
out := make([]RadioListEntry, 0, len(list))
|
||||||
|
for i, r := range list {
|
||||||
|
out = append(out, RadioListEntry{
|
||||||
|
ID: r.ID, Name: strings.TrimSpace(r.Name), Label: radioLabel(r, i),
|
||||||
|
Backend: r.Settings.Backend, Active: r.ID == active,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetActiveRadio connects the given radio and leaves the rest of the station
|
||||||
|
// alone.
|
||||||
|
//
|
||||||
|
// The chosen entry's settings become THE CAT settings — SaveCATSettings writes
|
||||||
|
// them and restarts the link — so switching rigs is the same operation as
|
||||||
|
// editing the CAT panel and pressing Save, which is a path that already works
|
||||||
|
// everywhere it needs to.
|
||||||
|
func (a *App) SetActiveRadio(id string) error {
|
||||||
|
list, err := a.GetRadios()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
id = strings.TrimSpace(id)
|
||||||
|
for i, r := range list {
|
||||||
|
if r.ID != id {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// Persisted BEFORE the link is rebuilt: reloadCAT can take a moment on a
|
||||||
|
// radio that is switched off, and an operator who closes OpsLog during
|
||||||
|
// that moment should still come back to the rig they chose.
|
||||||
|
a.setSetting(keyRadioActive, id)
|
||||||
|
// The list is written back as well when it was only ever implicit, so
|
||||||
|
// the first switch is also what makes the list real.
|
||||||
|
if strings.TrimSpace(a.settingOr(keyRadiosList, "")) == "" {
|
||||||
|
_ = a.SaveRadios(list)
|
||||||
|
}
|
||||||
|
applog.Printf("cat: switching to %q (%s)", radioLabel(r, i), r.Settings.Backend)
|
||||||
|
return a.SaveCATSettings(r.Settings)
|
||||||
|
}
|
||||||
|
return fmt.Errorf("no radio with id %q", id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// syncActiveRadio writes the settings just saved into the active entry of the
|
||||||
|
// list, so the list and the live configuration never disagree.
|
||||||
|
//
|
||||||
|
// Only when a list actually exists: an operator with one radio who has never
|
||||||
|
// opened the list has nothing to keep in step, and writing one here would
|
||||||
|
// create a list as a side effect of saving the CAT panel.
|
||||||
|
func (a *App) syncActiveRadio(s CATSettings) {
|
||||||
|
if a.settings == nil || strings.TrimSpace(a.settingOr(keyRadiosList, "")) == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list, err := a.GetRadios()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
id := a.ActiveRadioID()
|
||||||
|
for i := range list {
|
||||||
|
if list[i].ID == id {
|
||||||
|
list[i].Settings = s
|
||||||
|
_ = a.SaveRadios(list)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// activeRadioMyRig is the MY_RIG of the radio currently connected, or "".
|
||||||
|
//
|
||||||
|
// Consulted BEFORE the per-band default, and deliberately: the band default is
|
||||||
|
// what the operator planned to use on that band, this is which radio is
|
||||||
|
// actually on the air. When they disagree — a second rig borrowed for one
|
||||||
|
// evening on 20 m — the one that is transmitting is the true answer.
|
||||||
|
func (a *App) activeRadioMyRig() string {
|
||||||
|
if a.settings == nil || strings.TrimSpace(a.settingOr(keyRadiosList, "")) == "" {
|
||||||
|
return "" // no list was ever made: nothing to say, nothing changes
|
||||||
|
}
|
||||||
|
list, err := a.GetRadios()
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
id := a.ActiveRadioID()
|
||||||
|
for _, r := range list {
|
||||||
|
if r.ID == id {
|
||||||
|
return strings.TrimSpace(r.MyRig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
@@ -174,6 +174,11 @@ type MatrixColors struct {
|
|||||||
EntityWorked string `json:"entity_worked"`
|
EntityWorked string `json:"entity_worked"`
|
||||||
NotWorked string `json:"not_worked"`
|
NotWorked string `json:"not_worked"`
|
||||||
CurrentEntry string `json:"current_entry"`
|
CurrentEntry string `json:"current_entry"`
|
||||||
|
// The dot marking a slot already worked with the callsign in hand. It is a
|
||||||
|
// mark rather than a background, so it needs its own two colours: it is
|
||||||
|
// drawn on top of all five of the above and must stay legible over each.
|
||||||
|
MarkWorked string `json:"mark_worked"`
|
||||||
|
MarkConfirmed string `json:"mark_confirmed"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// normMatrixColors keeps only plain hex values. Anything else becomes "" — i.e.
|
// normMatrixColors keeps only plain hex values. Anything else becomes "" — i.e.
|
||||||
@@ -196,6 +201,8 @@ func normMatrixColors(c MatrixColors) MatrixColors {
|
|||||||
EntityWorked: clean(c.EntityWorked),
|
EntityWorked: clean(c.EntityWorked),
|
||||||
NotWorked: clean(c.NotWorked),
|
NotWorked: clean(c.NotWorked),
|
||||||
CurrentEntry: clean(c.CurrentEntry),
|
CurrentEntry: clean(c.CurrentEntry),
|
||||||
|
MarkWorked: clean(c.MarkWorked),
|
||||||
|
MarkConfirmed: clean(c.MarkConfirmed),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+122
@@ -1,4 +1,126 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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": "",
|
||||||
|
"en": [
|
||||||
|
"LoTW download: the QSL details (QSL date, grid, state, county) are now optional and off by default — LoTW takes about ten times longer to build that report, twenty minutes against two on the same account, and marking a confirmation needs none of it. Still asked for automatically when adding the QSOs not found in the log.",
|
||||||
|
"Band map: the tooltip now also names a new prefix or a new grid square. They stay off the 22-pixel colour strip, but leaving them out of the text made the two panels look as though they disagreed — the cluster said NEW PFX about a spot the map called Worked, and both were right. The map’s “Worked” also says whose: it is the ENTITY that was worked on that band and mode, not the callsign, which is what made the two readings look contradictory.",
|
||||||
|
"TCI (SunSDR): clicking a cluster spot no longer needs a second click to get the mode right — the sideband was chosen from the frequency the radio had last reported instead of the one just asked for. The log also names the ExpertSDR version now, and says so when it is older than the 1.5 that panorama spots need.",
|
||||||
|
"Two screens: OpsLog no longer walks off the desktop. On a monitor placed left of the primary one, the saved position was being added to that monitor’s own origin at every launch, so the window moved one screen further out each time until it was invisible.",
|
||||||
|
"CW over TCI: a SunSDR can now be keyed through its own macro keyer — pick TCI as the keyer engine (Settings → CW Keyer) and macros, auto-call and the speed control all work over the link already open, with no WinKeyer and no second serial port. NOT TESTED on the air yet.",
|
||||||
|
"LoTW upload: a refusal now shows TQSL’s own explanation — which contacts were already uploaded, which fell outside the certificate’s dates — instead of the bare “no QSOs processed”, and names the two settings that cause it.",
|
||||||
|
"Main tab: the docked cluster now has ONE header row — its title, live count and Filters button sit with Clear filters and Columns, as Recent QSOs beside it already did. The pane is titled DX Cluster.",
|
||||||
|
"A busy cluster no longer makes the rest of the interface sluggish: incoming spots are grouped into fewer, larger updates as the feed gets faster (up to half a second), instead of redrawing the window twenty times a second. A quiet cluster still shows each spot as it lands.",
|
||||||
|
"SunSDR console: the meters work. The S-meter, transmit power and SWR are pushed by the radio only to a client that subscribes, and OpsLog never did — it was reading commands ExpertSDR3 does not send.",
|
||||||
|
"Cluster: the “N new spots” counter no longer jumps to the whole buffer. It was looking for the row it had frozen on, and a station spotted again replaces its row — so the count fell through to “everything is new”.",
|
||||||
|
"E-mail: a refused SMTP login now says what to do about it — Microsoft 365 and outlook.com have switched off password-based SMTP, and an app password does not bring it back.",
|
||||||
|
"TCI panorama spots: the colour was sent as a negative number and ExpertSDR dropped every spot in silence. It now goes out as the unsigned ARGB integer the protocol document uses, and the first few spots are written to the log verbatim.",
|
||||||
|
"Cluster: “Group duplicates” was hiding the same station on OTHER bands and modes — a DXpedition spotted on five bands showed as one line and four slots disappeared. A duplicate is now what it should always have been: the same station on the same band and mode."
|
||||||
|
],
|
||||||
|
"fr": [
|
||||||
|
"Téléchargement LoTW : les détails QSL (date du QSL, locator, état, comté) deviennent optionnels et désactivés par défaut — LoTW met environ dix fois plus longtemps à construire ce rapport, vingt minutes contre deux sur le même compte, et marquer une confirmation n'en a pas besoin. Toujours demandés automatiquement quand on ajoute les QSO absents du log.",
|
||||||
|
"Carte des bandes : l'infobulle indique aussi un nouveau préfixe ou un nouveau locator. Ils restent hors de la bande de couleur de 22 pixels, mais les omettre du texte donnait l'impression que les deux panneaux se contredisaient — le cluster annonçait NOUVEAU PFX pour un spot que la carte disait contacté, et les deux avaient raison. Le « Contacté » de la carte dit aussi de qui il parle : c'est l'ENTITÉ qui a été contactée sur cette bande et ce mode, pas l'indicatif — d'où l'impression de contradiction.",
|
||||||
|
"TCI (SunSDR) : cliquer un spot du cluster ne demande plus un second clic pour obtenir le bon mode — la bande latérale était choisie d'après la fréquence encore annoncée par la radio au lieu de celle qu'on venait de demander. Le journal indique aussi la version d'ExpertSDR, et signale si elle est antérieure à la 1.5 qu'exigent les spots sur le panorama.",
|
||||||
|
"Deux écrans : OpsLog ne s'échappe plus du bureau. Sur un écran placé à gauche de l'écran principal, la position enregistrée était ajoutée à l'origine de cet écran à chaque lancement, si bien que la fenêtre s'éloignait d'un écran à chaque fois jusqu'à devenir invisible.",
|
||||||
|
"CW en TCI : un SunSDR peut désormais être manipulé par son propre keyer à macros — choisissez TCI comme moteur (Réglages → Manipulateur CW) et les macros, l'appel automatique et le réglage de vitesse passent par la liaison déjà ouverte, sans WinKeyer ni second port série. PAS ENCORE TESTÉ sur l'air.",
|
||||||
|
"Envoi LoTW : un refus affiche désormais l'explication de TQSL — quels contacts étaient déjà envoyés, lesquels tombaient hors des dates du certificat — au lieu du seul « no QSOs processed », et nomme les deux réglages qui en sont la cause.",
|
||||||
|
"Onglet Main : le cluster ancré n'a plus qu'UNE ligne d'en-tête — son titre, le compteur live et le bouton Filtres rejoignent Effacer les filtres et Colonnes, comme le faisait déjà la liste des QSO récents à côté. Le panneau s'intitule DX Cluster.",
|
||||||
|
"Un cluster chargé ne ralentit plus le reste de l'interface : les spots entrants sont regroupés en mises à jour moins nombreuses à mesure que le flux s'accélère (jusqu'à une demi-seconde), au lieu de redessiner la fenêtre vingt fois par seconde. Sur un cluster calme, chaque spot s'affiche toujours dès son arrivée.",
|
||||||
|
"Console SunSDR : les mesures fonctionnent. Le S-mètre, la puissance et le ROS ne sont envoyés qu'à un client qui s'abonne, ce qu'OpsLog ne faisait pas — il lisait des commandes qu'ExpertSDR3 n'envoie pas.",
|
||||||
|
"Cluster : le compteur « N nouveaux spots » ne saute plus à la taille du tampon. Il cherchait la ligne sur laquelle il s'était figé, or une station re-spottée remplace sa ligne — le compte basculait donc sur « tout est nouveau ».",
|
||||||
|
"E-mail : un refus d'authentification SMTP explique désormais quoi faire — Microsoft 365 et outlook.com ont désactivé le SMTP par mot de passe, et un mot de passe d'application ne le rétablit pas.",
|
||||||
|
"Spots sur le panorama TCI : la couleur partait en nombre négatif et ExpertSDR écartait chaque spot en silence. Elle est désormais envoyée en entier ARGB non signé, comme dans la documentation du protocole, et les premiers spots sont écrits tels quels dans le journal.",
|
||||||
|
"Cluster : « Grouper les doublons » masquait la même station sur les AUTRES bandes et modes — une expédition spottée sur cinq bandes n'affichait qu'une ligne et quatre créneaux disparaissaient. Un doublon est désormais ce qu'il aurait toujours dû être : la même station sur la même bande et le même mode."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "0.26.21",
|
||||||
|
"date": "",
|
||||||
|
"en": [
|
||||||
|
"Distances can be shown in miles (Settings → General): the cluster and Recent QSOs columns, the map path box, the rotator buttons and the band-opening list all follow, and the column headers name the unit.",
|
||||||
|
"LoTW download: the report is now counted in megabytes as it arrives, LoTW’s \"busy\" answer (HTTP 503) is retried twice instead of failing, and a transfer that stops moving for two minutes says so rather than showing \"working\" indefinitely."
|
||||||
|
],
|
||||||
|
"fr": [
|
||||||
|
"Les distances peuvent s'afficher en miles (Réglages → Général) : les colonnes du cluster et des QSO récents, l'encart du tracé sur la carte, les boutons du rotor et la liste des ouvertures suivent, et l'unité est indiquée dans les en-têtes de colonne.",
|
||||||
|
"Téléchargement LoTW : le rapport est compté en mégaoctets au fur et à mesure, la réponse « occupé » de LoTW (HTTP 503) est retentée deux fois au lieu d'échouer, et un transfert qui n'avance plus pendant deux minutes le dit au lieu d'afficher « en cours » indéfiniment."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "0.26.20",
|
||||||
|
"date": "",
|
||||||
|
"en": [
|
||||||
|
"Each radio carries its own MY_RIG (Settings → CAT), written on every QSO made with it — ahead of the per-band station in Operating conditions, which says what you planned to use rather than which radio is keying. Left empty, nothing changes.",
|
||||||
|
"Worked-before matrix: a dot in the corner of a cell now means the callsign you are working has already been worked on that slot, whatever colour the entity status gave the cell. Its two colours (worked / confirmed with this callsign) are in Appearance with the other matrix colours.",
|
||||||
|
"Icom spectrum scope: the command shape (with or without the main/sub selector) is now worked out from the radio’s own answers instead of a list of models. A radio that has scope control but no waveform stream over CI-V — the IC-7851 — says so in the panel rather than showing a black rectangle.",
|
||||||
|
"Elecraft KPA: the status-bar chip now shows the amplifier as connected and switches it between OPERATE and STANDBY like the other brands, and an offline KPA no longer calls itself an Acom.",
|
||||||
|
"Cluster: a SOTA column, read from the summit reference the SOTA feeds put in the spot comment. Clicking the spot fills the QSO’s SOTA award reference, as a POTA spot already did. Turn the column on in Columns. Add cluster.sota.org.uk:7300 as a server to receive the summit spots.",
|
||||||
|
"Awards: a \"Slots to confirm\" filter and a running count beside the reference total, so the gap between worked and confirmed band-slots — the Challenge difference — can be seen reference by reference instead of only as two numbers.",
|
||||||
|
"QSL Manager: a QRZ button next to the Paper QSL search, opening the callsign on QRZ.com.",
|
||||||
|
"LoTW: an \"All my callsigns\" option beside the download. The download is scoped to the profile’s own callsign, so a QSO made as a portable or contest call was confirmed at LoTW and never marked here. Confirmations made under a callsign this logbook has never used are skipped, and a suspiciously small report now shows what LoTW actually answered.",
|
||||||
|
"LoTW download: \"All\" really means all — without a date LoTW answered with a handful of recent confirmations, which looked like a successful download of an empty account. A full account also has time to arrive: the two-minute limit that ended in \"context deadline exceeded\" is now twenty."
|
||||||
|
],
|
||||||
|
"fr": [
|
||||||
|
"Chaque radio porte son propre MY_RIG (Réglages → CAT), inscrit sur chaque QSO fait avec elle — avant la station par bande des Conditions de trafic, qui dit ce qui était prévu et non quelle radio émet. Laissé vide, rien ne change.",
|
||||||
|
"Matrice des contacts : un point dans le coin d'une case indique que l'indicatif en cours a déjà été contacté sur ce créneau, quelle que soit la couleur donnée par le statut de l'entité. Ses deux couleurs (contacté / confirmé avec cet indicatif) se règlent dans Apparence avec les autres couleurs de la matrice.",
|
||||||
|
"Scope Icom : la forme des commandes (avec ou sans le sélecteur main/sub) est déduite des réponses de la radio au lieu d'une liste de modèles. Une radio qui pilote son scope mais ne l'envoie pas en CI-V — l'IC-7851 — l'indique dans le panneau au lieu d'afficher un rectangle noir.",
|
||||||
|
"Elecraft KPA : la pastille de la barre d'état montre enfin l'amplificateur comme connecté et bascule OPERATE / STANDBY comme les autres marques, et un KPA hors ligne ne s'annonce plus comme un Acom.",
|
||||||
|
"Cluster : une colonne SOTA, lue dans la référence de sommet que les flux SOTA mettent dans le commentaire du spot. Cliquer le spot remplit la référence SOTA du QSO, comme le faisait déjà un spot POTA. Colonne à activer dans Colonnes. Ajoutez le serveur cluster.sota.org.uk:7300 pour recevoir les spots de sommets.",
|
||||||
|
"Awards : un filtre « Slots à confirmer » et un compteur à côté du total de références, pour voir l'écart entre créneaux contactés et confirmés — la différence du Challenge — référence par référence et non plus seulement en deux chiffres.",
|
||||||
|
"Gestionnaire QSL : un bouton QRZ à côté de la recherche QSL papier, qui ouvre l'indicatif sur QRZ.com.",
|
||||||
|
"LoTW : une option « Tous mes indicatifs » à côté du téléchargement. Celui-ci est limité à l'indicatif du profil, si bien qu'un QSO fait sous un indicatif portable ou de contest était confirmé chez LoTW sans jamais être marqué ici. Les confirmations faites sous un indicatif que ce carnet n'a jamais utilisé sont ignorées, et un rapport anormalement petit affiche désormais ce que LoTW a réellement répondu.",
|
||||||
|
"Téléchargement LoTW : « Tout » veut enfin dire tout — sans date, LoTW ne renvoyait qu'une poignée de confirmations récentes, ce qui ressemblait à un téléchargement réussi d'un compte vide. Un compte complet a aussi le temps d'arriver : la limite de deux minutes, qui finissait en « context deadline exceeded », passe à vingt."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "0.26.19",
|
||||||
|
"date": "",
|
||||||
|
"en": [
|
||||||
|
"Several radios, and one click to change which one is connected. Settings → CAT holds a list — name them, add one (it starts as a copy of the current one), remove one — and the CAT button in the status bar switches between them. The logbook, the callsign and everything else about the station stay exactly as they are, which is what making a profile per radio could not do."
|
||||||
|
],
|
||||||
|
"fr": [
|
||||||
|
"Plusieurs radios, et un clic pour changer celle qui est connectée. Réglages → CAT contient une liste — les nommer, en ajouter une (elle part d'une copie de la courante), en retirer une — et le bouton CAT de la barre d'état passe de l'une à l'autre. Le carnet, l'indicatif et tout le reste de la station ne bougent pas, ce qu'un profil par radio ne permettait pas."
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.26.18",
|
"version": "0.26.18",
|
||||||
"date": "",
|
"date": "",
|
||||||
|
|||||||
+258
-56
@@ -1,7 +1,7 @@
|
|||||||
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Activity, AlertCircle, Antenna, Bell, Check, CheckCircle2, ChevronDown, Clock, CloudOff, Compass, Database, Ear, Eraser, Flame, Gauge, Hash, Loader2, Lock,
|
Activity, AlertCircle, Antenna, Bell, Check, CheckCircle2, ChevronDown, Clock, CloudOff, Compass, Database, Ear, Eraser, Flame, Gauge, Hash, Loader2, Lock,
|
||||||
Maximize2, Minimize2, Mic, MessageSquare, Pencil, Radar, Radio, RadioTower, RefreshCw, Satellite, Send, SatelliteDish, Settings, SlidersHorizontal, SpellCheck, Square, Terminal, Trash2, Unlock, X, Zap,
|
ChevronUp, Maximize2, Minimize2, Mic, MessageSquare, Pencil, Radar, Radio, RadioTower, RefreshCw, Satellite, Send, SatelliteDish, Settings, SlidersHorizontal, SpellCheck, Square, Terminal, Trash2, Unlock, X, Zap,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -41,6 +41,7 @@ import {
|
|||||||
IcomSendCW, YaesuSendCW, YaesuStopCW, SetYaesuKeySpeed, IcomStopCW, IcomSetKeySpeed, IcomSetBreakIn, GetIcomState,
|
IcomSendCW, YaesuSendCW, YaesuStopCW, SetYaesuKeySpeed, IcomStopCW, IcomSetKeySpeed, IcomSetBreakIn, GetIcomState,
|
||||||
KenwoodSendCW, KenwoodStopCW, SetKenwoodKeySpeed,
|
KenwoodSendCW, KenwoodStopCW, SetKenwoodKeySpeed,
|
||||||
FlexSendCW, FlexStopCW, FlexSetKeySpeed, FlexBackspaceCW,
|
FlexSendCW, FlexStopCW, FlexSetKeySpeed, FlexBackspaceCW,
|
||||||
|
TCISendCW, TCIStopCW, TCISetKeySpeed,
|
||||||
GetDVKMessages, GetDVKStatus, DVKPlay, DVKStop,
|
GetDVKMessages, GetDVKStatus, DVKPlay, DVKStop,
|
||||||
StartCWDecoder, StopCWDecoder, SetCWDecoderPitch,
|
StartCWDecoder, StopCWDecoder, SetCWDecoderPitch,
|
||||||
ChatAvailable, GetChatHistory, SendChatMessage, GetOnlineOperators,
|
ChatAvailable, GetChatHistory, SendChatMessage, GetOnlineOperators,
|
||||||
@@ -56,6 +57,8 @@ import {
|
|||||||
} from '../wailsjs/go/main/App';
|
} from '../wailsjs/go/main/App';
|
||||||
import { Combobox } from '@/components/ui/combobox';
|
import { Combobox } from '@/components/ui/combobox';
|
||||||
import { applyAwardRefs, parseAwardRefs as parseManualRefs, spotRefList , withIOTARef, withRDARef } from '@/lib/awardRefs';
|
import { applyAwardRefs, parseAwardRefs as parseManualRefs, spotRefList , withIOTARef, withRDARef } from '@/lib/awardRefs';
|
||||||
|
import { ListRadios, SetActiveRadio } from '../wailsjs/go/main/App';
|
||||||
|
import { formatDistance } from '@/lib/units';
|
||||||
import { EventsOn, BrowserOpenURL, WindowMinimise, WindowToggleMaximise, WindowIsMaximised, Quit } from '../wailsjs/runtime/runtime';
|
import { EventsOn, BrowserOpenURL, WindowMinimise, WindowToggleMaximise, WindowIsMaximised, Quit } from '../wailsjs/runtime/runtime';
|
||||||
import type { adif as adifModels, lookup as lookupModels, cat as catModels } from '../wailsjs/go/models';
|
import type { adif as adifModels, lookup as lookupModels, cat as catModels } from '../wailsjs/go/models';
|
||||||
import type { QSOForm, WorkedBeforeView, StationSettingsForm, ListsSettingsForm, ModePresetForm } from '@/types';
|
import type { QSOForm, WorkedBeforeView, StationSettingsForm, ListsSettingsForm, ModePresetForm } from '@/types';
|
||||||
@@ -66,6 +69,7 @@ import {
|
|||||||
} from '@/components/ui/dropdown-menu';
|
} from '@/components/ui/dropdown-menu';
|
||||||
import { APP_VERSION, APP_AUTHOR } from '@/version';
|
import { APP_VERSION, APP_AUTHOR } from '@/version';
|
||||||
import { QSLManagerPanel } from '@/components/QSLManagerModal';
|
import { QSLManagerPanel } from '@/components/QSLManagerModal';
|
||||||
|
import { WatchlistTab } from '@/components/WatchlistTab';
|
||||||
import { QslDesignerModal } from '@/components/qsl/QslDesignerModal';
|
import { QslDesignerModal } from '@/components/qsl/QslDesignerModal';
|
||||||
import { SendEQSLModal } from '@/components/qsl/SendEQSLModal';
|
import { SendEQSLModal } from '@/components/qsl/SendEQSLModal';
|
||||||
import { AutoEQSL } from '@/components/qsl/AutoEQSL';
|
import { AutoEQSL } from '@/components/qsl/AutoEQSL';
|
||||||
@@ -95,7 +99,7 @@ import { ExportFieldsDialog } from '@/components/ExportFieldsDialog';
|
|||||||
import { ShutdownProgress } from '@/components/ShutdownProgress';
|
import { ShutdownProgress } from '@/components/ShutdownProgress';
|
||||||
import { ClusterGrid } from '@/components/ClusterGrid';
|
import { ClusterGrid } from '@/components/ClusterGrid';
|
||||||
import { cleanSpotter, inferSpotMode, spotModeCategory, spotStatusKey } from '@/lib/spot';
|
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 { AnswerDecode, HaltDecodeTx, LogUIError, FlexTXOnBand, GetMatrixColors, GetRotorPresets, GetRowColors, GetSpotTTLMinutes, GetSpotMax, IsNewUSCounty } from '../wailsjs/go/main/App';
|
||||||
import { applyMatrixColors } from '@/lib/matrixColors';
|
import { applyMatrixColors } from '@/lib/matrixColors';
|
||||||
import { WorkedBeforeGrid } from '@/components/WorkedBeforeGrid';
|
import { WorkedBeforeGrid } from '@/components/WorkedBeforeGrid';
|
||||||
@@ -290,6 +294,94 @@ function FreqWheelDisplay({ mhz, onNudge, className, placeholder = '—.——
|
|||||||
// shortCatError condenses a backend error into a few words for the topbar
|
// shortCatError condenses a backend error into a few words for the topbar
|
||||||
// pill. The full message stays in the tooltip. Recognises the common cases
|
// pill. The full message stays in the tooltip. Recognises the common cases
|
||||||
// (OmniRig not installed, not registered) and otherwise truncates.
|
// (OmniRig not installed, not registered) and otherwise truncates.
|
||||||
|
// RadioChip — the CAT status chip, and the radio picker behind it.
|
||||||
|
function RadioChip({ catUp, catState, onOpenSettings }: {
|
||||||
|
catUp: boolean; catState: any; onOpenSettings: () => void;
|
||||||
|
}) {
|
||||||
|
const [radios, setRadios] = useState<any[]>([]);
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
// Re-read on every open rather than on a timer: the list changes when the
|
||||||
|
// operator edits it in Settings, which is exactly when they are not looking
|
||||||
|
// at this chip.
|
||||||
|
const load = () => { ListRadios().then((r: any) => setRadios(r ?? [])).catch(() => {}); };
|
||||||
|
useEffect(() => { load(); }, []);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
const onDoc = (e: MouseEvent) => {
|
||||||
|
if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);
|
||||||
|
};
|
||||||
|
document.addEventListener('mousedown', onDoc);
|
||||||
|
return () => document.removeEventListener('mousedown', onDoc);
|
||||||
|
}, [open]);
|
||||||
|
|
||||||
|
// What the operator called this radio comes first.
|
||||||
|
//
|
||||||
|
// The chip showed what the RADIO calls itself over CAT — "Kenwood (911)" for
|
||||||
|
// a K3, a bare "CAT" for a Flex that reports nothing useful — which is the
|
||||||
|
// answer to a question nobody asked once the rig has a name in the list. The
|
||||||
|
// model identity is still there, in the tooltip.
|
||||||
|
const active = radios.find((r: any) => r.active);
|
||||||
|
const named = (active?.name || '').trim();
|
||||||
|
const label = catUp
|
||||||
|
? (named || catState.rig || 'CAT')
|
||||||
|
: (catState.enabled ? (named || shortCatError(catState.error) || 'CAT off') : (named || 'CAT'));
|
||||||
|
// The menu opens with ONE radio too.
|
||||||
|
//
|
||||||
|
// It was only shown from two, on the reasoning that a single radio has
|
||||||
|
// nothing to switch to — but that hides the feature exactly from the operator
|
||||||
|
// who has not made a second radio yet, and the click lands on the settings
|
||||||
|
// dialog they were not asking for. With one radio the menu shows that radio
|
||||||
|
// and the way to add another.
|
||||||
|
const has = radios.length > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="relative">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => { if (!has) { onOpenSettings(); return; } load(); setOpen((o) => !o); }}
|
||||||
|
title={catUp
|
||||||
|
? `${catState.rig || catState.backend || 'connected'}${has ? ' — click to switch radio, right-click for the CAT settings' : ''}`
|
||||||
|
: (catState.error || 'CAT')}
|
||||||
|
onContextMenu={(e) => { e.preventDefault(); onOpenSettings(); }}
|
||||||
|
className={cn('inline-flex items-center gap-1.5 h-5 px-2 rounded-full border text-[11px] transition-colors',
|
||||||
|
'border-border hover:bg-muted cursor-pointer')}
|
||||||
|
>
|
||||||
|
<span className={cn('size-2 rounded-full', catUp ? 'bg-success' : 'bg-muted-foreground/40')} />
|
||||||
|
<span className="inline-flex items-center gap-1"><RadioTower className="size-3" />{label}</span>
|
||||||
|
{has && <ChevronUp className="size-3 opacity-60" />}
|
||||||
|
</button>
|
||||||
|
{open && has && (
|
||||||
|
<div className="absolute bottom-full left-0 mb-1 z-50 min-w-44 rounded-md border border-border bg-card shadow-lg py-1">
|
||||||
|
{radios.map((r) => (
|
||||||
|
<button
|
||||||
|
key={r.id}
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
setOpen(false);
|
||||||
|
if (r.active) return;
|
||||||
|
SetActiveRadio(r.id).then(load).catch(() => {});
|
||||||
|
}}
|
||||||
|
className={cn('flex w-full items-center gap-2 px-2.5 py-1 text-left text-xs hover:bg-muted',
|
||||||
|
r.active && 'font-semibold text-primary')}
|
||||||
|
>
|
||||||
|
<span className={cn('size-1.5 rounded-full shrink-0', r.active ? 'bg-success' : 'bg-muted-foreground/30')} />
|
||||||
|
<span className="flex-1 truncate">{(r.name || '').trim() || r.label}</span>
|
||||||
|
<span className="text-[10px] text-muted-foreground uppercase">{r.backend}</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
<div className="my-1 border-t border-border/60" />
|
||||||
|
<button type="button" onClick={() => { setOpen(false); onOpenSettings(); }}
|
||||||
|
className="w-full px-2.5 py-1 text-left text-xs text-muted-foreground hover:bg-muted">
|
||||||
|
{radios.length > 1 ? 'Radios…' : 'Add a radio…'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function shortCatError(err?: string): string {
|
function shortCatError(err?: string): string {
|
||||||
if (!err) return '';
|
if (!err) return '';
|
||||||
const e = err.toLowerCase();
|
const e = err.toLowerCase();
|
||||||
@@ -1400,7 +1492,7 @@ export default function App() {
|
|||||||
// CI-V 0x17 (no extra hardware — sends over the CAT connection). Macros,
|
// CI-V 0x17 (no extra hardware — sends over the CAT connection). Macros,
|
||||||
// auto-call and <LOGQSO> are shared; only the transport differs.
|
// auto-call and <LOGQSO> are shared; only the transport differs.
|
||||||
const [wkEngine, setWkEngine] = useState<string>('winkeyer');
|
const [wkEngine, setWkEngine] = useState<string>('winkeyer');
|
||||||
const cwSource: 'winkeyer' | 'icom' | 'flex' | 'yaesu' | 'kenwood' = wkEngine === 'icom' ? 'icom' : wkEngine === 'flex' ? 'flex' : wkEngine === 'yaesu' ? 'yaesu' : wkEngine === 'kenwood' ? 'kenwood' : 'winkeyer';
|
const cwSource: 'winkeyer' | 'icom' | 'flex' | 'yaesu' | 'kenwood' | 'tci' = wkEngine === 'icom' ? 'icom' : wkEngine === 'flex' ? 'flex' : wkEngine === 'yaesu' ? 'yaesu' : wkEngine === 'kenwood' ? 'kenwood' : wkEngine === 'tci' ? 'tci' : 'winkeyer';
|
||||||
// Setting the CW speed has to reach the keyer that is ACTUALLY sending, and
|
// Setting the CW speed has to reach the keyer that is ACTUALLY sending, and
|
||||||
// both the CW panel and the Yaesu console can ask for it. With DTR/RTS line
|
// both the CW panel and the Yaesu console can ask for it. With DTR/RTS line
|
||||||
// keying the PC does the timing, so the rig's internal keyer speed changes
|
// keying the PC does the timing, so the rig's internal keyer speed changes
|
||||||
@@ -1414,6 +1506,7 @@ export default function App() {
|
|||||||
else if (src === 'flex') FlexSetKeySpeed(w).catch(() => {});
|
else if (src === 'flex') FlexSetKeySpeed(w).catch(() => {});
|
||||||
else if (src === 'yaesu') SetYaesuKeySpeed(w).catch(() => {});
|
else if (src === 'yaesu') SetYaesuKeySpeed(w).catch(() => {});
|
||||||
else if (src === 'kenwood') SetKenwoodKeySpeed(w).catch(() => {});
|
else if (src === 'kenwood') SetKenwoodKeySpeed(w).catch(() => {});
|
||||||
|
else if (src === 'tci') TCISetKeySpeed(w).catch(() => {});
|
||||||
else WinkeyerSetSpeed(w).catch(() => {});
|
else WinkeyerSetSpeed(w).catch(() => {});
|
||||||
// The rig's own keyer follows too whenever a Yaesu is on CAT, even when it is
|
// The rig's own keyer follows too whenever a Yaesu is on CAT, even when it is
|
||||||
// not the sending engine: its front panel and OpsLog then agree.
|
// not the sending engine: its front panel and OpsLog then agree.
|
||||||
@@ -1458,6 +1551,7 @@ export default function App() {
|
|||||||
: cwSource === 'flex' ? (catState.backend === 'flex' && catState.connected)
|
: cwSource === 'flex' ? (catState.backend === 'flex' && catState.connected)
|
||||||
: cwSource === 'yaesu' ? (catState.backend === 'yaesu' && catState.connected)
|
: cwSource === 'yaesu' ? (catState.backend === 'yaesu' && catState.connected)
|
||||||
: cwSource === 'kenwood' ? (catState.backend === 'kenwood' && catState.connected)
|
: cwSource === 'kenwood' ? (catState.backend === 'kenwood' && catState.connected)
|
||||||
|
: cwSource === 'tci' ? (catState.backend === 'tci' && catState.connected)
|
||||||
: wkStatus.connected;
|
: wkStatus.connected;
|
||||||
wkActiveRef.current = wkEnabled && connected;
|
wkActiveRef.current = wkEnabled && connected;
|
||||||
}, [wkEnabled, wkStatus.connected, cwSource, catState.backend, catState.connected]);
|
}, [wkEnabled, wkStatus.connected, cwSource, catState.backend, catState.connected]);
|
||||||
@@ -1591,6 +1685,9 @@ export default function App() {
|
|||||||
// NET Control tab — enabled from Tools (persisted; once on it's a tab like Cluster).
|
// NET Control tab — enabled from Tools (persisted; once on it's a tab like Cluster).
|
||||||
const [netEnabled, setNetEnabled] = useState(() => localStorage.getItem('opslog.netEnabled') === '1');
|
const [netEnabled, setNetEnabled] = useState(() => localStorage.getItem('opslog.netEnabled') === '1');
|
||||||
useEffect(() => { localStorage.setItem('opslog.netEnabled', netEnabled ? '1' : '0'); }, [netEnabled]);
|
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.
|
// Contest tab is hidden until enabled from Tools → Contest mode.
|
||||||
const [contestTabEnabled, setContestTabEnabled] = useState(() => localStorage.getItem('opslog.contestTab') === '1');
|
const [contestTabEnabled, setContestTabEnabled] = useState(() => localStorage.getItem('opslog.contestTab') === '1');
|
||||||
useEffect(() => { localStorage.setItem('opslog.contestTab', contestTabEnabled ? '1' : '0'); }, [contestTabEnabled]);
|
useEffect(() => { localStorage.setItem('opslog.contestTab', contestTabEnabled ? '1' : '0'); }, [contestTabEnabled]);
|
||||||
@@ -1921,7 +2018,7 @@ export default function App() {
|
|||||||
// so it's loaded async on mount and re-read on profile:changed below.
|
// 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
|
// '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.
|
// 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 [mapZoomSignal, setMapZoomSignal] = useState(0); // bump → world map auto-zooms now
|
||||||
const [mainPaneLeft, setMainPaneLeft] = useState<MainPaneKind>('map1');
|
const [mainPaneLeft, setMainPaneLeft] = useState<MainPaneKind>('map1');
|
||||||
const [mainPaneRight, setMainPaneRight] = useState<MainPaneKind>('map2');
|
const [mainPaneRight, setMainPaneRight] = useState<MainPaneKind>('map2');
|
||||||
@@ -1932,7 +2029,7 @@ export default function App() {
|
|||||||
// quarter-width map is unreadable.
|
// quarter-width map is unreadable.
|
||||||
const [mainLayout4, setMainLayout4] = useState<'cols' | 'quad'>('quad');
|
const [mainLayout4, setMainLayout4] = useState<'cols' | 'quad'>('quad');
|
||||||
const loadMainPanes = useCallback(async () => {
|
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([
|
const [l, r, p3, p4, lay] = await Promise.all([
|
||||||
GetUIPref('mainPaneLeft').catch(() => ''),
|
GetUIPref('mainPaneLeft').catch(() => ''),
|
||||||
GetUIPref('mainPaneRight').catch(() => ''),
|
GetUIPref('mainPaneRight').catch(() => ''),
|
||||||
@@ -1975,6 +2072,9 @@ export default function App() {
|
|||||||
useEffect(() => { spotStatusRef.current = spotStatus; }, [spotStatus]);
|
useEffect(() => { spotStatusRef.current = spotStatus; }, [spotStatus]);
|
||||||
// Mirror of spots so the log-triggered refresh reads the current list without
|
// Mirror of spots so the log-triggered refresh reads the current list without
|
||||||
// a stale closure.
|
// a stale closure.
|
||||||
|
// Arrival times of the last second's spots, for the adaptive batching window
|
||||||
|
// in the cluster:spot listener.
|
||||||
|
const spotRateRef = useRef<number[]>([]);
|
||||||
const spotsRef = useRef(spots);
|
const spotsRef = useRef(spots);
|
||||||
useEffect(() => { spotsRef.current = spots; }, [spots]);
|
useEffect(() => { spotsRef.current = spots; }, [spots]);
|
||||||
// The decoded stations, for the same reason: the status refresh and the cache
|
// The decoded stations, for the same reason: the status refresh and the cache
|
||||||
@@ -3186,7 +3286,7 @@ export default function App() {
|
|||||||
function handleSpotSelect(s: any) {
|
function handleSpotSelect(s: any) {
|
||||||
if (!s?.dx_call?.trim()) return;
|
if (!s?.dx_call?.trim()) return;
|
||||||
onCallsignInput(s.dx_call, { force: true });
|
onCallsignInput(s.dx_call, { force: true });
|
||||||
applySpotPOTA((s as any).pota_ref);
|
applySpotRefs((s as any).pota_ref, (s as any).sota_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSpotClick(s: any) {
|
function handleSpotClick(s: any) {
|
||||||
@@ -3204,14 +3304,19 @@ export default function App() {
|
|||||||
noteManualEdit();
|
noteManualEdit();
|
||||||
}
|
}
|
||||||
if (s.band) setBand(s.band);
|
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.
|
// 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
|
// A no-op on any backend but a Flex. Sequenced AFTER the tune settles, not
|
||||||
// change the operator is waiting for. A no-op on any backend but a Flex.
|
// fired alongside it: on a cross-band jump SmartSDR moves the panadapter
|
||||||
FlexZoomForSpot(m ?? '', s.freq_hz ?? 0).catch(() => {});
|
// 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);
|
if (m) applyModeFromSpot(m);
|
||||||
onCallsignInput(s.dx_call, { force: true });
|
onCallsignInput(s.dx_call, { force: true });
|
||||||
applySpotPOTA((s as any).pota_ref);
|
applySpotRefs((s as any).pota_ref, (s as any).sota_ref);
|
||||||
if (s.dx_call?.trim()) restartRecordingForNewTarget(s.dx_call);
|
if (s.dx_call?.trim()) restartRecordingForNewTarget(s.dx_call);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3502,11 +3607,24 @@ export default function App() {
|
|||||||
const unsubSpot = EventsOn('cluster:spot', (sp: ClusterSpot) => {
|
const unsubSpot = EventsOn('cluster:spot', (sp: ClusterSpot) => {
|
||||||
// Stage the spot; a short timer resolves its status then commits it.
|
// Stage the spot; a short timer resolves its status then commits it.
|
||||||
pendingSpotsRef.current.push(sp);
|
pendingSpotsRef.current.push(sp);
|
||||||
// 50 ms is enough to coalesce an RBN burst into one status lookup (the
|
// The window WIDENS with the rate of the feed.
|
||||||
// worked-index is in memory, so resolving is near-instant) while staying
|
//
|
||||||
// imperceptible.
|
// Every flush commits state that the whole window re-renders on, so a
|
||||||
|
// fixed 50 ms means twenty full renders a second under an RBN firehose —
|
||||||
|
// and that is felt everywhere else: a dropdown highlighting its entries a
|
||||||
|
// beat late as the mouse moves down them, which is what was reported.
|
||||||
|
//
|
||||||
|
// A quiet cluster keeps the 50 ms: a handful of spots an hour should
|
||||||
|
// appear the moment they arrive. A busy one is coalesced instead, and half
|
||||||
|
// a second's delay on a line in a list that is already scrolling past is
|
||||||
|
// not something anyone can see.
|
||||||
|
const now = Date.now();
|
||||||
|
spotRateRef.current = spotRateRef.current.filter((t) => now - t < 1000);
|
||||||
|
spotRateRef.current.push(now);
|
||||||
|
const perSec = spotRateRef.current.length;
|
||||||
|
const window_ms = perSec > 20 ? 500 : perSec > 5 ? 200 : 50;
|
||||||
if (pendingSpotTimer.current === undefined) {
|
if (pendingSpotTimer.current === undefined) {
|
||||||
pendingSpotTimer.current = window.setTimeout(flushPendingSpots, 50);
|
pendingSpotTimer.current = window.setTimeout(flushPendingSpots, window_ms);
|
||||||
}
|
}
|
||||||
// Self-spot: someone spotted OUR callsign — show it in the shared header
|
// Self-spot: someone spotted OUR callsign — show it in the shared header
|
||||||
// toast (same place as the other notifications), not a separate banner.
|
// toast (same place as the other notifications), not a separate banner.
|
||||||
@@ -3672,14 +3790,14 @@ export default function App() {
|
|||||||
restartRecordingForNewTarget(call);
|
restartRecordingForNewTarget(call);
|
||||||
// The park, like a click in the band map: the radio reports only a
|
// The park, like a click in the band map: the radio reports only a
|
||||||
// callsign, so the backend looks it up again before sending the event.
|
// callsign, so the backend looks it up again before sending the event.
|
||||||
applySpotPOTA(String(p?.pota_ref ?? ''));
|
applySpotRefs(String(p?.pota_ref ?? ''), String(p?.sota_ref ?? ''));
|
||||||
});
|
});
|
||||||
// Clicking a spot on the ExpertSDR (TCI) panorama fills the call, like Flex.
|
// Clicking a spot on the ExpertSDR (TCI) panorama fills the call, like Flex.
|
||||||
const unsubTciSpot = EventsOn('tci:spot_clicked', (p: any) => {
|
const unsubTciSpot = EventsOn('tci:spot_clicked', (p: any) => {
|
||||||
const call = String(p?.call ?? '');
|
const call = String(p?.call ?? '');
|
||||||
if (!applyUdpCall(call, true)) return;
|
if (!applyUdpCall(call, true)) return;
|
||||||
restartRecordingForNewTarget(call);
|
restartRecordingForNewTarget(call);
|
||||||
applySpotPOTA(String(p?.pota_ref ?? ''));
|
applySpotRefs(String(p?.pota_ref ?? ''), String(p?.sota_ref ?? ''));
|
||||||
});
|
});
|
||||||
const unsubBulk = EventsOn('bulkupdate:progress', (p: any) => {
|
const unsubBulk = EventsOn('bulkupdate:progress', (p: any) => {
|
||||||
const total = Number(p?.total ?? 0);
|
const total = Number(p?.total ?? 0);
|
||||||
@@ -3878,7 +3996,7 @@ export default function App() {
|
|||||||
// segment AFTER the <LOGQSO> (which logs and clears the form) still expands its
|
// segment AFTER the <LOGQSO> (which logs and clears the form) still expands its
|
||||||
// variables correctly.
|
// variables correctly.
|
||||||
const parts = rawText.split(/<LOGQSO>/i).map((pt) => resolveCW(pt));
|
const parts = rawText.split(/<LOGQSO>/i).map((pt) => resolveCW(pt));
|
||||||
const isRig = cwSourceRef.current === 'icom' || cwSourceRef.current === 'flex' || cwSourceRef.current === 'yaesu' || cwSourceRef.current === 'kenwood';
|
const isRig = cwSourceRef.current === 'icom' || cwSourceRef.current === 'flex' || cwSourceRef.current === 'yaesu' || cwSourceRef.current === 'kenwood' || cwSourceRef.current === 'tci';
|
||||||
for (let p = 0; p < parts.length; p++) {
|
for (let p = 0; p < parts.length; p++) {
|
||||||
if (aborted()) return; // ESC / Stop before this segment → stop sending, don't log
|
if (aborted()) return; // ESC / Stop before this segment → stop sending, don't log
|
||||||
const resolved = parts[p];
|
const resolved = parts[p];
|
||||||
@@ -3890,7 +4008,7 @@ export default function App() {
|
|||||||
// current WPM, so it scales automatically.
|
// current WPM, so it scales automatically.
|
||||||
const keyed = resolved + ' ';
|
const keyed = resolved + ' ';
|
||||||
setWkSent(resolved);
|
setWkSent(resolved);
|
||||||
const sendFn = cwSourceRef.current === 'flex' ? FlexSendCW : cwSourceRef.current === 'icom' ? IcomSendCW : cwSourceRef.current === 'yaesu' ? YaesuSendCW : cwSourceRef.current === 'kenwood' ? KenwoodSendCW : null;
|
const sendFn = cwSourceRef.current === 'flex' ? FlexSendCW : cwSourceRef.current === 'icom' ? IcomSendCW : cwSourceRef.current === 'yaesu' ? YaesuSendCW : cwSourceRef.current === 'kenwood' ? KenwoodSendCW : cwSourceRef.current === 'tci' ? TCISendCW : null;
|
||||||
if (sendFn) await sendFn(keyed).catch((e) => setError(String(e?.message ?? e)));
|
if (sendFn) await sendFn(keyed).catch((e) => setError(String(e?.message ?? e)));
|
||||||
else await WinkeyerSend(keyed).catch((e) => setError(String(e?.message ?? e)));
|
else await WinkeyerSend(keyed).catch((e) => setError(String(e?.message ?? e)));
|
||||||
// WAIT for THIS segment's CW to finish before moving on — so a <LOGQSO>
|
// WAIT for THIS segment's CW to finish before moving on — so a <LOGQSO>
|
||||||
@@ -3933,6 +4051,7 @@ export default function App() {
|
|||||||
else if (cwSourceRef.current === 'flex') FlexStopCW().catch(() => {});
|
else if (cwSourceRef.current === 'flex') FlexStopCW().catch(() => {});
|
||||||
else if (cwSourceRef.current === 'yaesu') YaesuStopCW().catch(() => {});
|
else if (cwSourceRef.current === 'yaesu') YaesuStopCW().catch(() => {});
|
||||||
else if (cwSourceRef.current === 'kenwood') KenwoodStopCW().catch(() => {});
|
else if (cwSourceRef.current === 'kenwood') KenwoodStopCW().catch(() => {});
|
||||||
|
else if (cwSourceRef.current === 'tci') TCIStopCW().catch(() => {});
|
||||||
else WinkeyerStop().catch(() => {});
|
else WinkeyerStop().catch(() => {});
|
||||||
}
|
}
|
||||||
// runAutoCall sends macro i, waits for the keyer to finish, waits the chosen
|
// runAutoCall sends macro i, waits for the keyer to finish, waits the chosen
|
||||||
@@ -3981,6 +4100,10 @@ export default function App() {
|
|||||||
// send-on-type: key the typed chars verbatim (no variable substitution).
|
// send-on-type: key the typed chars verbatim (no variable substitution).
|
||||||
function wkSendRaw(chars: string) {
|
function wkSendRaw(chars: string) {
|
||||||
if (cwSourceRef.current === 'flex') { FlexSendCW(chars).catch(() => {}); return; }
|
if (cwSourceRef.current === 'flex') { FlexSendCW(chars).catch(() => {}); return; }
|
||||||
|
// TCI keys the character as a macro of its own. There is no un-typing it
|
||||||
|
// afterwards — the radio can stop the message but not shorten it — so the
|
||||||
|
// backspace below leaves the TCI engine alone rather than pretending.
|
||||||
|
if (cwSourceRef.current === 'tci') { TCISendCW(chars).catch(() => {}); return; }
|
||||||
WinkeyerSend(chars).catch(() => {});
|
WinkeyerSend(chars).catch(() => {});
|
||||||
}
|
}
|
||||||
function wkBackspace() {
|
function wkBackspace() {
|
||||||
@@ -4707,13 +4830,17 @@ export default function App() {
|
|||||||
}
|
}
|
||||||
wbTimerRef.current = window.setTimeout(() => runWorkedBefore(call), 150);
|
wbTimerRef.current = window.setTimeout(() => runWorkedBefore(call), 150);
|
||||||
}
|
}
|
||||||
// applySpotPOTA sets the QSO's POTA award reference(s) from a clicked spot's
|
// Award references carried by the spot itself: the park a station is
|
||||||
// park ref ("US-4164" or n-fer "US-1,US-2"). Empty ref clears it (fresh
|
// activating, the summit it is on, or both. Written into award_refs the same
|
||||||
// target). Routed to the pota_ref column at save via applyAwardRefs.
|
// way for each, so logging the contact credits it without retyping a
|
||||||
function applySpotPOTA(potaRef?: string) {
|
// reference that was on screen.
|
||||||
const refs = String(potaRef || '')
|
function applySpotRefs(potaRef?: string, sotaRef?: string) {
|
||||||
.split(/[,;]/).map((x) => x.trim().toUpperCase()).filter(Boolean);
|
const split = (v?: string) => String(v || '').split(/[,;]/).map((x) => x.trim().toUpperCase()).filter(Boolean);
|
||||||
setDetails((d) => ({ ...d, award_refs: refs.map((r) => `POTA@${r}`).join(';') }));
|
const refs = [
|
||||||
|
...split(potaRef).map((r) => `POTA@${r}`),
|
||||||
|
...split(sotaRef).map((r) => `SOTA@${r}`),
|
||||||
|
];
|
||||||
|
setDetails((d) => ({ ...d, award_refs: refs.join(';') }));
|
||||||
}
|
}
|
||||||
function onCallsignInput(v: string, opts?: { force?: boolean }) {
|
function onCallsignInput(v: string, opts?: { force?: boolean }) {
|
||||||
// Programmatic call-sets (force: spot click, UDP, external app) count as
|
// Programmatic call-sets (force: spot click, UDP, external app) count as
|
||||||
@@ -4886,6 +5013,7 @@ export default function App() {
|
|||||||
{ type: 'item', label: (cwEnabled ? '✓ ' : '') + t('tools.cwDecoder'), action: 'tools.cwdecoder' },
|
{ type: 'item', label: (cwEnabled ? '✓ ' : '') + t('tools.cwDecoder'), action: 'tools.cwdecoder' },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ type: 'item', label: (netEnabled ? '✓ ' : '') + t('tools.net'), action: 'tools.net' },
|
{ 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: (contestTabEnabled ? '✓ ' : '') + t('tools.contest'), action: 'tools.contest' },
|
||||||
{ type: 'item', label: t('tools.alerts'), action: 'tools.alerts' },
|
{ type: 'item', label: t('tools.alerts'), action: 'tools.alerts' },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
@@ -4909,7 +5037,7 @@ export default function App() {
|
|||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ type: 'item', label: t('help.about'), action: 'help.about' },
|
{ 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) {
|
function handleMenu(action: string) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
@@ -4937,6 +5065,7 @@ export default function App() {
|
|||||||
case 'tools.dvk': setDvkEnabled((v) => !v); break;
|
case 'tools.dvk': setDvkEnabled((v) => !v); break;
|
||||||
case 'tools.cwdecoder': toggleCwDecoder(); break;
|
case 'tools.cwdecoder': toggleCwDecoder(); break;
|
||||||
case 'tools.net': setNetEnabled((v) => { const nv = !v; if (nv) setActiveTab('net'); return nv; }); 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.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.alerts': setAlertsOpen(true); break;
|
||||||
case 'tools.duplicates': setShowDuplicates(true); break;
|
case 'tools.duplicates': setShowDuplicates(true); break;
|
||||||
@@ -5752,6 +5881,13 @@ export default function App() {
|
|||||||
// worked call still matches its own entity status too (new-band/new-slot),
|
// worked call still matches its own entity status too (new-band/new-slot),
|
||||||
// so it stays visible under those chips.
|
// so it stays visible under those chips.
|
||||||
const matches = (st !== 'worked' && clusterStatusFilter.has(st))
|
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?.worked_call && clusterStatusFilter.has('worked'))
|
||||||
|| (!!e?.new_pota && clusterStatusFilter.has('new-pota'))
|
|| (!!e?.new_pota && clusterStatusFilter.has('new-pota'))
|
||||||
|| (!!e?.new_county && clusterStatusFilter.has('new-county'))
|
|| (!!e?.new_county && clusterStatusFilter.has('new-county'))
|
||||||
@@ -5808,11 +5944,17 @@ export default function App() {
|
|||||||
});
|
});
|
||||||
let rendered = list as (ClusterSpot & { repeats?: number })[];
|
let rendered = list as (ClusterSpot & { repeats?: number })[];
|
||||||
if (clusterGroup) {
|
if (clusterGroup) {
|
||||||
|
// A DUPLICATE is the same station on the same band AND mode — the dozen
|
||||||
|
// skimmers that all heard one CQ. The same station on another band is the
|
||||||
|
// opposite of a duplicate: it is the line a DX chaser is scanning for, and
|
||||||
|
// grouping on the callsign alone deleted it. RI1FJL spotted on five bands
|
||||||
|
// showed as one row, so four slots simply vanished from the list.
|
||||||
const seen = new Map<string, ClusterSpot & { repeats: number }>();
|
const seen = new Map<string, ClusterSpot & { repeats: number }>();
|
||||||
for (const s of list) {
|
for (const s of list) {
|
||||||
const e = seen.get(s.dx_call);
|
const key = `${(s.dx_call ?? '').toUpperCase()}|${(s.band ?? '').toLowerCase()}|${inferSpotMode(s.comment ?? '', s.freq_hz)}`;
|
||||||
|
const e = seen.get(key);
|
||||||
if (e) { e.repeats++; }
|
if (e) { e.repeats++; }
|
||||||
else seen.set(s.dx_call, { ...s, repeats: 1 });
|
else seen.set(key, { ...s, repeats: 1 });
|
||||||
}
|
}
|
||||||
rendered = Array.from(seen.values());
|
rendered = Array.from(seen.values());
|
||||||
}
|
}
|
||||||
@@ -5852,12 +5994,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 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) => (
|
const fChip = (key: string, label: string, cls: string, on: boolean, toggle: () => void, style?: React.CSSProperties, title?: string) => (
|
||||||
<button key={key} type="button" onClick={toggle}
|
<button key={key} type="button" onClick={toggle} title={title}
|
||||||
className={cn(F_CHIP, on ? cls : `${cls} opacity-40 hover:opacity-80`)}>
|
className={cn(F_CHIP, on ? cls : `${cls} opacity-40 hover:opacity-80`)} style={style}>
|
||||||
{label}
|
{label}
|
||||||
</button>
|
</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 = () => (
|
const renderClusterFilters = () => (
|
||||||
<div className="w-56 shrink-0 border-l border-border/60 flex flex-col min-h-0 bg-muted/10">
|
<div className="w-56 shrink-0 border-l border-border/60 flex flex-col min-h-0 bg-muted/10">
|
||||||
@@ -5973,14 +6123,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-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-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-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
|
// 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.
|
// 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' },
|
{ 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
|
// Same colours as the badges in the grid — a filter that does not
|
||||||
// look like what it selects has to be learned twice.
|
// 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-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' },
|
{ 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.
|
// 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' },
|
{ k: 'new-grid' as SpotFilterKey, label: 'NEW GRID', cls: 'bg-muted text-foreground border-border' },
|
||||||
@@ -5988,8 +6138,9 @@ export default function App() {
|
|||||||
// worked spots; the separate "Hide worked" checkbox drops them — they
|
// worked spots; the separate "Hide worked" checkbox drops them — they
|
||||||
// are opposite controls, so don't use both at once.
|
// 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' },
|
{ 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),
|
]).filter((s: any) => s.k !== 'new-pota' || chasePota())
|
||||||
() => setClusterStatusFilter((cur) => { const n = new Set(cur); if (n.has(s.k)) n.delete(s.k); else n.add(s.k); return n; })))}
|
.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>,
|
</div>,
|
||||||
clusterStatusFilter.size > 0 ? (
|
clusterStatusFilter.size > 0 ? (
|
||||||
<button type="button" onClick={() => setClusterStatusFilter(new Set())}
|
<button type="button" onClick={() => setClusterStatusFilter(new Set())}
|
||||||
@@ -6134,13 +6285,19 @@ export default function App() {
|
|||||||
case 'cluster':
|
case 'cluster':
|
||||||
return (
|
return (
|
||||||
<div className="h-full w-full min-h-0 flex flex-col bg-card border border-border rounded-lg overflow-hidden">
|
<div className="h-full w-full min-h-0 flex flex-col bg-card border border-border rounded-lg overflow-hidden">
|
||||||
<div className="flex items-center justify-between px-2 py-1 border-b border-border/60 shrink-0">
|
|
||||||
<span className="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">Cluster</span>
|
|
||||||
{clusterFiltersToggleBtn}
|
|
||||||
</div>
|
|
||||||
<div className="flex-1 min-h-0 flex">
|
<div className="flex-1 min-h-0 flex">
|
||||||
<div className="flex-1 min-w-0 flex flex-col min-h-0">
|
<div className="flex-1 min-w-0 flex flex-col min-h-0">
|
||||||
<ClusterGrid key={`clg-${activeProfileId ?? 'x'}`} rows={clusterRenderedRows as any} spotStatus={spotStatus} onSpotClick={handleSpotClick} onSpotSelect={handleSpotSelect} />
|
{/* Title, count and Filters ride INSIDE the grid's toolbar: two
|
||||||
|
header rows cost a pane that is often only a few spots tall
|
||||||
|
one of the few lines it has. */}
|
||||||
|
<ClusterGrid key={`clg-${activeProfileId ?? 'x'}`} rows={clusterRenderedRows as any} spotStatus={spotStatus} onSpotClick={handleSpotClick} onSpotSelect={handleSpotSelect}
|
||||||
|
headerLeft={(
|
||||||
|
<>
|
||||||
|
<span className="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground shrink-0">DX Cluster</span>
|
||||||
|
<Badge variant="secondary" className="text-[10px] shrink-0">{spots.length} live</Badge>
|
||||||
|
{clusterFiltersToggleBtn}
|
||||||
|
</>
|
||||||
|
)} />
|
||||||
</div>
|
</div>
|
||||||
{clusterShowFilters && renderClusterFilters()}
|
{clusterShowFilters && renderClusterFilters()}
|
||||||
</div>
|
</div>
|
||||||
@@ -6187,6 +6344,13 @@ export default function App() {
|
|||||||
<IcomPanel isNetwork={catBackend === 'icom-net'} onReportRST={(r) => { setRstSent(r); rstUserEditedRef.current = true; }} />
|
<IcomPanel isNetwork={catBackend === 'icom-net'} onReportRST={(r) => { setRstSent(r); rstUserEditedRef.current = true; }} />
|
||||||
</div>
|
</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':
|
case 'netcontrol':
|
||||||
return (
|
return (
|
||||||
<div className="h-full w-full min-h-0 flex flex-col rounded-lg overflow-hidden border border-border">
|
<div className="h-full w-full min-h-0 flex flex-col rounded-lg overflow-hidden border border-border">
|
||||||
@@ -6326,7 +6490,7 @@ export default function App() {
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={() => p && goto(p.bearingShort, 'SP')}
|
onClick={() => p && goto(p.bearingShort, 'SP')}
|
||||||
title={p
|
title={p
|
||||||
? `Rotate short-path · ${Math.round(p.distanceShort).toLocaleString()} km`
|
? `Rotate short-path · ${formatDistance(p.distanceShort)}`
|
||||||
: (station.my_grid ? 'No remote grid' : 'Set your station grid in Preferences')}
|
: (station.my_grid ? 'No remote grid' : 'Set your station grid in Preferences')}
|
||||||
className={cn(
|
className={cn(
|
||||||
'inline-flex items-center gap-1 px-2 py-0.5 transition-colors',
|
'inline-flex items-center gap-1 px-2 py-0.5 transition-colors',
|
||||||
@@ -6342,7 +6506,7 @@ export default function App() {
|
|||||||
type="button"
|
type="button"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={() => p && goto(p.bearingLong, 'LP')}
|
onClick={() => p && goto(p.bearingLong, 'LP')}
|
||||||
title={p ? `Rotate long-path · ${Math.round(p.distanceLong).toLocaleString()} km` : ''}
|
title={p ? `Rotate long-path · ${formatDistance(p.distanceLong)}` : ''}
|
||||||
className={cn(
|
className={cn(
|
||||||
'px-1.5 py-0.5 border-l border-info-border text-[10px] transition-colors',
|
'px-1.5 py-0.5 border-l border-info-border text-[10px] transition-colors',
|
||||||
disabled
|
disabled
|
||||||
@@ -7080,7 +7244,7 @@ export default function App() {
|
|||||||
// relative + absolute inner: the panel's content can't grow the row, so
|
// 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
|
// 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.
|
// 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">
|
<div className="absolute inset-0 flex flex-col min-h-0">
|
||||||
<DetailsPanel
|
<DetailsPanel
|
||||||
callsign={callsign}
|
callsign={callsign}
|
||||||
@@ -7262,7 +7426,10 @@ export default function App() {
|
|||||||
entry, and the rig onto the frequency it was decoded on. */}
|
entry, and the rig onto the frequency it was decoded on. */}
|
||||||
<ChaseNewPanel onPick={(sp) => {
|
<ChaseNewPanel onPick={(sp) => {
|
||||||
onCallsignInput(sp.call, { force: true });
|
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'); }} />
|
}} onClose={() => { setShowChaseNew(false); writeUiPref('opslog.showChaseNew', '0'); }} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -7455,6 +7622,21 @@ export default function App() {
|
|||||||
</span>
|
</span>
|
||||||
</TabsTrigger>
|
</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 === 'flex' && <TabsTrigger value="flex">Flex Console</TabsTrigger>}
|
||||||
{catState.backend === 'icom' && <TabsTrigger value="icom">Icom Console</TabsTrigger>}
|
{catState.backend === 'icom' && <TabsTrigger value="icom">Icom Console</TabsTrigger>}
|
||||||
{catState.backend === 'yaesu' && <TabsTrigger value="yaesu">Yaesu Console</TabsTrigger>}
|
{catState.backend === 'yaesu' && <TabsTrigger value="yaesu">Yaesu Console</TabsTrigger>}
|
||||||
@@ -8166,6 +8348,12 @@ export default function App() {
|
|||||||
{/* Band Map: several bands shown side-by-side (panadapter-style
|
{/* Band Map: several bands shown side-by-side (panadapter-style
|
||||||
strips). Pick bands with the chips; each strip is clickable to
|
strips). Pick bands with the chips; each strip is clickable to
|
||||||
tune the rig. */}
|
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 && (
|
{netEnabled && (
|
||||||
<TabsContent value="net" className="mt-0 flex flex-col min-h-0 flex-1">
|
<TabsContent value="net" className="mt-0 flex flex-col min-h-0 flex-1">
|
||||||
<NetControlPanel onLogged={refresh} countries={countries} bands={bands} modes={modes}
|
<NetControlPanel onLogged={refresh} countries={countries} bands={bands} modes={modes}
|
||||||
@@ -8312,11 +8500,16 @@ export default function App() {
|
|||||||
</span>
|
</span>
|
||||||
<div className="w-px h-4 bg-border mx-1" />
|
<div className="w-px h-4 bg-border mx-1" />
|
||||||
<Chip on={clusterUp} label="Cluster" title={clusterUp ? 'Cluster connected' : 'Cluster offline'} onClick={() => setActiveTab('cluster')} />
|
<Chip on={clusterUp} label="Cluster" title={clusterUp ? 'Cluster connected' : 'Cluster offline'} onClick={() => setActiveTab('cluster')} />
|
||||||
<Chip
|
{/* The CAT chip is also the radio switch.
|
||||||
on={catUp}
|
With one radio it behaves as it always did — click opens the CAT
|
||||||
label={<span className="inline-flex items-center gap-1"><RadioTower className="size-3" />{catUp ? (catState.rig || 'CAT') : (catState.enabled ? (shortCatError(catState.error) || 'CAT off') : 'CAT')}</span>}
|
settings. With several it opens a menu: pick one and OpsLog
|
||||||
title={catUp ? `CAT: ${catState.rig || catState.backend || 'connected'}` : (catState.error || 'CAT')}
|
reconnects to it, leaving the rest of the station alone. The
|
||||||
onClick={() => { setSettingsSection('cat'); setShowSettings(true); }}
|
answer to "I have two rigs" used to be "make two profiles",
|
||||||
|
which moves the logbook with it. */}
|
||||||
|
<RadioChip
|
||||||
|
catUp={catUp}
|
||||||
|
catState={catState}
|
||||||
|
onOpenSettings={() => { setSettingsSection('cat'); setShowSettings(true); }}
|
||||||
/>
|
/>
|
||||||
<Chip
|
<Chip
|
||||||
on={rotatorHeading.enabled && rotatorHeading.ok}
|
on={rotatorHeading.enabled && rotatorHeading.ok}
|
||||||
@@ -8329,9 +8522,13 @@ export default function App() {
|
|||||||
STANDBY, red = offline. CLICK toggles OPERATE ↔ STANDBY (optimistic
|
STANDBY, red = offline. CLICK toggles OPERATE ↔ STANDBY (optimistic
|
||||||
flip, the 2s poll reconciles); offline → click opens the settings. */}
|
flip, the 2s poll reconciles); offline → click opens the settings. */}
|
||||||
{ampSts.map((a: any) => {
|
{ampSts.map((a: any) => {
|
||||||
const isPGXL = !a.spe && !a.acom;
|
// Every brand must be listed here. A KPA was not, so its chip
|
||||||
|
// read the fallback — permanently red on a connected amplifier,
|
||||||
|
// and clicking it opened the settings instead of switching to
|
||||||
|
// STANDBY.
|
||||||
|
const isPGXL = !a.spe && !a.acom && !a.kpa;
|
||||||
const viaFlex = isPGXL && !!flexAmp?.amp_available;
|
const viaFlex = isPGXL && !!flexAmp?.amp_available;
|
||||||
const raw = a.spe ?? a.acom ?? a.pgxl ?? { connected: false };
|
const raw = a.spe ?? a.acom ?? a.kpa ?? a.pgxl ?? { connected: false };
|
||||||
const connected = !!raw.connected || viaFlex;
|
const connected = !!raw.connected || viaFlex;
|
||||||
const operate = viaFlex ? !!flexAmp.amp_operate : !!raw.operate;
|
const operate = viaFlex ? !!flexAmp.amp_operate : !!raw.operate;
|
||||||
const dot = !connected ? 'bg-danger' : operate ? 'bg-success' : 'bg-warning';
|
const dot = !connected ? 'bg-danger' : operate ? 'bg-success' : 'bg-warning';
|
||||||
@@ -8341,7 +8538,7 @@ export default function App() {
|
|||||||
const want = !operate;
|
const want = !operate;
|
||||||
if (viaFlex) setFlexAmp((f: any) => ({ ...f, amp_operate: want }));
|
if (viaFlex) setFlexAmp((f: any) => ({ ...f, amp_operate: want }));
|
||||||
else setAmpSts((l) => l.map((x: any) => x.id === a.id
|
else setAmpSts((l) => l.map((x: any) => x.id === a.id
|
||||||
? { ...x, spe: x.spe && { ...x.spe, operate: want }, acom: x.acom && { ...x.acom, operate: want }, pgxl: x.pgxl && { ...x.pgxl, operate: want } }
|
? { ...x, spe: x.spe && { ...x.spe, operate: want }, acom: x.acom && { ...x.acom, operate: want }, kpa: x.kpa && { ...x.kpa, operate: want }, pgxl: x.pgxl && { ...x.pgxl, operate: want } }
|
||||||
: x));
|
: x));
|
||||||
(viaFlex ? FlexAmpOperate(want) : AmpOperate(a.id, want)).catch(() => {});
|
(viaFlex ? FlexAmpOperate(want) : AmpOperate(a.id, want)).catch(() => {});
|
||||||
};
|
};
|
||||||
@@ -8468,7 +8665,7 @@ export default function App() {
|
|||||||
"1.5k" and then appended the unit, giving "1.5kkm" — and even
|
"1.5k" and then appended the unit, giving "1.5kkm" — and even
|
||||||
written correctly, "1.5k km" makes a reader do arithmetic to
|
written correctly, "1.5k km" makes a reader do arithmetic to
|
||||||
recover a number that was four characters long to begin with. */}
|
recover a number that was four characters long to begin with. */}
|
||||||
<span className="font-mono opacity-80">{o.median_km} km</span>
|
<span className="font-mono opacity-80">{formatDistance(o.median_km)}</span>
|
||||||
{/* Out of season is the one an operator must not learn last, so it
|
{/* Out of season is the one an operator must not learn last, so it
|
||||||
earns a mark on the badge rather than a line in the tooltip. */}
|
earns a mark on the badge rather than a line in the tooltip. */}
|
||||||
{!o.in_season && <span className="opacity-90">!</span>}
|
{!o.in_season && <span className="opacity-90">!</span>}
|
||||||
@@ -8513,9 +8710,14 @@ export default function App() {
|
|||||||
// freqMhz display string, which the manual-edit freeze / field locks can
|
// 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"
|
// 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.
|
// 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={
|
defaultFreqKHz={
|
||||||
catState.connected && (catState.freq_hz ?? 0) > 0
|
catState.connected && ((catState.split && (catState.freq_rx_hz ?? 0) > 0 ? catState.freq_rx_hz : catState.freq_hz) ?? 0) > 0
|
||||||
? Math.round(((catState.freq_hz ?? 0) / 1000) * 10) / 10
|
? Math.round((((catState.split && (catState.freq_rx_hz ?? 0) > 0 ? catState.freq_rx_hz : catState.freq_hz) ?? 0) / 1000) * 10) / 10
|
||||||
: parseFloat(freqMhz) > 0
|
: parseFloat(freqMhz) > 0
|
||||||
? Math.round(parseFloat(freqMhz) * 1000 * 10) / 10
|
? Math.round(parseFloat(freqMhz) * 1000 * 10) / 10
|
||||||
: (qsos[0]?.freq_hz ? Math.round((qsos[0].freq_hz / 1000) * 10) / 10 : 0)
|
: (qsos[0]?.freq_hz ? Math.round((qsos[0].freq_hz / 1000) * 10) / 10 : 0)
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ export function AmpCard({ amp, flex, t }: { amp: Amp; flex: any; t: (k: string,
|
|||||||
</div>
|
</div>
|
||||||
<span className={cn('inline-flex items-center gap-1.5 text-sm', kpa.connected ? 'text-muted-foreground' : 'text-danger')}>
|
<span className={cn('inline-flex items-center gap-1.5 text-sm', kpa.connected ? 'text-muted-foreground' : 'text-danger')}>
|
||||||
<span className={cn('size-2 rounded-full', kpa.connected ? 'bg-success' : 'bg-danger')} />
|
<span className={cn('size-2 rounded-full', kpa.connected ? 'bg-success' : 'bg-danger')} />
|
||||||
{kpa.connected ? (kpa.tuning ? t('flxp.kpaTuning') : (kpa.power_on ? 'ON' : 'OFF')) : t('flxp.acomOffline')}
|
{kpa.connected ? (kpa.tuning ? t('flxp.kpaTuning') : (kpa.power_on ? 'ON' : 'OFF')) : t('flxp.kpaOffline')}
|
||||||
</span>
|
</span>
|
||||||
{kpa.connected && (
|
{kpa.connected && (
|
||||||
<span className="text-sm font-mono text-muted-foreground tabular-nums">
|
<span className="text-sm font-mono text-muted-foreground tabular-nums">
|
||||||
|
|||||||
@@ -127,6 +127,12 @@ function MatrixColorsSection() {
|
|||||||
<span className="inline-block w-7 h-5 rounded bg-mx-dx-work" />
|
<span className="inline-block w-7 h-5 rounded bg-mx-dx-work" />
|
||||||
<span className="inline-block w-7 h-5 rounded bg-mx-none" />
|
<span className="inline-block w-7 h-5 rounded bg-mx-none" />
|
||||||
<span className="inline-block w-7 h-5 rounded bg-mx-none ring-2 ring-mx-cur ring-inset" />
|
<span className="inline-block w-7 h-5 rounded bg-mx-none ring-2 ring-mx-cur ring-inset" />
|
||||||
|
<span className="relative inline-block w-7 h-5 rounded bg-mx-dx-conf">
|
||||||
|
<span className="absolute top-[4px] right-[4px] size-[5px] rounded-full bg-mx-mark-work ring-1 ring-background" />
|
||||||
|
</span>
|
||||||
|
<span className="relative inline-block w-7 h-5 rounded bg-mx-dx-conf">
|
||||||
|
<span className="absolute top-[4px] right-[4px] size-[5px] rounded-full bg-mx-mark-conf ring-1 ring-background" />
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" onClick={reset}
|
<button type="button" onClick={reset}
|
||||||
|
|||||||
@@ -65,6 +65,19 @@ function cellStatus(r: AwardRef, band: string): CellStatus {
|
|||||||
if (r.bands?.includes(band)) return 'worked';
|
if (r.bands?.includes(band)) return 'worked';
|
||||||
return 'none';
|
return 'none';
|
||||||
}
|
}
|
||||||
|
// slotsToConfirm counts the band-slots worked with this reference and not yet
|
||||||
|
// confirmed on any of them — the QSLs still outstanding, one per cell showing W.
|
||||||
|
//
|
||||||
|
// It is the difference the Challenge line makes visible in the aggregate (1832
|
||||||
|
// worked against 1554 confirmed) without saying WHERE it is. Counted over the
|
||||||
|
// bands actually on screen, so it always adds up to the columns in front of the
|
||||||
|
// operator rather than to a band set they filtered out.
|
||||||
|
function slotsToConfirm(r: AwardRef, bands: string[]): number {
|
||||||
|
let n = 0;
|
||||||
|
for (const b of bands) if (cellStatus(r, b) === 'worked') n++;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
const CELL_STYLE: Record<CellStatus, string> = {
|
const CELL_STYLE: Record<CellStatus, string> = {
|
||||||
validated: 'bg-success text-success-foreground',
|
validated: 'bg-success text-success-foreground',
|
||||||
confirmed: 'bg-warning text-warning-foreground',
|
confirmed: 'bg-warning text-warning-foreground',
|
||||||
@@ -112,7 +125,7 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged, onPaperQSL }: {
|
|||||||
const [refSearch, setRefSearch] = useState('');
|
const [refSearch, setRefSearch] = useState('');
|
||||||
const [editing, setEditing] = useState(false);
|
const [editing, setEditing] = useState(false);
|
||||||
const [view, setView] = useState<'grid' | 'list' | 'stats'>('grid');
|
const [view, setView] = useState<'grid' | 'list' | 'stats'>('grid');
|
||||||
const [refFilter, setRefFilter] = useState<'all' | 'worked' | 'notworked' | 'worked_notconf'>('all');
|
const [refFilter, setRefFilter] = useState<'all' | 'worked' | 'notworked' | 'worked_notconf' | 'slots_notconf'>('all');
|
||||||
// Mode filter, stacked ON TOP of the status one. "Worked on CW but not
|
// Mode filter, stacked ON TOP of the status one. "Worked on CW but not
|
||||||
// confirmed" is two questions at once, and answering only one of them is what
|
// confirmed" is two questions at once, and answering only one of them is what
|
||||||
// sends an operator to a spreadsheet.
|
// sends an operator to a spreadsheet.
|
||||||
@@ -304,6 +317,10 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged, onPaperQSL }: {
|
|||||||
if (refFilter === 'worked' && !r.worked) return false;
|
if (refFilter === 'worked' && !r.worked) return false;
|
||||||
if (refFilter === 'notworked' && r.worked) return false;
|
if (refFilter === 'notworked' && r.worked) return false;
|
||||||
if (refFilter === 'worked_notconf' && !(r.worked && !r.confirmed)) return false;
|
if (refFilter === 'worked_notconf' && !(r.worked && !r.confirmed)) return false;
|
||||||
|
// Worked-not-confirmed by SLOT, not by reference: an entity confirmed on
|
||||||
|
// 20 m still has a 15 m contact waiting for its card, and every filter
|
||||||
|
// above answers "no" for it because the entity itself is confirmed.
|
||||||
|
if (refFilter === 'slots_notconf' && slotsToConfirm(r, gridBands) === 0) return false;
|
||||||
if (modeFilter !== 'all' && refFilter !== 'notworked') {
|
if (modeFilter !== 'all' && refFilter !== 'notworked') {
|
||||||
// A reference never worked has no mode, so "not worked" plus a mode is
|
// A reference never worked has no mode, so "not worked" plus a mode is
|
||||||
// a contradiction: the mode filter stands aside rather than emptying
|
// a contradiction: the mode filter stands aside rather than emptying
|
||||||
@@ -339,7 +356,14 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged, onPaperQSL }: {
|
|||||||
}
|
}
|
||||||
return a.ref.localeCompare(b.ref, undefined, { numeric: true }) * dir;
|
return a.ref.localeCompare(b.ref, undefined, { numeric: true }) * dir;
|
||||||
});
|
});
|
||||||
}, [current, refSearch, refFilter, modeFilter, refSort, refSortDir]);
|
}, [current, refSearch, refFilter, modeFilter, refSort, refSortDir, gridBands]);
|
||||||
|
|
||||||
|
// The gap itself, over whatever the other filters left on screen: the number
|
||||||
|
// of cells an operator would have to turn green to close it.
|
||||||
|
const slotGap = useMemo(
|
||||||
|
() => filteredRefs.reduce((n, r) => n + slotsToConfirm(r, gridBands), 0),
|
||||||
|
[filteredRefs, gridBands],
|
||||||
|
);
|
||||||
|
|
||||||
// The group column earns its width only when the list actually carries one
|
// The group column earns its width only when the list actually carries one
|
||||||
// (DXCC prefixes, POTA locations); most custom lists have none. For DXCC the
|
// (DXCC prefixes, POTA locations); most custom lists have none. For DXCC the
|
||||||
@@ -468,7 +492,7 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged, onPaperQSL }: {
|
|||||||
<Input className="h-8 w-56 pl-7 text-sm" placeholder={t('awp.filterReferences')} value={refSearch} onChange={(e) => setRefSearch(e.target.value)} />
|
<Input className="h-8 w-56 pl-7 text-sm" placeholder={t('awp.filterReferences')} value={refSearch} onChange={(e) => setRefSearch(e.target.value)} />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center rounded-md border border-border overflow-hidden text-sm">
|
<div className="flex items-center rounded-md border border-border overflow-hidden text-sm">
|
||||||
{([['all', t('awp.filterAll')], ['worked', t('awp.filterWkd')], ['notworked', t('awp.filterNotWkd')], ['worked_notconf', t('awp.filterWkdNotCfmd')]] as const).map(([k, label]) => (
|
{([['all', t('awp.filterAll')], ['worked', t('awp.filterWkd')], ['notworked', t('awp.filterNotWkd')], ['worked_notconf', t('awp.filterWkdNotCfmd')], ['slots_notconf', t('awp.filterSlotsNotCfmd')]] as const).map(([k, label]) => (
|
||||||
<button key={k} onClick={() => setRefFilter(k)}
|
<button key={k} onClick={() => setRefFilter(k)}
|
||||||
className={cn('px-2 py-1', refFilter === k ? 'bg-accent font-medium' : 'hover:bg-accent/50 text-muted-foreground')}>
|
className={cn('px-2 py-1', refFilter === k ? 'bg-accent font-medium' : 'hover:bg-accent/50 text-muted-foreground')}>
|
||||||
{label}
|
{label}
|
||||||
@@ -484,6 +508,11 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged, onPaperQSL }: {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xs text-muted-foreground">{filteredRefs.length} {t('awp.refs')}</span>
|
<span className="text-xs text-muted-foreground">{filteredRefs.length} {t('awp.refs')}</span>
|
||||||
|
{slotGap > 0 && (
|
||||||
|
<span className="text-xs text-muted-foreground" title={t('awp.slotGapTip')}>
|
||||||
|
· <span className="font-semibold text-foreground">{slotGap}</span> {t('awp.slotGap')}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
{/* Only for an award scoped to a DXCC entity. "In this award's
|
{/* Only for an award scoped to a DXCC entity. "In this award's
|
||||||
scope but with no reference" needs a scope to be in: on a
|
scope but with no reference" needs a scope to be in: on a
|
||||||
worldwide reference award — POTA, SOTA, IOTA, WWFF — every
|
worldwide reference award — POTA, SOTA, IOTA, WWFF — every
|
||||||
@@ -604,7 +633,14 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged, onPaperQSL }: {
|
|||||||
<td key={b} className="border-b border-l border-border/30 p-0 text-center">
|
<td key={b} className="border-b border-l border-border/30 p-0 text-center">
|
||||||
{s === 'none' ? <span className="block w-11 h-7" /> : (
|
{s === 'none' ? <span className="block w-11 h-7" /> : (
|
||||||
<button
|
<button
|
||||||
className={cn('block w-11 h-7 text-[11px] font-bold', CELL_STYLE[s], 'hover:brightness-110')}
|
className={cn('block w-11 h-7 text-[11px] font-bold', CELL_STYLE[s], 'hover:brightness-110',
|
||||||
|
// Chasing the slots still to confirm, the
|
||||||
|
// confirmed ones are context, not the answer:
|
||||||
|
// a row is kept for its W cells and its V
|
||||||
|
// cells would otherwise be the loudest thing
|
||||||
|
// on it. Faded rather than hidden — which
|
||||||
|
// band is already done is worth seeing.
|
||||||
|
refFilter === 'slots_notconf' && s !== 'worked' && 'opacity-25')}
|
||||||
title={t('awp.cellTitle', { ref: r.ref, band: b })}
|
title={t('awp.cellTitle', { ref: r.ref, band: b })}
|
||||||
onClick={() => setCell({ ref: r.ref, band: b, name: r.name })}
|
onClick={() => setCell({ ref: r.ref, band: b, name: r.name })}
|
||||||
>{CELL_LABEL[s]}</button>
|
>{CELL_LABEL[s]}</button>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|||||||
import { Minus, Plus, Crosshair, X, PanelLeft, PanelRight } from 'lucide-react';
|
import { Minus, Plus, Crosshair, X, PanelLeft, PanelRight } from 'lucide-react';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { useI18n } from '@/lib/i18n';
|
import { useI18n } from '@/lib/i18n';
|
||||||
|
import { bandRange, bandSegments, subscribeIaruRegion, type SegMode } from '@/lib/bandplan';
|
||||||
import { spotStatusKey, inferSpotMode, spotModeCategory } from '@/lib/spot';
|
import { spotStatusKey, inferSpotMode, spotModeCategory } from '@/lib/spot';
|
||||||
import { SPOT_MARKERS, activeMarkers } from '@/lib/spotMarkers';
|
import { SPOT_MARKERS, activeMarkers } from '@/lib/spotMarkers';
|
||||||
import { applySpotDisplay, readSpotDisplayOptions } from '@/lib/spotDisplay';
|
import { applySpotDisplay, readSpotDisplayOptions } from '@/lib/spotDisplay';
|
||||||
@@ -76,6 +77,13 @@ const BMP_MARKER_LABEL: Record<string, string> = {
|
|||||||
new_pota: 'bmp.legendNewPota',
|
new_pota: 'bmp.legendNewPota',
|
||||||
new_county: 'bmp.legendNewCounty',
|
new_county: 'bmp.legendNewCounty',
|
||||||
worked_call: 'bmp.legendWorkedCall',
|
worked_call: 'bmp.legendWorkedCall',
|
||||||
|
// Not on the strip — the pill is 22 px and a fourth segment turns it into a
|
||||||
|
// colour code nobody reads — but the TOOLTIP has room, and leaving them out of
|
||||||
|
// it made the two panels contradict each other: the cluster said NEW PFX about
|
||||||
|
// a spot the map called "Worked". Both were true (the entity is worked on this
|
||||||
|
// slot, the WPX prefix never has been) and neither view said so.
|
||||||
|
new_pfx: 'clg2.newPfx',
|
||||||
|
new_grid: 'clg2.newGrid',
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -107,59 +115,26 @@ interface Props {
|
|||||||
keyNav?: boolean;
|
keyNav?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BAND_RANGES: Record<string, [number, number]> = {
|
// Band edges and mode segments come from lib/bandplan, which knows the
|
||||||
'160m': [1800, 2000],
|
// operator's IARU region (Settings → General): a Region 2 operator's 40 m runs
|
||||||
'80m': [3500, 3800],
|
// to 7300 with phone from 7125, and drawing Region 1's plan under their spots
|
||||||
'60m': [5350, 5450],
|
// cut the top 100 kHz of the band off the map.
|
||||||
'40m': [7000, 7200],
|
//
|
||||||
'30m': [10100, 10150],
|
// Sub-band shading colours: these are IDENTITIES (which mode the segment is
|
||||||
'20m': [14000, 14350],
|
// for), not states, so they take categorical hues — never the status tokens.
|
||||||
'17m': [18068, 18168],
|
// All three are drawn from the cool end of the categorical order and laid down
|
||||||
'15m': [21000, 21450],
|
// at low opacity, so the band plan stays background context while the warm
|
||||||
'12m': [24890, 24990],
|
// spot pills keep the foreground. Checked with the palette validator in both
|
||||||
'10m': [28000, 29700],
|
// themes (violet failed the dark protan step; magenta clears every check).
|
||||||
'6m': [50000, 50500],
|
const SEG_COLOR: Record<SegMode, string> = {
|
||||||
'4m': [70000, 70500],
|
cw: 'var(--chart-7)', // magenta
|
||||||
'2m': [144000, 146000],
|
digi: 'var(--chart-1)', // blue
|
||||||
'70cm': [430000, 440000],
|
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
|
// A band-plan wash is CONTEXT, not data: it must stay under the spot pills that
|
||||||
// are read on top of it.
|
// are read on top of it.
|
||||||
const SEG_OPACITY = 0.13;
|
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.
|
// Small coloured dot + label used in the band-map legend strip.
|
||||||
function LegendDot({ cls, colour, label }: { cls?: string; colour?: string; label: string }) {
|
function LegendDot({ cls, colour, label }: { cls?: string; colour?: string; label: string }) {
|
||||||
return (
|
return (
|
||||||
@@ -297,13 +272,16 @@ export function BandMap({ band, spots, spotStatus: spotStatusRaw, currentFreqHz,
|
|||||||
// nothing until the next poll happened to hand over a fresh object.
|
// nothing until the next poll happened to hand over a fresh object.
|
||||||
const dispOpts = readSpotDisplayOptions();
|
const dispOpts = readSpotDisplayOptions();
|
||||||
const spotStatus = useMemo(() => {
|
const spotStatus = useMemo(() => {
|
||||||
if (!dispOpts.muteWorked && !dispOpts.slotHighlight) return spotStatusRaw;
|
if (!dispOpts.muteWorked && !dispOpts.slotHighlight && dispOpts.chasePota) return spotStatusRaw;
|
||||||
const out: Record<string, SpotStatusEntry> = {};
|
const out: Record<string, SpotStatusEntry> = {};
|
||||||
for (const k of Object.keys(spotStatusRaw)) out[k] = applySpotDisplay(spotStatusRaw[k], dispOpts) as SpotStatusEntry;
|
for (const k of Object.keys(spotStatusRaw)) out[k] = applySpotDisplay(spotStatusRaw[k], dispOpts) as SpotStatusEntry;
|
||||||
return out;
|
return out;
|
||||||
}, [spotStatusRaw, dispOpts.muteWorked, dispOpts.slotHighlight]);
|
}, [spotStatusRaw, dispOpts.muteWorked, dispOpts.slotHighlight, dispOpts.chasePota]);
|
||||||
const range = BAND_RANGES[band];
|
// Re-render when the operator changes their IARU region in Settings.
|
||||||
const segments = SEGMENT_COLORS[band] ?? [];
|
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));
|
const [zoomIdx, setZoomIdx] = useState(() => readZoom(band));
|
||||||
// The docked map follows the rig, so a band change must bring up THAT band's
|
// The docked map follows the rig, so a band change must bring up THAT band's
|
||||||
// remembered zoom.
|
// remembered zoom.
|
||||||
@@ -737,7 +715,7 @@ export function BandMap({ band, spots, spotStatus: spotStatusRaw, currentFreqHz,
|
|||||||
'hover:translate-x-0.5 hover:shadow',
|
'hover:translate-x-0.5 hover:shadow',
|
||||||
style.pill,
|
style.pill,
|
||||||
)}
|
)}
|
||||||
title={`${p.spot.dx_call}${entry?.country ? ' · ' + entry.country : ''} · ${p.spot.freq_khz.toFixed(1)} kHz · ${statusLabel(st, t)}${markersFor(entry).map((m) => ' · ' + t(BMP_MARKER_LABEL[m.key])).join('')}${p.spot.comment ? ' · ' + p.spot.comment : ''}${p.spot.spotter ? ' · de ' + p.spot.spotter : ''}`}
|
title={`${p.spot.dx_call}${entry?.country ? ' · ' + entry.country : ''} · ${p.spot.freq_khz.toFixed(1)} kHz · ${statusLabel(st, t)}${activeMarkers(entry).map((m) => ' · ' + t(BMP_MARKER_LABEL[m.key])).join('')}${p.spot.comment ? ' · ' + p.spot.comment : ''}${p.spot.spotter ? ' · de ' + p.spot.spotter : ''}`}
|
||||||
>
|
>
|
||||||
{/* Left accent strip. With no extra marker it repeats the status
|
{/* Left accent strip. With no extra marker it repeats the status
|
||||||
colour, exactly as before; otherwise it splits into one
|
colour, exactly as before; otherwise it splits into one
|
||||||
@@ -787,9 +765,9 @@ export function BandMap({ band, spots, spotStatus: spotStatusRaw, currentFreqHz,
|
|||||||
))}
|
))}
|
||||||
{/* Sub-band shading, so the wash behind the pills is never colour-alone. */}
|
{/* Sub-band shading, so the wash behind the pills is never colour-alone. */}
|
||||||
<span className="mx-0.5 opacity-40">|</span>
|
<span className="mx-0.5 opacity-40">|</span>
|
||||||
<LegendDot colour={SEG_CW} label={t("bmp.legendCW")} />
|
<LegendDot colour={SEG_COLOR.cw} label={t("bmp.legendCW")} />
|
||||||
<LegendDot colour={SEG_DIGI} label={t("bmp.legendData")} />
|
<LegendDot colour={SEG_COLOR.digi} label={t("bmp.legendData")} />
|
||||||
<LegendDot colour={SEG_PHONE} label={t("bmp.legendPhone")} />
|
<LegendDot colour={SEG_COLOR.phone} label={t("bmp.legendPhone")} />
|
||||||
</div>
|
</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">
|
<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')}
|
{t('bmp.footerHint')}
|
||||||
|
|||||||
@@ -81,23 +81,44 @@ const STATUS_CLASSES: Record<string, string> = {
|
|||||||
// i18n keys the Appearance panel's colour pickers use, so the two can never
|
// i18n keys the Appearance panel's colour pickers use, so the two can never
|
||||||
// disagree about which green is which. swatch = the background class (or a
|
// disagree about which green is which. swatch = the background class (or a
|
||||||
// special ring marker for the current-entry cell).
|
// special ring marker for the current-entry cell).
|
||||||
const LEGEND: { swatch: string; ring?: boolean; label: string }[] = [
|
const LEGEND: { swatch: string; ring?: boolean; mark?: string; label: string }[] = [
|
||||||
{ swatch: 'bg-mx-call-conf', label: 'mx.callConf' },
|
{ swatch: 'bg-mx-call-conf', label: 'mx.callConf' },
|
||||||
{ swatch: 'bg-mx-call-work', label: 'mx.callWork' },
|
{ swatch: 'bg-mx-call-work', label: 'mx.callWork' },
|
||||||
{ swatch: 'bg-mx-dx-conf', label: 'mx.dxConf' },
|
{ swatch: 'bg-mx-dx-conf', label: 'mx.dxConf' },
|
||||||
{ swatch: 'bg-mx-dx-work', label: 'mx.dxWork' },
|
{ swatch: 'bg-mx-dx-work', label: 'mx.dxWork' },
|
||||||
{ swatch: 'bg-mx-none', label: 'mx.none' },
|
{ swatch: 'bg-mx-none', label: 'mx.none' },
|
||||||
{ swatch: 'bg-mx-none', ring: true, label: 'mx.current' },
|
{ swatch: 'bg-mx-none', ring: true, label: 'mx.current' },
|
||||||
|
{ swatch: 'bg-mx-none', mark: 'w', label: 'mx.markWork' },
|
||||||
|
{ swatch: 'bg-mx-none', mark: 'c', label: 'mx.markConf' },
|
||||||
];
|
];
|
||||||
|
|
||||||
function cellTitle(t: (k: string) => string, band: string, cls: string, status: string, current: boolean): string {
|
// CallMark — "this callsign has already been worked on this slot".
|
||||||
|
//
|
||||||
|
// Drawn the same way on every cell, whatever colour the entity status gave it:
|
||||||
|
// the operator learns one shape and reads it without first working out what the
|
||||||
|
// background means. Only the fill changes, and only with the callsign's own
|
||||||
|
// state (worked / confirmed) — never with the entity's. The ring is the theme
|
||||||
|
// background, which is what keeps the dot legible over all five cell colours.
|
||||||
|
function CallMark({ state = 'w' }: { state?: string }) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
'pointer-events-none absolute top-[4px] right-[4px] size-[5px] rounded-full ring-1 ring-background',
|
||||||
|
state === 'c' ? 'bg-mx-mark-conf' : 'bg-mx-mark-work',
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cellTitle(t: (k: string) => string, band: string, cls: string, status: string, current: boolean, call = ''): string {
|
||||||
const desc =
|
const desc =
|
||||||
status === 'call_c' ? t('mx.tipCallConf') :
|
status === 'call_c' ? t('mx.tipCallConf') :
|
||||||
status === 'call_w' ? t('mx.tipCallWork') :
|
status === 'call_w' ? t('mx.tipCallWork') :
|
||||||
status === 'dxcc_c' ? t('mx.tipDxConf') :
|
status === 'dxcc_c' ? t('mx.tipDxConf') :
|
||||||
status === 'dxcc_w' ? t('mx.tipDxWork') :
|
status === 'dxcc_w' ? t('mx.tipDxWork') :
|
||||||
t('mx.tipNone');
|
t('mx.tipNone');
|
||||||
return `${band} ${cls}: ${desc}${current ? ' — ' + t('mx.current') : ''}`;
|
const mine = call === 'c' ? t('mx.tipThisCallConf') : call === 'w' ? t('mx.tipThisCall') : '';
|
||||||
|
return `${band} ${cls}: ${desc}${mine ? ' — ' + mine : ''}${current ? ' — ' + t('mx.current') : ''}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCall = true, lat, lon, forCall, onEditQso }: Props) {
|
export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCall = true, lat, lon, forCall, onEditQso }: Props) {
|
||||||
@@ -126,6 +147,16 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
|||||||
return m;
|
return m;
|
||||||
}, [wb]);
|
}, [wb]);
|
||||||
|
|
||||||
|
// Worked-with-this-callsign, per cell — carried separately by the backend
|
||||||
|
// because collapsing it into the status is what hid it.
|
||||||
|
const callMap = useMemo(() => {
|
||||||
|
const m = new Map<string, string>();
|
||||||
|
for (const s of wb?.band_status ?? []) {
|
||||||
|
if ((s as any).call) m.set(`${s.band}|${s.class}`, (s as any).call);
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}, [wb]);
|
||||||
|
|
||||||
// "Newness" of the current band+mode entry, for the award/DX-chase badges.
|
// "Newness" of the current band+mode entry, for the award/DX-chase badges.
|
||||||
// Derived straight from the entity's real band_status (all bands it was
|
// Derived straight from the entity's real band_status (all bands it was
|
||||||
// worked on — not just the operator's configured column list).
|
// worked on — not just the operator's configured column list).
|
||||||
@@ -211,11 +242,11 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
|||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
className={cn(
|
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',
|
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 ? (
|
{newOne ? (
|
||||||
<>
|
<>
|
||||||
<Badge className="bg-warning text-warning-foreground gap-1 px-3 py-1 text-[11px]">
|
<Badge className="bg-warning text-warning-foreground gap-1 px-3 py-1 text-[11px]">
|
||||||
@@ -238,7 +269,7 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
|||||||
{forCall}
|
{forCall}
|
||||||
</Badge>
|
</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}`}
|
{dxccName || `DXCC #${dxcc}`}
|
||||||
</Badge>
|
</Badge>
|
||||||
{mwBadge}
|
{mwBadge}
|
||||||
@@ -308,21 +339,29 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
|||||||
</th>
|
</th>
|
||||||
{cols.map((b) => {
|
{cols.map((b) => {
|
||||||
const st = statusMap.get(`${b.tag}|${cls}`) ?? '';
|
const st = statusMap.get(`${b.tag}|${cls}`) ?? '';
|
||||||
|
// The same cell's other answer: worked with THIS callsign
|
||||||
|
// here. The status above is the entity's, and a confirmed
|
||||||
|
// entity outranks a worked call — so chasing a DXpedition,
|
||||||
|
// the cell could say "confirmed" about a contact made years
|
||||||
|
// ago and nothing about the one made this morning.
|
||||||
|
const mine = callMap.get(`${b.tag}|${cls}`) ?? '';
|
||||||
const isCurrent = hasCall && b.tag === currentBand && classCurrent;
|
const isCurrent = hasCall && b.tag === currentBand && classCurrent;
|
||||||
return (
|
return (
|
||||||
<td
|
<td
|
||||||
key={b.tag}
|
key={b.tag}
|
||||||
title={cellTitle(t, b.tag, cls, st, isCurrent) + (st ? ' — ' + t('mx.tipClick') : '')}
|
title={cellTitle(t, b.tag, cls, st, isCurrent, mine) + (st ? ' — ' + t('mx.tipClick') : '')}
|
||||||
onClick={st ? () => setSlot({ band: b.tag, cls }) : undefined}
|
onClick={st ? () => setSlot({ band: b.tag, cls }) : undefined}
|
||||||
className={cn(
|
className={cn(
|
||||||
'w-[28px] h-[24px] rounded transition-colors p-0',
|
'relative w-[28px] h-[24px] rounded transition-colors p-0',
|
||||||
st ? STATUS_CLASSES[st] : 'bg-mx-none',
|
st ? STATUS_CLASSES[st] : 'bg-mx-none',
|
||||||
// Only a filled cell has anything to show — an empty one
|
// Only a filled cell has anything to show — an empty one
|
||||||
// stays inert rather than opening a "no QSOs" dialog.
|
// stays inert rather than opening a "no QSOs" dialog.
|
||||||
st && 'cursor-pointer hover:brightness-110',
|
st && 'cursor-pointer hover:brightness-110',
|
||||||
isCurrent && 'ring-2 ring-mx-cur ring-inset',
|
isCurrent && 'ring-2 ring-mx-cur ring-inset',
|
||||||
)}
|
)}
|
||||||
/>
|
>
|
||||||
|
{mine ? <CallMark state={mine} /> : null}
|
||||||
|
</td>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</tr>
|
</tr>
|
||||||
@@ -337,11 +376,13 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
|||||||
<span key={l.label} className="flex items-center gap-1.5 text-[10px] text-muted-foreground">
|
<span key={l.label} className="flex items-center gap-1.5 text-[10px] text-muted-foreground">
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
'inline-block size-3 rounded shrink-0',
|
'relative inline-block size-3 rounded shrink-0',
|
||||||
l.swatch,
|
l.swatch,
|
||||||
l.ring && 'ring-2 ring-mx-cur ring-inset',
|
l.ring && 'ring-2 ring-mx-cur ring-inset',
|
||||||
)}
|
)}
|
||||||
/>
|
>
|
||||||
|
{l.mark ? <CallMark state={l.mark} /> : null}
|
||||||
|
</span>
|
||||||
{t(l.label)}
|
{t(l.label)}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ const FIELDS: FieldDef[] = [
|
|||||||
// No promoted column: written into extras_json (see qso.bulkEditableExtras).
|
// No promoted column: written into extras_json (see qso.bulkEditableExtras).
|
||||||
{ id: 'owner_callsign', label: 'bulk.fOwnerCallsign', group: 'My station', kind: 'text', upper: true },
|
{ 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_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_antenna', label: 'bulk.fMyAntenna', group: 'My station', kind: 'text' },
|
||||||
{ id: 'my_rig', label: 'bulk.fMyRig', 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' },
|
{ id: 'my_street', label: 'bulk.fMyStreet', group: 'My station', kind: 'text' },
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
// new is being decoded on FT8/FT4/JS8 near here — not that the band is dead.
|
// new is being decoded on FT8/FT4/JS8 near here — not that the band is dead.
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { Radar, Loader2, X } from 'lucide-react';
|
import { Radar, Loader2, X } from 'lucide-react';
|
||||||
|
import { formatDistance } from '@/lib/units';
|
||||||
import { useI18n } from '@/lib/i18n';
|
import { useI18n } from '@/lib/i18n';
|
||||||
import { markerColour } from '@/lib/spotMarkers';
|
import { markerColour } from '@/lib/spotMarkers';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
@@ -186,7 +187,7 @@ export function ChaseNewPanel({ onPick, onClose }: Props) {
|
|||||||
title={[
|
title={[
|
||||||
s.country,
|
s.country,
|
||||||
s.grid,
|
s.grid,
|
||||||
s.dist_km ? `${s.dist_km} km` : '',
|
s.dist_km ? formatDistance(s.dist_km) : '',
|
||||||
s.freq_hz ? `${(s.freq_hz / 1000).toFixed(1)} kHz` : '',
|
s.freq_hz ? `${(s.freq_hz / 1000).toFixed(1)} kHz` : '',
|
||||||
].filter(Boolean).join(' · ')}
|
].filter(Boolean).join(' · ')}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { Checkbox } from '@/components/ui/checkbox';
|
import { Checkbox } from '@/components/ui/checkbox';
|
||||||
import { cleanSpotter, inferSpotMode, spotStatusKey } from '@/lib/spot';
|
import { cleanSpotter, inferSpotMode, spotStatusKey } from '@/lib/spot';
|
||||||
import { markerColour } from '@/lib/spotMarkers';
|
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 { loadLocal, loadRemote, saveState, seedLocal, whenGridPrefsReady } from '@/lib/gridPrefs';
|
||||||
|
import { distanceUnit, distanceValue, subscribeDistanceUnit } from '@/lib/units';
|
||||||
import { useI18n } from '@/lib/i18n';
|
import { useI18n } from '@/lib/i18n';
|
||||||
|
|
||||||
type TFn = (key: string, vars?: Record<string, string | number>) => string;
|
type TFn = (key: string, vars?: Record<string, string | number>) => string;
|
||||||
@@ -45,6 +46,7 @@ export type ClusterSpot = {
|
|||||||
raw: string;
|
raw: string;
|
||||||
repeats?: number;
|
repeats?: number;
|
||||||
pota_ref?: string;
|
pota_ref?: string;
|
||||||
|
sota_ref?: string;
|
||||||
pota_name?: string;
|
pota_name?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -82,6 +84,11 @@ type Props = {
|
|||||||
// stray click while looking took the operator off the station they were
|
// stray click while looking took the operator off the station they were
|
||||||
// working. Looking and going are now two different gestures.
|
// working. Looking and going are now two different gestures.
|
||||||
onSpotSelect?: (s: ClusterSpot) => void;
|
onSpotSelect?: (s: ClusterSpot) => void;
|
||||||
|
// Anything the caller wants on the LEFT of the toolbar — the pane's title, its
|
||||||
|
// live count, its Filters button. Docked in a pane, the title used to sit on a
|
||||||
|
// row of its own above this one, so the cluster ate two lines of a short pane
|
||||||
|
// where Recent QSOs beside it ate one. Reported by VK4DX.
|
||||||
|
headerLeft?: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const COL_STATE_KEY = 'hamlog.clusterColState.v1';
|
const COL_STATE_KEY = 'hamlog.clusterColState.v1';
|
||||||
@@ -141,6 +148,12 @@ function statusFor(p: any): SpotStatusEntry | undefined {
|
|||||||
// filled pfx → new prefix filled POTA → new park filled county → new county
|
// filled pfx → new prefix filled POTA → new park filled county → new county
|
||||||
// blue call → already worked (not a novelty, so text only)
|
// blue call → already worked (not a novelty, so text only)
|
||||||
const NEW = 'var(--warning)'; // yellow: something here is new
|
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
|
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.
|
// FILLING the cell that carries the fact, rather than only tinting its text.
|
||||||
@@ -183,9 +196,10 @@ function statusColor(s: SpotStatusEntry | undefined): string | null {
|
|||||||
case 'new-band-mode':
|
case 'new-band-mode':
|
||||||
case 'new-band':
|
case 'new-band':
|
||||||
case 'new-mode':
|
case 'new-mode':
|
||||||
case 'new-slot':
|
|
||||||
case 'new-call':
|
case 'new-call':
|
||||||
return NEW;
|
return NEW;
|
||||||
|
case 'new-slot':
|
||||||
|
return NEWSLOT;
|
||||||
default:
|
default:
|
||||||
return s?.worked_call ? WKD : null;
|
return s?.worked_call ? WKD : null;
|
||||||
}
|
}
|
||||||
@@ -329,13 +343,26 @@ const makeColCatalog = (t: TFn): ColEntry[] => [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
group: 'Spot', label: t('clg2.c.pota'), colId: 'pota',
|
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,
|
defaultVisible: true,
|
||||||
cellStyle: (p: any) => (statusFor(p)?.new_pota
|
cellStyle: (p: any) => (statusFor(p)?.new_pota
|
||||||
? fillStyle(markerColour('new_pota'))
|
? fillStyle(markerColour('new_pota'))
|
||||||
: { color: 'var(--success)' }) as any,
|
: { color: 'var(--success)' }) as any,
|
||||||
tooltipValueGetter: (p: any) => (p.data?.pota_name ? t('clg2.tipPota', { name: p.data.pota_name }) : undefined),
|
tooltipValueGetter: (p: any) => (p.data?.pota_name ? t('clg2.tipPota', { name: p.data.pota_name }) : undefined),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// SOTA sits next to POTA and reads the same way. The reference comes from the
|
||||||
|
// spot's comment, so it is present on the SOTA feeds and empty elsewhere —
|
||||||
|
// 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'), width: 100, cellClass: 'font-mono',
|
||||||
|
valueGetter: (p: any) => (chaseSota() ? p.data?.sota_ref ?? '' : ''),
|
||||||
|
defaultVisible: false,
|
||||||
|
cellStyle: () => ({ color: 'var(--success)' }) as any,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
group: 'Spot', label: t('clg2.c.freq'), colId: 'freq',
|
group: 'Spot', label: t('clg2.c.freq'), colId: 'freq',
|
||||||
headerName: t('clg2.c.freq'), field: 'freq_khz' as any, width: 95, type: 'rightAligned', cellClass: 'font-mono',
|
headerName: t('clg2.c.freq'), field: 'freq_khz' as any, width: 95, type: 'rightAligned', cellClass: 'font-mono',
|
||||||
@@ -432,8 +459,13 @@ const makeColCatalog = (t: TFn): ColEntry[] => [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
group: 'Geo', label: t('clg2.c.distance_km'), colId: 'distance_km',
|
group: 'Geo', label: t('clg2.c.distance_km'), colId: 'distance_km',
|
||||||
headerName: t('clg2.h.distance_km'), field: 'distance_km' as any, width: 80, type: 'rightAligned', cellClass: 'font-mono',
|
// The header carries the unit, so the cells stay bare numbers and the
|
||||||
valueFormatter: (p) => p.value ? String(p.value) : '',
|
// column still sorts on the km the backend sent — converting the VALUE
|
||||||
|
// would sort miles as if they were kilometres either way, but it would
|
||||||
|
// also round twice.
|
||||||
|
headerName: t('clg2.h.distance_km') + ' (' + distanceUnit() + ')',
|
||||||
|
field: 'distance_km' as any, width: 90, type: 'rightAligned', cellClass: 'font-mono',
|
||||||
|
valueFormatter: (p) => p.value ? String(distanceValue(p.value)) : '',
|
||||||
comparator: (a, b) => (a ?? 0) - (b ?? 0),
|
comparator: (a, b) => (a ?? 0) - (b ?? 0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -506,13 +538,15 @@ const GROUP_ORDER = ['Spot', 'Geo'];
|
|||||||
const CLG_GRP_KEYS: Record<string, string> = { Spot: 'clg2.grpSpot', Geo: 'clg2.grpGeo' };
|
const CLG_GRP_KEYS: Record<string, string> = { Spot: 'clg2.grpSpot', Geo: 'clg2.grpGeo' };
|
||||||
const groupLabel = (t: TFn, g: string): string => t(CLG_GRP_KEYS[g] ?? g);
|
const groupLabel = (t: TFn, g: string): string => t(CLG_GRP_KEYS[g] ?? g);
|
||||||
|
|
||||||
export function ClusterGrid({ rows, spotStatus, onSpotClick, onSpotSelect }: Props) {
|
export function ClusterGrid({ rows, spotStatus, onSpotClick, onSpotSelect, headerLeft }: Props) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const gridRef = useRef<any>(null);
|
const gridRef = useRef<any>(null);
|
||||||
const [pickerOpen, setPickerOpen] = useState(false);
|
const [pickerOpen, setPickerOpen] = useState(false);
|
||||||
|
|
||||||
// Localized column catalog — rebuilt when the language changes.
|
// Localized column catalog — rebuilt when the language changes.
|
||||||
const COL_CATALOG = useMemo(() => makeColCatalog(t), [t]);
|
const [distUnit, setDistUnit] = useState(distanceUnit);
|
||||||
|
useEffect(() => subscribeDistanceUnit(() => setDistUnit(distanceUnit())), []);
|
||||||
|
const COL_CATALOG = useMemo(() => makeColCatalog(t), [t, distUnit]);
|
||||||
|
|
||||||
// A rebuild makes AG Grid re-apply every colDef hide/width DEFAULT and fire the
|
// A rebuild makes AG Grid re-apply every colDef hide/width DEFAULT and fire the
|
||||||
// matching column events. Without this guard those events were persisted, so a
|
// matching column events. Without this guard those events were persisted, so a
|
||||||
@@ -603,16 +637,27 @@ export function ClusterGrid({ rows, spotStatus, onSpotClick, onSpotSelect }: Pro
|
|||||||
const [held, setHeld] = useState<ClusterSpot[] | null>(null);
|
const [held, setHeld] = useState<ClusterSpot[] | null>(null);
|
||||||
const shown = held ?? rows;
|
const shown = held ?? rows;
|
||||||
|
|
||||||
// How many arrived since the freeze. Counted by finding the frozen top row in
|
// How many arrived since the freeze — counted by TIME, not by finding the
|
||||||
// the live list rather than by comparing lengths: the list is a ring buffer,
|
// frozen top row again.
|
||||||
// so once it is full the length stops growing and a length comparison would
|
//
|
||||||
// report nothing new for the rest of the evening.
|
// Looking for that row was wrong in the ordinary case: a station spotted again
|
||||||
const spotID = (r: ClusterSpot) => `${(r as any).received_at}-${r.dx_call}-${(r as any).source_id}`;
|
// REPLACES its row (that is the de-dupe), so the row we froze on disappears
|
||||||
|
// from the live list the moment somebody re-spots it — and the count fell
|
||||||
|
// through to "everything is new", jumping from 4 to the buffer cap. Reported
|
||||||
|
// as "it shows 4, 5 new spots and then 500 all at once".
|
||||||
|
//
|
||||||
|
// A timestamp survives both the replacement and the ring buffer, which was the
|
||||||
|
// reason the length was not used either.
|
||||||
|
const spotTime = (r: ClusterSpot) => Date.parse(String((r as any).received_at ?? '')) || 0;
|
||||||
const waiting = useMemo(() => {
|
const waiting = useMemo(() => {
|
||||||
if (!held || held.length === 0) return 0;
|
if (!held || held.length === 0) return 0;
|
||||||
const top = spotID(held[0]);
|
const since = spotTime(held[0]);
|
||||||
const i = rows.findIndex((r) => spotID(r) === top);
|
if (!since) return 0; // no usable timestamp — say nothing rather than a number
|
||||||
return i < 0 ? rows.length : i; // fell out of the buffer: everything is new
|
let n = 0;
|
||||||
|
for (const r of rows) {
|
||||||
|
if (spotTime(r) > since) n++;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
}, [held, rows]);
|
}, [held, rows]);
|
||||||
|
|
||||||
const onBodyScroll = (e: { top: number }) => {
|
const onBodyScroll = (e: { top: number }) => {
|
||||||
@@ -670,7 +715,9 @@ export function ClusterGrid({ rows, spotStatus, onSpotClick, onSpotSelect }: Pro
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-center justify-end gap-2 px-2.5 py-1 border-b border-border/60 bg-muted/20">
|
<div className="flex items-center gap-2 px-2.5 py-1 border-b border-border/60 bg-muted/20">
|
||||||
|
{headerLeft}
|
||||||
|
<div className="flex-1" />
|
||||||
<Button variant="ghost" size="sm" className="h-7 text-[11px]" onClick={() => gridRef.current?.api?.setFilterModel(null)}
|
<Button variant="ghost" size="sm" className="h-7 text-[11px]" onClick={() => gridRef.current?.api?.setFilterModel(null)}
|
||||||
title={t('clg2.clearFiltersTitle')}>
|
title={t('clg2.clearFiltersTitle')}>
|
||||||
<FilterX className="size-3.5" /> {t('clg2.clearFilters')}
|
<FilterX className="size-3.5" /> {t('clg2.clearFilters')}
|
||||||
|
|||||||
@@ -4,17 +4,18 @@ import {
|
|||||||
GetKenwoodState, RefreshKenwood, SetKenwoodPower, SetKenwoodAFGain, SetKenwoodTX, TuneKenwoodATU,
|
GetKenwoodState, RefreshKenwood, SetKenwoodPower, SetKenwoodAFGain, SetKenwoodTX, TuneKenwoodATU,
|
||||||
SetKenwoodRFGain, SetKenwoodMicGain, SetKenwoodSquelch, SetKenwoodPreamp, SetKenwoodAtt,
|
SetKenwoodRFGain, SetKenwoodMicGain, SetKenwoodSquelch, SetKenwoodPreamp, SetKenwoodAtt,
|
||||||
SetKenwoodNB, SetKenwoodNR, SetKenwoodAGC, SetKenwoodFilter, SetKenwoodAntenna,
|
SetKenwoodNB, SetKenwoodNR, SetKenwoodAGC, SetKenwoodFilter, SetKenwoodAntenna,
|
||||||
SetKenwoodRIT, SetKenwoodXIT, ClearKenwoodRIT, SetKenwoodKeySpeed, ToggleKenwoodATU, NudgeKenwoodRIT,
|
SetKenwoodRIT, SetKenwoodXIT, ClearKenwoodRIT, SetKenwoodKeySpeed, ToggleKenwoodATU, SetKenwoodRITOffset, SetKenwoodPanelMode,
|
||||||
GetCATState,
|
GetCATState,
|
||||||
} from '../../wailsjs/go/main/App';
|
} from '../../wailsjs/go/main/App';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { useI18n } from '@/lib/i18n';
|
import { useI18n } from '@/lib/i18n';
|
||||||
import { sMeterRST } from '@/lib/rst';
|
import { sMeterRST } from '@/lib/rst';
|
||||||
|
import { ShiftRow } from '@/components/ShiftRow';
|
||||||
import { MeterBar } from '@/components/MeterBar';
|
import { MeterBar } from '@/components/MeterBar';
|
||||||
import { WheelRange } from '@/components/WheelRange';
|
import { WheelRange } from '@/components/WheelRange';
|
||||||
|
|
||||||
type KenwoodState = {
|
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;
|
transmitting: boolean; split: boolean; split_tx_hz?: number;
|
||||||
s_meter: number; s_meter_raw: number;
|
s_meter: number; s_meter_raw: number;
|
||||||
power_meter: number; swr: number; swr_raw: number;
|
power_meter: number; swr: number; swr_raw: number;
|
||||||
@@ -89,9 +90,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 }) {
|
export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) => void }) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const [st, setSt] = useState<KenwoodState>(ZERO);
|
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 [freqHz, setFreqHz] = useState(0);
|
||||||
const [err, setErr] = useState('');
|
const [err, setErr] = useState('');
|
||||||
// Optimistic overlay: a slider must follow the finger, not the poll. Dropped
|
// Optimistic overlay: a slider must follow the finger, not the poll. Dropped
|
||||||
@@ -149,6 +175,28 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
|||||||
{freqHz > 0 ? (freqHz / 1e6).toFixed(6) : '—'}
|
{freqHz > 0 ? (freqHz / 1e6).toFixed(6) : '—'}
|
||||||
</div>
|
</div>
|
||||||
</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"
|
<button type="button" className="text-[11px] text-muted-foreground hover:text-foreground flex items-center gap-1"
|
||||||
onClick={() => RefreshKenwood().catch(() => {})} title={t('k3.refreshHint')}>
|
onClick={() => RefreshKenwood().catch(() => {})} title={t('k3.refreshHint')}>
|
||||||
<SlidersHorizontal className="size-3.5" />
|
<SlidersHorizontal className="size-3.5" />
|
||||||
@@ -216,7 +264,7 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
|||||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-6 gap-y-2">
|
<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">
|
<label className="flex items-center gap-2 text-xs">
|
||||||
<span className="w-16 shrink-0 text-muted-foreground">{t('k3.power')}</span>
|
<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}
|
value={view.rf_power ?? 0}
|
||||||
onChange={(n) => put({ rf_power: n }, () => SetKenwoodPower(n))} />
|
onChange={(n) => put({ rf_power: n }, () => SetKenwoodPower(n))} />
|
||||||
<span className="w-12 text-right font-mono tabular-nums">{view.rf_power ?? 0} W</span>
|
<span className="w-12 text-right font-mono tabular-nums">{view.rf_power ?? 0} W</span>
|
||||||
@@ -279,21 +327,18 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* RIT / XIT. Clear zeroes both offsets at once — the radio's own RC,
|
{/* RIT / XIT — the shared ShiftRow, exactly as the Icom and TCI consoles
|
||||||
and what an operator means by "clear it". */}
|
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">
|
<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
|
{/* Antenna only when the radio answered AN — a K3 without the internal
|
||||||
ATU has one socket and no switch to offer. */}
|
ATU has one socket and no switch to offer. */}
|
||||||
{view.antenna > 0 && (<>
|
{view.antenna > 0 && (<>
|
||||||
|
|||||||
@@ -292,6 +292,9 @@ function ScopePanadapter() {
|
|||||||
const wfRef = useRef<HTMLCanvasElement>(null); // waterfall
|
const wfRef = useRef<HTMLCanvasElement>(null); // waterfall
|
||||||
const peakRef = useRef(160); // running amplitude ceiling for auto-scale
|
const peakRef = useRef(160); // running amplitude ceiling for auto-scale
|
||||||
const holdRef = useRef<number[]>([]); // per-bin peak-hold line
|
const holdRef = useRef<number[]>([]); // per-bin peak-hold line
|
||||||
|
// Some radios control their scope over CI-V but never stream it (IC-7851).
|
||||||
|
// Saying so beats a black rectangle, which reads as a bug in OpsLog.
|
||||||
|
const [unsupported, setUnsupported] = useState(false);
|
||||||
const spanRef = useRef({ low: 0, high: 0 }); // latest sweep edges, for click-to-tune
|
const spanRef = useRef({ low: 0, high: 0 }); // latest sweep edges, for click-to-tune
|
||||||
const vfoRef = useRef(0); // latest VFO frequency, for wheel-tune
|
const vfoRef = useRef(0); // latest VFO frequency, for wheel-tune
|
||||||
const centerRef = useRef(0); // scope centre we last set (for pan ◀/▶)
|
const centerRef = useRef(0); // scope centre we last set (for pan ◀/▶)
|
||||||
@@ -333,6 +336,7 @@ function ScopePanadapter() {
|
|||||||
if (!alive) return;
|
if (!alive) return;
|
||||||
try {
|
try {
|
||||||
const sw = await IcomScopeData();
|
const sw = await IcomScopeData();
|
||||||
|
if (sw?.unsupported) setUnsupported(true);
|
||||||
if (sw && sw.seq !== lastSeq && sw.amp && sw.amp.length) {
|
if (sw && sw.seq !== lastSeq && sw.amp && sw.amp.length) {
|
||||||
lastSeq = sw.seq;
|
lastSeq = sw.seq;
|
||||||
setFixed(sw.fixed);
|
setFixed(sw.fixed);
|
||||||
@@ -543,7 +547,10 @@ function ScopePanadapter() {
|
|||||||
<Chip label={on ? 'ON' : 'OFF'} on={on} onClick={toggle} />
|
<Chip label={on ? 'ON' : 'OFF'} on={on} onClick={toggle} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{on && (
|
{on && unsupported && (
|
||||||
|
<div className="px-3 py-2 text-xs text-muted-foreground">{t('icmp.scopeNoStream')}</div>
|
||||||
|
)}
|
||||||
|
{on && !unsupported && (
|
||||||
<div className="p-3">
|
<div className="p-3">
|
||||||
<div className="rounded-xl overflow-hidden ring-1 ring-info/20 shadow-lg shadow-sky-500/5 bg-[#05070e]">
|
<div className="rounded-xl overflow-hidden ring-1 ring-info/20 shadow-lg shadow-sky-500/5 bg-[#05070e]">
|
||||||
<canvas ref={canvasRef} onDoubleClick={onDblClick}
|
<canvas ref={canvasRef} onDoubleClick={onDblClick}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'leaflet/dist/leaflet.css';
|
|||||||
import { nightPolygon } from '../lib/greyline';
|
import { nightPolygon } from '../lib/greyline';
|
||||||
import { gridToLatLon, gridSquareBounds, greatCirclePoints, pathBetween, destinationPoint } from '@/lib/maidenhead';
|
import { gridToLatLon, gridSquareBounds, greatCirclePoints, pathBetween, destinationPoint } from '@/lib/maidenhead';
|
||||||
import { writeUiPref } from '@/lib/uiPref';
|
import { writeUiPref } from '@/lib/uiPref';
|
||||||
|
import { formatDistance } from '@/lib/units';
|
||||||
|
|
||||||
// Persisted free-pan view of the world map (when auto-zoom is off).
|
// Persisted free-pan view of the world map (when auto-zoom is off).
|
||||||
function loadMapView(): { lat: number; lon: number; zoom: number } | null {
|
function loadMapView(): { lat: number; lon: number; zoom: number } | null {
|
||||||
@@ -446,8 +447,8 @@ export function WorldMap({ fromGrid, toGrid, fromLabel, toLabel, beamAzimuths, b
|
|||||||
</button>
|
</button>
|
||||||
{path && (
|
{path && (
|
||||||
<div className="absolute bottom-1 left-1 z-[500] rounded-md bg-card/90 backdrop-blur px-2 py-1 text-[11px] font-mono shadow border border-border pointer-events-none">
|
<div className="absolute bottom-1 left-1 z-[500] rounded-md bg-card/90 backdrop-blur px-2 py-1 text-[11px] font-mono shadow border border-border pointer-events-none">
|
||||||
<div><span className="text-muted-foreground">Dist</span> {Math.round(path.distanceShort).toLocaleString()} km
|
<div><span className="text-muted-foreground">Dist</span> {formatDistance(path.distanceShort)}
|
||||||
<span className="text-muted-foreground"> · LP</span> {Math.round(path.distanceLong).toLocaleString()} km</div>
|
<span className="text-muted-foreground"> · LP</span> {formatDistance(path.distanceLong)}</div>
|
||||||
<div><span className="text-muted-foreground">Az SP</span> {Math.round(path.bearingShort)}°
|
<div><span className="text-muted-foreground">Az SP</span> {Math.round(path.bearingShort)}°
|
||||||
<span className="text-muted-foreground"> · LP</span> {Math.round(path.bearingLong)}°</div>
|
<span className="text-muted-foreground"> · LP</span> {Math.round(path.bearingLong)}°</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
Select, SelectTrigger, SelectValue, SelectContent, SelectItem,
|
Select, SelectTrigger, SelectValue, SelectContent, SelectItem,
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { FindQSOsForUpload, UploadQSOsManual, DownloadConfirmations, CancelConfirmations, ImportHamlogConfirmations, ExportHamlogUnmatched, OpenADIFFile, SaveADIFFile, SyncPOTAHunterLog, ListQSO, BulkUpdateQSL, UploadCallsign, GetSlotStats } from '../../wailsjs/go/main/App';
|
import { GetLoTWQSLDetail, SetLoTWQSLDetail, GetLoTWDownloadAllCalls, SetLoTWDownloadAllCalls, OpenExternalURL, FindQSOsForUpload, UploadQSOsManual, DownloadConfirmations, CancelConfirmations, ImportHamlogConfirmations, ExportHamlogUnmatched, OpenADIFFile, SaveADIFFile, SyncPOTAHunterLog, ListQSO, BulkUpdateQSL, UploadCallsign, GetSlotStats } from '../../wailsjs/go/main/App';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { RecentQSOsGrid } from '@/components/RecentQSOsGrid';
|
import { RecentQSOsGrid } from '@/components/RecentQSOsGrid';
|
||||||
import { EventsOn } from '../../wailsjs/runtime/runtime';
|
import { EventsOn } from '../../wailsjs/runtime/runtime';
|
||||||
@@ -31,7 +31,7 @@ const UPLOAD_COLS: ColDef<UploadRow>[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
type Confirmation = {
|
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;
|
new_dxcc: boolean; new_band: boolean; new_mode: boolean; new_slot: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -255,6 +255,15 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
|
|||||||
const [searching, setSearching] = useState(false);
|
const [searching, setSearching] = useState(false);
|
||||||
const [error, setError] = useState('');
|
const [error, setError] = useState('');
|
||||||
const [addNotFound, setAddNotFound] = useState(false);
|
const [addNotFound, setAddNotFound] = useState(false);
|
||||||
|
// LoTW only: pull the whole account rather than this profile's callsign.
|
||||||
|
const [lotwAllCalls, setLotwAllCalls] = useState(false);
|
||||||
|
// LoTW only: ask for the QSL dates and station details. Ten times slower to
|
||||||
|
// build, so it is a choice rather than the default it used to be.
|
||||||
|
const [lotwDetail, setLotwDetail] = useState(false);
|
||||||
|
useEffect(() => {
|
||||||
|
GetLoTWDownloadAllCalls().then((v: boolean) => setLotwAllCalls(!!v)).catch(() => {});
|
||||||
|
GetLoTWQSLDetail().then((v: boolean) => setLotwDetail(!!v)).catch(() => {});
|
||||||
|
}, []);
|
||||||
// Download date window: 'last' = incremental since last pull, 'date' = from a
|
// Download date window: 'last' = incremental since last pull, 'date' = from a
|
||||||
// chosen date, 'all' = everything.
|
// chosen date, 'all' = everything.
|
||||||
const [sinceMode, setSinceMode] = useState<'last' | 'date' | 'all'>('last');
|
const [sinceMode, setSinceMode] = useState<'last' | 'date' | 'all'>('last');
|
||||||
@@ -434,6 +443,18 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
|
|||||||
{paperBusy ? <Loader2 className="size-3.5 animate-spin" /> : <Search className="size-3.5" />}
|
{paperBusy ? <Loader2 className="size-3.5 animate-spin" /> : <Search className="size-3.5" />}
|
||||||
{t('qslm.search')}
|
{t('qslm.search')}
|
||||||
</Button>
|
</Button>
|
||||||
|
{/* The station's QRZ page, one click away: writing a card means
|
||||||
|
reading the address, the manager and whether they even want
|
||||||
|
paper, and all three are on that page. */}
|
||||||
|
<Button size="sm" variant="outline" className="h-8" disabled={!paperCall.trim()}
|
||||||
|
title={t('qslm.qrzTitle')}
|
||||||
|
onClick={() => {
|
||||||
|
const c = paperCall.trim().toUpperCase();
|
||||||
|
if (c) OpenExternalURL(`https://www.qrz.com/db/${c}`).catch(() => {});
|
||||||
|
}}>
|
||||||
|
<ExternalLink className="size-3.5" />
|
||||||
|
QRZ
|
||||||
|
</Button>
|
||||||
<span className="text-[11px] text-muted-foreground self-center">{t('qslm.paperHint')}</span>
|
<span className="text-[11px] text-muted-foreground self-center">{t('qslm.paperHint')}</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@@ -598,6 +619,10 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
|
|||||||
<thead className="sticky top-0 bg-card">
|
<thead className="sticky top-0 bg-card">
|
||||||
<tr className="text-left text-muted-foreground border-b border-border">
|
<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>
|
<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.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>
|
<th className="py-1.5 px-2">{t('qslm.thCountry')}</th><th className="py-1.5 px-2">{t('qslm.thNew')}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -607,6 +632,9 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
|
|||||||
<tr key={i} className="border-b border-border/40">
|
<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">{fmtDate(c.qso_date)}</td>
|
||||||
<td className="py-1 px-2 font-mono font-bold">{c.callsign}</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.band}</td>
|
||||||
<td className="py-1 px-2">{c.mode}</td>
|
<td className="py-1 px-2">{c.mode}</td>
|
||||||
<td className="py-1 px-2 text-muted-foreground">{c.country}</td>
|
<td className="py-1 px-2 text-muted-foreground">{c.country}</td>
|
||||||
@@ -736,6 +764,19 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
|
|||||||
<Checkbox checked={addNotFound} onCheckedChange={(c) => setAddNotFound(!!c)} />
|
<Checkbox checked={addNotFound} onCheckedChange={(c) => setAddNotFound(!!c)} />
|
||||||
{t('qslm.addNotFound')}
|
{t('qslm.addNotFound')}
|
||||||
</label>
|
</label>
|
||||||
|
{service === 'lotw' && (
|
||||||
|
<label className="flex items-center gap-1.5 text-[11px] text-muted-foreground cursor-pointer" title={t('qslm.lotwDetailTitle')}>
|
||||||
|
<Checkbox checked={lotwDetail || addNotFound} disabled={addNotFound}
|
||||||
|
onCheckedChange={(c) => { setLotwDetail(!!c); SetLoTWQSLDetail(!!c); }} />
|
||||||
|
{t('qslm.lotwDetail')}
|
||||||
|
</label>
|
||||||
|
)}
|
||||||
|
{service === 'lotw' && (
|
||||||
|
<label className="flex items-center gap-1.5 text-[11px] text-muted-foreground cursor-pointer" title={t('qslm.lotwAllCallsTitle')}>
|
||||||
|
<Checkbox checked={lotwAllCalls} onCheckedChange={(c) => { setLotwAllCalls(!!c); SetLoTWDownloadAllCalls(!!c); }} />
|
||||||
|
{t('qslm.lotwAllCalls')}
|
||||||
|
</label>
|
||||||
|
)}
|
||||||
</>)}
|
</>)}
|
||||||
</div>
|
</div>
|
||||||
<Button size="sm" onClick={upload} disabled={selectedCount === 0 || busy}>
|
<Button size="sm" onClick={upload} disabled={selectedCount === 0 || busy}>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { formatDateTimeUTC, formatDateOnly, getDateFormat, subscribeDateFormat }
|
|||||||
import { AgGridReact } from 'ag-grid-react';
|
import { AgGridReact } from 'ag-grid-react';
|
||||||
import { Columns3, FilterX, ListChecks } from 'lucide-react';
|
import { Columns3, FilterX, ListChecks } from 'lucide-react';
|
||||||
import type { QSOForm } from '@/types';
|
import type { QSOForm } from '@/types';
|
||||||
|
import { distanceUnit, distanceValue, subscribeDistanceUnit } from '@/lib/units';
|
||||||
import { QSOContextMenu, type QSOMenuState } from './QSOContextMenu';
|
import { QSOContextMenu, type QSOMenuState } from './QSOContextMenu';
|
||||||
import {
|
import {
|
||||||
Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogDescription,
|
Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogDescription,
|
||||||
@@ -177,8 +178,9 @@ export const makeColCatalog = (t: TFn, myGrid?: string): ColEntry[] => [
|
|||||||
{ group: 'Contacted', label: t('rqg.c.lon'), colId: 'lon', headerName: t('rqg.c.lon'), field: 'lon' as any, width: 90, type: 'rightAligned', cellClass: 'font-mono' },
|
{ group: 'Contacted', label: t('rqg.c.lon'), colId: 'lon', headerName: t('rqg.c.lon'), field: 'lon' as any, width: 90, type: 'rightAligned', cellClass: 'font-mono' },
|
||||||
// Derived, not stored: computed from the two locations at display time, like
|
// Derived, not stored: computed from the two locations at display time, like
|
||||||
// the cluster grid's own distance column.
|
// the cluster grid's own distance column.
|
||||||
{ group: 'Contacted', label: t('rqg.c.distance_km'), colId: 'distance_km', headerName: t('rqg.h.distance_km'), width: 90, type: 'rightAligned', cellClass: 'font-mono',
|
{ group: 'Contacted', label: t('rqg.c.distance_km'), colId: 'distance_km',
|
||||||
valueGetter: (p) => qsoDistanceKm(p.data, myGrid),
|
headerName: t('rqg.h.distance_km') + ' (' + distanceUnit() + ')', width: 95, type: 'rightAligned', cellClass: 'font-mono',
|
||||||
|
valueGetter: (p) => { const km = qsoDistanceKm(p.data, myGrid); return km ? distanceValue(km) : km; },
|
||||||
comparator: (a, b) => (a ?? 0) - (b ?? 0), defaultVisible: true },
|
comparator: (a, b) => (a ?? 0) - (b ?? 0), defaultVisible: true },
|
||||||
{ group: 'Contacted', label: t('rqg.c.email'), colId: 'email', headerName: t('rqg.c.email'), field: 'email' as any, width: 180 },
|
{ group: 'Contacted', label: t('rqg.c.email'), colId: 'email', headerName: t('rqg.c.email'), field: 'email' as any, width: 180 },
|
||||||
{ group: 'Contacted', label: t('rqg.c.web'), colId: 'web', headerName: t('rqg.c.web'), field: 'web' as any, width: 180 },
|
{ group: 'Contacted', label: t('rqg.c.web'), colId: 'web', headerName: t('rqg.c.web'), field: 'web' as any, width: 180 },
|
||||||
@@ -335,7 +337,9 @@ export function RecentQSOsGrid({ rows, myGrid, selectAllSignal, selectRowSignal,
|
|||||||
// inside the column definitions, so nothing else would notice.
|
// inside the column definitions, so nothing else would notice.
|
||||||
const [dateFmt, setDateFmt] = useState(getDateFormat);
|
const [dateFmt, setDateFmt] = useState(getDateFormat);
|
||||||
useEffect(() => subscribeDateFormat(() => setDateFmt(getDateFormat())), []);
|
useEffect(() => subscribeDateFormat(() => setDateFmt(getDateFormat())), []);
|
||||||
const COL_CATALOG = useMemo(() => makeColCatalog(t, myGrid), [t, myGrid, dateFmt]);
|
const [distUnit, setDistUnit] = useState(distanceUnit);
|
||||||
|
useEffect(() => subscribeDistanceUnit(() => setDistUnit(distanceUnit())), []);
|
||||||
|
const COL_CATALOG = useMemo(() => makeColCatalog(t, myGrid), [t, myGrid, dateFmt, distUnit]);
|
||||||
|
|
||||||
// Right-click: if the clicked row isn't already part of the selection,
|
// Right-click: if the clicked row isn't already part of the selection,
|
||||||
// select just it; then open the bulk-action menu on the whole selection.
|
// select just it; then open the bulk-action menu on the whole selection.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
GetLookupSettings, SaveLookupSettings, ClearLookupCache, TestLookupProvider,
|
GetLookupSettings, SaveLookupSettings, ClearLookupCache, TestLookupProvider,
|
||||||
GetListsSettings, SaveListsSettings,
|
GetListsSettings, SaveListsSettings,
|
||||||
GetCATSettings, SaveCATSettings, DiscoverFlexRadios,
|
GetCATSettings, SaveCATSettings, GetRadios, SaveRadios, SetActiveRadio, DiscoverFlexRadios,
|
||||||
ListProfiles, GetActiveProfile, SaveProfile, DeleteProfile, ActivateProfile, DuplicateProfile,
|
ListProfiles, GetActiveProfile, SaveProfile, DeleteProfile, ActivateProfile, DuplicateProfile,
|
||||||
GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop,
|
GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop,
|
||||||
GetRotorPresets, SaveRotorPresets, ResetRotorPresets,
|
GetRotorPresets, SaveRotorPresets, ResetRotorPresets,
|
||||||
@@ -80,6 +80,8 @@ import {
|
|||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { writeUiPref } from '@/lib/uiPref';
|
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 { getDateFormat, setDateFormat, type DateFormat } from '@/lib/dateFormat';
|
||||||
import { useI18n, FlagGB, FlagFR, type Lang } from '@/lib/i18n';
|
import { useI18n, FlagGB, FlagFR, type Lang } from '@/lib/i18n';
|
||||||
import { useTheme, CONCRETE_THEMES, type ThemeChoice } from '@/lib/theme';
|
import { useTheme, CONCRETE_THEMES, type ThemeChoice } from '@/lib/theme';
|
||||||
@@ -688,8 +690,7 @@ function TelemetryToggle() {
|
|||||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||||
<Checkbox checked={on} disabled={!loaded}
|
<Checkbox checked={on} disabled={!loaded}
|
||||||
onCheckedChange={(c) => { const v = !!c; setOn(v); SetTelemetryEnabled(v).catch(() => {}); }} />
|
onCheckedChange={(c) => { const v = !!c; setOn(v); SetTelemetryEnabled(v).catch(() => {}); }} />
|
||||||
{t('settings.telemetry')}
|
<span title={t('settings.telemetryHint')}>{t('settings.telemetry')}</span>
|
||||||
<span className="text-xs text-muted-foreground">({t('settings.telemetryHint')})</span>
|
|
||||||
</label>
|
</label>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1086,7 @@ function RelayAutoPanel() {
|
|||||||
// panes. The first two are the view; the third and fourth can be left empty, and
|
// 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
|
// 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.
|
// 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';
|
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 }) {
|
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();
|
const { t } = useI18n();
|
||||||
@@ -1596,6 +1597,11 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
// exotic or experimental bands not listed).
|
// exotic or experimental bands not listed).
|
||||||
const [bandDraft, setBandDraft] = useState('');
|
const [bandDraft, setBandDraft] = useState('');
|
||||||
const [modeDraft, setModeDraft] = useState('');
|
const [modeDraft, setModeDraft] = useState('');
|
||||||
|
// The saved radios. The CAT panel edits ONE of them — whichever is on the air
|
||||||
|
// — and the list is what makes switching possible without touching profiles.
|
||||||
|
const [radios, setRadios] = useState<any[]>([]);
|
||||||
|
const [activeRadio, setActiveRadioId] = useState('');
|
||||||
|
const [radioBusy, setRadioBusy] = useState(false);
|
||||||
const [catCfg, setCatCfg] = useState<CATSettings>({
|
const [catCfg, setCatCfg] = useState<CATSettings>({
|
||||||
enabled: false, backend: 'omnirig', omnirig_rig: 1, omnirig_vfo: '', flex_host: '', flex_port: 4992, flex_spots: false, flex_decode_spots: false, flex_decode_secs: 120, flex_dvk_dax: false,
|
enabled: false, backend: 'omnirig', omnirig_rig: 1, omnirig_vfo: '', flex_host: '', flex_port: 4992, flex_spots: false, flex_decode_spots: false, flex_decode_secs: 120, flex_dvk_dax: false,
|
||||||
yaesu_port: '', yaesu_baud: 38400, yaesu_low_lines: false, kenwood_low_lines: false, kenwood_port: '', kenwood_baud: 9600, kenwood_host: '', kenwood_link: 'usb', kenwood_data_mode: 'usb', xiegu_port: '', xiegu_baud: 19200, xiegu_addr: 0x70, xiegu_ptt_line: '',
|
yaesu_port: '', yaesu_baud: 38400, yaesu_low_lines: false, kenwood_low_lines: false, kenwood_port: '', kenwood_baud: 9600, kenwood_host: '', kenwood_link: 'usb', kenwood_data_mode: 'usb', xiegu_port: '', xiegu_baud: 19200, xiegu_addr: 0x70, xiegu_ptt_line: '',
|
||||||
@@ -1742,6 +1748,8 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
const [startEqEnd, setStartEqEnd] = useState(() => localStorage.getItem('opslog.startEqualsEnd') === '1');
|
const [startEqEnd, setStartEqEnd] = useState(() => localStorage.getItem('opslog.startEqualsEnd') === '1');
|
||||||
const [lookupOnBlur, setLookupOnBlur] = useState(() => localStorage.getItem('opslog.lookupOnBlur') === '1');
|
const [lookupOnBlur, setLookupOnBlur] = useState(() => localStorage.getItem('opslog.lookupOnBlur') === '1');
|
||||||
const [groupDigital, setGroupDigital] = useState(() => localStorage.getItem('opslog.groupDigitalSlots') === '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');
|
const [clusterWorkedSameSlot, setClusterWorkedSameSlot] = useState(() => localStorage.getItem('opslog.clusterWorkedSameSlot') === '1');
|
||||||
// Declared HERE and not in ClusterPanel: that renderer is called as a plain
|
// Declared HERE and not in ClusterPanel: that renderer is called as a plain
|
||||||
// function by the PANELS map, so it must stay hooks-free.
|
// function by the PANELS map, so it must stay hooks-free.
|
||||||
@@ -2060,6 +2068,8 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
try { await SaveGridScopeSettings(next); } catch { /* the panel keeps the choice either way */ }
|
try { await SaveGridScopeSettings(next); } catch { /* the panel keeps the choice either way */ }
|
||||||
};
|
};
|
||||||
const [chaseGrids, setChaseGrids] = useState(false);
|
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 [chaseNew, setChaseNew] = useState(false);
|
||||||
const [spotTTL, setSpotTTL] = useState(0);
|
const [spotTTL, setSpotTTL] = useState(0);
|
||||||
const [spotTTLText, setSpotTTLText] = useState('0');
|
const [spotTTLText, setSpotTTLText] = useState('0');
|
||||||
@@ -2192,6 +2202,12 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
// on a normal open and Save then wrote an empty list over the operator's
|
// on a normal open and Save then wrote an empty list over the operator's
|
||||||
// buttons. See rotorPresetsLoaded for the belt to this brace.
|
// buttons. See rotorPresetsLoaded for the belt to this brace.
|
||||||
try { setRotorPresets((((await GetRotorPresets()) ?? []) as any)); setRotorPresetsLoaded(true); } catch {}
|
try { setRotorPresets((((await GetRotorPresets()) ?? []) as any)); setRotorPresetsLoaded(true); } catch {}
|
||||||
|
try {
|
||||||
|
const rl: any = await GetRadios();
|
||||||
|
setRadios(rl ?? []);
|
||||||
|
const act = (rl ?? []).find((r: any) => r.active) ?? (rl ?? [])[0];
|
||||||
|
setActiveRadioId(act?.id ?? '');
|
||||||
|
} catch { /* one radio, never listed — the panel works as it always did */ }
|
||||||
try { setUltrabeam(await GetUltrabeamSettings() as any); } catch {}
|
try { setUltrabeam(await GetUltrabeamSettings() as any); } catch {}
|
||||||
try { setAntgenius(await GetAntGeniusSettings() as any); } catch {}
|
try { setAntgenius(await GetAntGeniusSettings() as any); } catch {}
|
||||||
try { setTunergenius(await GetTunerGeniusSettings() as any); } catch {}
|
try { setTunergenius(await GetTunerGeniusSettings() as any); } catch {}
|
||||||
@@ -3189,6 +3205,87 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
hint={t('cat.hint')}
|
hint={t('cat.hint')}
|
||||||
/>
|
/>
|
||||||
<div className="space-y-4 max-w-3xl">
|
<div className="space-y-4 max-w-3xl">
|
||||||
|
{/* RADIOS. Everything below edits the one selected here, and the status
|
||||||
|
bar's CAT chip switches between them without moving the rest of the
|
||||||
|
station — which is what making a profile per radio used to do. */}
|
||||||
|
<div className="rounded-lg border border-border p-3 space-y-2">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Label className="shrink-0">{t('cat.radio')}</Label>
|
||||||
|
<Select value={activeRadio || undefined} onValueChange={(v) => {
|
||||||
|
if (v === activeRadio || radioBusy) return;
|
||||||
|
// Saving first: the panel may hold edits to the radio being left
|
||||||
|
// behind, and switching without them would throw them away.
|
||||||
|
setRadioBusy(true);
|
||||||
|
SaveCATSettings(catCfg as any)
|
||||||
|
.then(() => SetActiveRadio(v))
|
||||||
|
.then(async () => {
|
||||||
|
setActiveRadioId(v);
|
||||||
|
setCatCfg(await GetCATSettings() as any);
|
||||||
|
setRadios(((await GetRadios()) ?? []) as any[]);
|
||||||
|
})
|
||||||
|
.catch((e: any) => setErr(String(e?.message ?? e)))
|
||||||
|
.finally(() => setRadioBusy(false));
|
||||||
|
}}>
|
||||||
|
<SelectTrigger className="h-9 flex-1"><SelectValue placeholder={t('cat.radio')} /></SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{radios.map((r: any, i: number) => (
|
||||||
|
<SelectItem key={r.id} value={r.id}>{r.name?.trim() || r.label || `Radio ${i + 1}`}</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
<Input className="h-9 w-44" placeholder={t('cat.radioNamePh')}
|
||||||
|
value={(radios.find((r: any) => r.id === activeRadio)?.name) ?? ''}
|
||||||
|
onChange={(e) => setRadios((l) => l.map((r: any) => r.id === activeRadio ? { ...r, name: e.target.value } : r))}
|
||||||
|
onBlur={() => { SaveRadios(radios as any).catch(() => {}); }} />
|
||||||
|
<Button type="button" variant="outline" size="sm" className="h-9 shrink-0" disabled={radioBusy}
|
||||||
|
title={t('cat.radioAddHint')}
|
||||||
|
onClick={() => {
|
||||||
|
// A new radio starts from the CURRENT one rather than from
|
||||||
|
// nothing: a second rig is usually the same shape as the first
|
||||||
|
// with one port changed, and an empty form is a form to fill in
|
||||||
|
// twice.
|
||||||
|
const next = [...radios, { id: '', name: '', backend: catCfg.backend, settings: catCfg }];
|
||||||
|
setRadioBusy(true);
|
||||||
|
SaveRadios(next as any)
|
||||||
|
.then(() => GetRadios())
|
||||||
|
.then((rl: any) => setRadios(rl ?? []))
|
||||||
|
.catch((e: any) => setErr(String(e?.message ?? e)))
|
||||||
|
.finally(() => setRadioBusy(false));
|
||||||
|
}}>+</Button>
|
||||||
|
<Button type="button" variant="ghost" size="sm" className="h-9 shrink-0 text-danger"
|
||||||
|
disabled={radioBusy || radios.length < 2}
|
||||||
|
title={t('cat.radioRemoveHint')}
|
||||||
|
onClick={() => {
|
||||||
|
const next = radios.filter((r: any) => r.id !== activeRadio);
|
||||||
|
setRadioBusy(true);
|
||||||
|
SaveRadios(next as any)
|
||||||
|
.then(() => SetActiveRadio(next[0].id))
|
||||||
|
.then(async () => {
|
||||||
|
setActiveRadioId(next[0].id);
|
||||||
|
setCatCfg(await GetCATSettings() as any);
|
||||||
|
setRadios(((await GetRadios()) ?? []) as any[]);
|
||||||
|
})
|
||||||
|
.catch((e: any) => setErr(String(e?.message ?? e)))
|
||||||
|
.finally(() => setRadioBusy(false));
|
||||||
|
}}>
|
||||||
|
<Trash2 className="size-3.5" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/* MY_RIG follows the radio, not the profile.
|
||||||
|
Operating conditions describe a PLAN — "on 20 m I use the beam
|
||||||
|
and the 7300" — while this is the fact of which rig is keying.
|
||||||
|
Empty leaves the old chain alone. */}
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Label className="shrink-0 w-24">{t('cat.radioMyRig')}</Label>
|
||||||
|
<Input className="h-9 flex-1" placeholder={t('cat.radioMyRigPh')}
|
||||||
|
value={(radios.find((r: any) => r.id === activeRadio)?.my_rig) ?? ''}
|
||||||
|
onChange={(e) => setRadios((l) => l.map((r: any) => r.id === activeRadio ? { ...r, my_rig: e.target.value } : r))}
|
||||||
|
onBlur={() => { SaveRadios(radios as any).catch(() => {}); }} />
|
||||||
|
</div>
|
||||||
|
<p className="text-[11px] text-muted-foreground">{t('cat.radioHint')}</p>
|
||||||
|
<p className="text-[11px] text-muted-foreground">{t('cat.radioMyRigHint')}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||||
<Checkbox checked={catCfg.enabled} onCheckedChange={(c) => setCatCfg((s) => ({ ...s, enabled: !!c }))} />
|
<Checkbox checked={catCfg.enabled} onCheckedChange={(c) => setCatCfg((s) => ({ ...s, enabled: !!c }))} />
|
||||||
{t('cat.enable')}
|
{t('cat.enable')}
|
||||||
@@ -4773,7 +4870,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
<SelectItem value="yaesu">{t('wk.engYaesu')}</SelectItem>
|
<SelectItem value="yaesu">{t('wk.engYaesu')}</SelectItem>
|
||||||
<SelectItem value="kenwood">{t('wk.engKenwood')}</SelectItem>
|
<SelectItem value="kenwood">{t('wk.engKenwood')}</SelectItem>
|
||||||
<SelectItem value="flex">{t('wk.engFlex')}</SelectItem>
|
<SelectItem value="flex">{t('wk.engFlex')}</SelectItem>
|
||||||
<SelectItem value="tci" disabled>{t('wk.engTci')}</SelectItem>
|
<SelectItem value="tci">{t('wk.engTci')}</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
@@ -4834,6 +4931,22 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
) : wk.engine === 'tci' ? (
|
||||||
|
<>
|
||||||
|
{(!catCfg.enabled || catCfg.backend !== 'tci') && (
|
||||||
|
<p className="text-xs font-medium text-warning -mt-1 flex items-start gap-1.5">
|
||||||
|
<span aria-hidden>⚠</span>
|
||||||
|
<span>{t('wk.catWarnTci', { backend: catCfg.enabled ? (catCfg.backend || 'none') : 'disabled' })}</span>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<p className="text-xs text-muted-foreground -mt-1">{t('wk.tciHint')}</p>
|
||||||
|
<div className="grid grid-cols-4 gap-3">
|
||||||
|
<div className="space-y-1">
|
||||||
|
<Label>{t('wk.speed')}</Label>
|
||||||
|
<Input type="number" min={5} max={60} value={wk.wpm} onChange={(e) => setWkField({ wpm: num(e.target.value, 25) })} className="font-mono" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
) : wk.engine === 'flex' ? (
|
) : wk.engine === 'flex' ? (
|
||||||
<>
|
<>
|
||||||
{(!catCfg.enabled || catCfg.backend !== 'flex') && (
|
{(!catCfg.enabled || catCfg.backend !== 'flex') && (
|
||||||
@@ -5203,11 +5316,6 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<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"
|
<Checkbox checked={clusterWorkedSameSlot} className="mt-0.5"
|
||||||
onCheckedChange={(c) => { const v = !!c; setClusterWorkedSameSlot(v); writeUiPref('opslog.clusterWorkedSameSlot', v ? '1' : '0'); }} />
|
onCheckedChange={(c) => { const v = !!c; setClusterWorkedSameSlot(v); writeUiPref('opslog.clusterWorkedSameSlot', v ? '1' : '0'); }} />
|
||||||
@@ -5269,11 +5377,24 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
const n = parseInt(raw, 10);
|
const n = parseInt(raw, 10);
|
||||||
if (Number.isFinite(n) && n > 0) SetSpotMax(Math.min(10000, n)).catch(() => {});
|
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>
|
</div>
|
||||||
|
|
||||||
<div className="border-t border-border/60 pt-3 space-y-2">
|
<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">
|
<label className="flex items-start gap-2 text-sm cursor-pointer">
|
||||||
<Checkbox checked={chaseGrids} className="mt-0.5"
|
<Checkbox checked={chaseGrids} className="mt-0.5"
|
||||||
onCheckedChange={(c) => { setChaseGrids(!!c); SetChaseNewGrids(!!c).catch(() => {}); }} />
|
onCheckedChange={(c) => { setChaseGrids(!!c); SetChaseNewGrids(!!c).catch(() => {}); }} />
|
||||||
@@ -6667,7 +6788,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
useLocalLogbook(); // SQLite → default logbook file (clears any per-profile path)
|
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>
|
<SelectContent>
|
||||||
<SelectItem value="sqlite">{t('db.optSqlite')}</SelectItem>
|
<SelectItem value="sqlite">{t('db.optSqlite')}</SelectItem>
|
||||||
<SelectItem value="mysql">{t('db.optMysql')}</SelectItem>
|
<SelectItem value="mysql">{t('db.optMysql')}</SelectItem>
|
||||||
@@ -7037,7 +7158,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
const { lang, setLang, t } = useI18n();
|
const { lang, setLang, t } = useI18n();
|
||||||
return (
|
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="space-y-3 max-w-3xl">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Label className="text-sm w-40">{t('settings.language')}</Label>
|
<Label className="text-sm w-40">{t('settings.language')}</Label>
|
||||||
@@ -7065,15 +7186,32 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
['us', t('gen.dateUS'), '07-30-2026 14:25']] as [DateFormat, string, string][]).map(([code, label, sample]) => (
|
['us', t('gen.dateUS'), '07-30-2026 14:25']] as [DateFormat, string, string][]).map(([code, label, sample]) => (
|
||||||
<button key={code} type="button" title={sample}
|
<button key={code} type="button" title={sample}
|
||||||
onClick={() => { setDateFormat(code); setDateFmtSel(code); }}
|
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')}>
|
dateFmtSel === code ? 'bg-primary text-primary-foreground' : 'bg-card text-muted-foreground hover:bg-muted')}>
|
||||||
{label}
|
{label}
|
||||||
<span className="text-[10px] font-mono opacity-70">{sample}</span>
|
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</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 />
|
<ThemeSelector />
|
||||||
|
|
||||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||||
@@ -7095,11 +7233,10 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
{/* Super Check Partial / N+1 — downloads the community MASTER.SCP list and
|
{/* Super Check Partial / N+1 — downloads the community MASTER.SCP list and
|
||||||
shows a two-column callsign helper (partial matches + one-edit calls). */}
|
shows a two-column callsign helper (partial matches + one-edit calls). */}
|
||||||
<div className="border-t border-border/60 pt-3 space-y-2">
|
<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)} />
|
<Checkbox checked={scp.enabled} disabled={scpBusy} onCheckedChange={(c) => toggleScp(!!c)} />
|
||||||
{t('scp.enable')}
|
{t('scp.enable')}
|
||||||
</label>
|
</label>
|
||||||
<p className="text-[11px] text-muted-foreground">{t('scp.settingsHint')}</p>
|
|
||||||
{scp.enabled && (
|
{scp.enabled && (
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Button variant="outline" size="sm" onClick={downloadScp} disabled={scpBusy}>
|
<Button variant="outline" size="sm" onClick={downloadScp} disabled={scpBusy}>
|
||||||
@@ -7127,11 +7264,18 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
</label>
|
</label>
|
||||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
<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'); }} />
|
<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')}
|
||||||
</label>
|
</label>
|
||||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
<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'); }} />
|
<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>
|
</label>
|
||||||
<TelemetryToggle />
|
<TelemetryToggle />
|
||||||
|
|
||||||
@@ -7194,12 +7338,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
|||||||
}}
|
}}
|
||||||
className="mt-0.5"
|
className="mt-0.5"
|
||||||
/>
|
/>
|
||||||
<span>
|
<span title={t('gen.clubDesc')}>{t('gen.clubUse')}</span>
|
||||||
{t('gen.clubUse')}
|
|
||||||
<span className="block text-xs text-muted-foreground mt-0.5">
|
|
||||||
{t('gen.clubDesc')}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</label>
|
</label>
|
||||||
<div className="flex items-center gap-3 pl-6">
|
<div className="flex items-center gap-3 pl-6">
|
||||||
<Button variant="outline" size="sm" className="h-8" disabled={clubBusy}
|
<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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ interface Props {
|
|||||||
wpm: number;
|
wpm: number;
|
||||||
macros: WKMacro[];
|
macros: WKMacro[];
|
||||||
sent: string; // text echoed back by the keyer as it transmits
|
sent: string; // text echoed back by the keyer as it transmits
|
||||||
source: 'winkeyer' | 'icom' | 'flex' | 'yaesu' | 'kenwood'; // CW output engine (chosen in Settings → CW Keyer)
|
source: 'winkeyer' | 'icom' | 'flex' | 'yaesu' | 'kenwood' | 'tci'; // CW output engine (chosen in Settings → CW Keyer)
|
||||||
breakIn?: number; // Icom CW break-in: 0=OFF, 1=SEMI, 2=FULL
|
breakIn?: number; // Icom CW break-in: 0=OFF, 1=SEMI, 2=FULL
|
||||||
onSetBreakIn?: (mode: number) => void;
|
onSetBreakIn?: (mode: number) => void;
|
||||||
onSelectPort: (p: string) => void;
|
onSelectPort: (p: string) => void;
|
||||||
@@ -109,16 +109,16 @@ export function WinkeyerPanel({
|
|||||||
<Radio className="size-4 text-primary shrink-0" />
|
<Radio className="size-4 text-primary shrink-0" />
|
||||||
{/* CW output engine (chosen in Settings → CW Keyer). */}
|
{/* CW output engine (chosen in Settings → CW Keyer). */}
|
||||||
<span className="text-xs font-semibold uppercase tracking-wider text-muted-foreground shrink-0">
|
<span className="text-xs font-semibold uppercase tracking-wider text-muted-foreground shrink-0">
|
||||||
{source === 'icom' ? 'Icom CW' : source === 'flex' ? 'Flex CWX' : source === 'yaesu' ? 'Yaesu CW' : source === 'kenwood' ? 'Kenwood CW' : 'WinKeyer'}
|
{source === 'icom' ? 'Icom CW' : source === 'flex' ? 'Flex CWX' : source === 'yaesu' ? 'Yaesu CW' : source === 'kenwood' ? 'Kenwood CW' : source === 'tci' ? 'TCI CW' : 'WinKeyer'}
|
||||||
</span>
|
</span>
|
||||||
<span className={cn('size-2 rounded-full', connected ? (status.busy ? 'bg-warning animate-pulse' : 'bg-success') : 'bg-muted-foreground/40')}
|
<span className={cn('size-2 rounded-full', connected ? (status.busy ? 'bg-warning animate-pulse' : 'bg-success') : 'bg-muted-foreground/40')}
|
||||||
title={connected ? (status.busy ? t('wkp.sending') : t('wkp.connectedV', { version: status.version })) : t('wkp.disconnected')} />
|
title={connected ? (status.busy ? t('wkp.sending') : t('wkp.connectedV', { version: status.version })) : t('wkp.disconnected')} />
|
||||||
<div className="flex-1" />
|
<div className="flex-1" />
|
||||||
{source === 'icom' || source === 'flex' || source === 'yaesu' || source === 'kenwood' ? (
|
{source === 'icom' || source === 'flex' || source === 'yaesu' || source === 'kenwood' || source === 'tci' ? (
|
||||||
<span className="text-[11px] font-medium text-muted-foreground">
|
<span className="text-[11px] font-medium text-muted-foreground">
|
||||||
{source === 'flex'
|
{source === 'flex'
|
||||||
? (connected ? t('wkp.cwxReady') : t('wkp.cwxOffline'))
|
? (connected ? t('wkp.cwxReady') : t('wkp.cwxOffline'))
|
||||||
: source === 'yaesu' || source === 'kenwood'
|
: source === 'yaesu' || source === 'kenwood' || source === 'tci'
|
||||||
? (connected ? t('wkp.rigReady') : t('wkp.rigOffline'))
|
? (connected ? t('wkp.rigReady') : t('wkp.rigOffline'))
|
||||||
: (connected ? t('wkp.civReady') : t('wkp.civOffline'))}
|
: (connected ? t('wkp.civReady') : t('wkp.civOffline'))}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -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] ?? [];
|
||||||
|
}
|
||||||
+85
-17
File diff suppressed because one or more lines are too long
@@ -14,9 +14,11 @@ export type MatrixColors = {
|
|||||||
entity_worked: string;
|
entity_worked: string;
|
||||||
not_worked: string;
|
not_worked: string;
|
||||||
current_entry: string;
|
current_entry: string;
|
||||||
|
mark_worked: string;
|
||||||
|
mark_confirmed: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The six settings fields and the CSS custom property each one drives. Also the
|
// The settings fields and the CSS custom property each one drives. Also the
|
||||||
// display order — the same order the legend under the matrix reads in, so the
|
// display order — the same order the legend under the matrix reads in, so the
|
||||||
// settings panel and the grid can never disagree about which green is which.
|
// settings panel and the grid can never disagree about which green is which.
|
||||||
export const MATRIX_VARS: { key: keyof Omit<MatrixColors, 'enabled'>; cssVar: string; label: string }[] = [
|
export const MATRIX_VARS: { key: keyof Omit<MatrixColors, 'enabled'>; cssVar: string; label: string }[] = [
|
||||||
@@ -26,12 +28,15 @@ export const MATRIX_VARS: { key: keyof Omit<MatrixColors, 'enabled'>; cssVar: st
|
|||||||
{ key: 'entity_worked', cssVar: '--mx-dx-work', label: 'mx.dxWork' },
|
{ key: 'entity_worked', cssVar: '--mx-dx-work', label: 'mx.dxWork' },
|
||||||
{ key: 'not_worked', cssVar: '--mx-none', label: 'mx.none' },
|
{ key: 'not_worked', cssVar: '--mx-none', label: 'mx.none' },
|
||||||
{ key: 'current_entry', cssVar: '--mx-cur', label: 'mx.current' },
|
{ key: 'current_entry', cssVar: '--mx-cur', label: 'mx.current' },
|
||||||
|
{ key: 'mark_worked', cssVar: '--mx-mark-work', label: 'mx.markWork' },
|
||||||
|
{ key: 'mark_confirmed', cssVar: '--mx-mark-conf', label: 'mx.markConf' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const emptyMatrixColors = (): MatrixColors => ({
|
export const emptyMatrixColors = (): MatrixColors => ({
|
||||||
enabled: false,
|
enabled: false,
|
||||||
call_confirmed: '', call_worked: '', entity_confirmed: '',
|
call_confirmed: '', call_worked: '', entity_confirmed: '',
|
||||||
entity_worked: '', not_worked: '', current_entry: '',
|
entity_worked: '', not_worked: '', current_entry: '',
|
||||||
|
mark_worked: '', mark_confirmed: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// applyMatrixColors stamps (or clears) the overrides on <html>. Safe to call as
|
// applyMatrixColors stamps (or clears) the overrides on <html>. Safe to call as
|
||||||
|
|||||||
@@ -11,7 +11,25 @@
|
|||||||
//
|
//
|
||||||
// They compose deliberately: mute what is done, light up what is not.
|
// 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
|
// 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
|
// 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 const SPOT_DISPLAY_OPTIONS_EXPOSED = false;
|
||||||
|
|
||||||
export function readSpotDisplayOptions(): SpotDisplayOptions {
|
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 {
|
try {
|
||||||
return {
|
return {
|
||||||
muteWorked: localStorage.getItem('opslog.clusterMuteWorked') === '1',
|
muteWorked: localStorage.getItem('opslog.clusterMuteWorked') === '1',
|
||||||
slotHighlight: localStorage.getItem('opslog.clusterSlotHighlight') === '1',
|
slotHighlight: localStorage.getItem('opslog.clusterSlotHighlight') === '1',
|
||||||
|
chasePota: chasePota(), chaseSota: chaseSota(),
|
||||||
};
|
};
|
||||||
} catch {
|
} 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) {
|
if (o.muteWorked) {
|
||||||
e = { ...e, worked_call: false } as NonNullable<T>;
|
e = { ...e, worked_call: false } as NonNullable<T>;
|
||||||
}
|
}
|
||||||
|
if (!o.chasePota && e.new_pota) {
|
||||||
|
e = { ...e, new_pota: false } as NonNullable<T>;
|
||||||
|
}
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ const PORTABLE_KEYS = [
|
|||||||
'opslog.clusterFilterSource', 'opslog.clusterGroup', 'opslog.clusterBands',
|
'opslog.clusterFilterSource', 'opslog.clusterGroup', 'opslog.clusterBands',
|
||||||
'opslog.clusterLockBand', 'opslog.clusterLockMode', 'opslog.clusterStatusFilter',
|
'opslog.clusterLockBand', 'opslog.clusterLockMode', 'opslog.clusterStatusFilter',
|
||||||
'opslog.clusterModeFilter', 'opslog.clusterSearch', 'opslog.clusterHideWorked',
|
'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.activeTab', // last selected tab
|
||||||
'opslog.mainSplit', // Main tab: width share of the left pane (percent) — legacy, read once to seed mainShares
|
'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:[..]}
|
'opslog.mainShares', // Main tab: column shares per column count, as {2:[..],3:[..],4:[..]}
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
// Distance units.
|
||||||
|
//
|
||||||
|
// Everything is COMPUTED in kilometres — the great-circle maths, the backend's
|
||||||
|
// distance_km on a spot, the map's path lengths — and converted once, here, at
|
||||||
|
// display time. Storing miles anywhere would mean two sources of truth for the
|
||||||
|
// same number and a rounding error that grows with every hop.
|
||||||
|
//
|
||||||
|
// The preference is portable (see lib/uiPref): an operator who works in miles
|
||||||
|
// works in miles on every machine they copy their folder to.
|
||||||
|
import { writeUiPref } from '@/lib/uiPref';
|
||||||
|
|
||||||
|
export const KEY_MILES = 'opslog.distanceMiles';
|
||||||
|
const KM_PER_MILE = 1.609344; // statute miles, the ones a US licence is used in
|
||||||
|
|
||||||
|
export function useMiles(): boolean {
|
||||||
|
try { return localStorage.getItem(KEY_MILES) === '1'; } catch { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setUseMiles(on: boolean): void {
|
||||||
|
writeUiPref(KEY_MILES, on ? '1' : '0');
|
||||||
|
listeners.forEach((l) => l());
|
||||||
|
}
|
||||||
|
|
||||||
|
// subscribeDistanceUnit notifies on a change. The grids capture the unit inside
|
||||||
|
// their column definitions (header text and formatter both), so without this a
|
||||||
|
// toggle would only show up on the next language change or restart.
|
||||||
|
const listeners = new Set<() => void>();
|
||||||
|
export function subscribeDistanceUnit(fn: () => void): () => void {
|
||||||
|
listeners.add(fn);
|
||||||
|
return () => { listeners.delete(fn); };
|
||||||
|
}
|
||||||
|
|
||||||
|
// distanceValue converts a distance in km to the operator's unit, rounded to a
|
||||||
|
// whole unit — the precision the inputs actually justify (a 4-character grid is
|
||||||
|
// a square tens of kilometres wide).
|
||||||
|
export function distanceValue(km: number): number {
|
||||||
|
if (!isFinite(km)) return 0;
|
||||||
|
return Math.round(useMiles() ? km / KM_PER_MILE : km);
|
||||||
|
}
|
||||||
|
|
||||||
|
// distanceUnit is the short label: "km" or "mi".
|
||||||
|
export function distanceUnit(): string {
|
||||||
|
return useMiles() ? 'mi' : 'km';
|
||||||
|
}
|
||||||
|
|
||||||
|
// formatDistance is value + unit, thousands-separated: "12 345 km".
|
||||||
|
export function formatDistance(km: number): string {
|
||||||
|
return `${distanceValue(km).toLocaleString()} ${distanceUnit()}`;
|
||||||
|
}
|
||||||
@@ -91,6 +91,11 @@
|
|||||||
be recoloured on its own without dragging every other warning in the app
|
be recoloured on its own without dragging every other warning in the app
|
||||||
with it (Appearance → matrix colours). */
|
with it (Appearance → matrix colours). */
|
||||||
--mx-cur: var(--warning);
|
--mx-cur: var(--warning);
|
||||||
|
/* The "worked with this callsign" dot. Declared ONCE, like --mx-cur: it is
|
||||||
|
drawn over every one of the five cell colours, so it follows the theme's own
|
||||||
|
foreground/background pair rather than a per-theme colour of its own. */
|
||||||
|
--mx-mark-work: var(--foreground);
|
||||||
|
--mx-mark-conf: var(--foreground);
|
||||||
|
|
||||||
--scrollbar-thumb: #b8a880;
|
--scrollbar-thumb: #b8a880;
|
||||||
--scrollbar-thumb-hover: #968455;
|
--scrollbar-thumb-hover: #968455;
|
||||||
@@ -981,6 +986,8 @@
|
|||||||
--color-mx-dx-work: var(--mx-dx-work);
|
--color-mx-dx-work: var(--mx-dx-work);
|
||||||
--color-mx-none: var(--mx-none);
|
--color-mx-none: var(--mx-none);
|
||||||
--color-mx-cur: var(--mx-cur);
|
--color-mx-cur: var(--mx-cur);
|
||||||
|
--color-mx-mark-work: var(--mx-mark-work);
|
||||||
|
--color-mx-mark-conf: var(--mx-mark-conf);
|
||||||
|
|
||||||
--radius: 0.5rem;
|
--radius: 0.5rem;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Single source of truth for the app version shown in the UI (header + About).
|
// 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).
|
// Bump this on a release (the release script updates it alongside telemetry.go).
|
||||||
export const APP_VERSION = '0.26.18';
|
export const APP_VERSION = '0.27.0';
|
||||||
|
|
||||||
// Author / credits, shown in Help -> About.
|
// Author / credits, shown in Help -> About.
|
||||||
export const APP_AUTHOR = 'F4BPO';
|
export const APP_AUTHOR = 'F4BPO';
|
||||||
|
|||||||
Vendored
+45
@@ -30,6 +30,7 @@ import {lotwusers} from '../models';
|
|||||||
import {lookup} from '../models';
|
import {lookup} from '../models';
|
||||||
import {netctl} from '../models';
|
import {netctl} from '../models';
|
||||||
import {scp} from '../models';
|
import {scp} from '../models';
|
||||||
|
import {watchlist} from '../models';
|
||||||
|
|
||||||
export function ACOMSetOperate(arg1:boolean):Promise<void>;
|
export function ACOMSetOperate(arg1:boolean):Promise<void>;
|
||||||
|
|
||||||
@@ -43,6 +44,8 @@ export function ADIFVersion():Promise<string>;
|
|||||||
|
|
||||||
export function ActivateProfile(arg1:number):Promise<void>;
|
export function ActivateProfile(arg1:number):Promise<void>;
|
||||||
|
|
||||||
|
export function ActiveRadioID():Promise<string>;
|
||||||
|
|
||||||
export function AddQSO(arg1:qso.QSO):Promise<number>;
|
export function AddQSO(arg1:qso.QSO):Promise<number>;
|
||||||
|
|
||||||
export function AmpFanMode(arg1:string,arg2:string):Promise<void>;
|
export function AmpFanMode(arg1:string,arg2:string):Promise<void>;
|
||||||
@@ -501,6 +504,10 @@ export function GetLiveOpenings():Promise<Array<bandopen.Opening>>;
|
|||||||
|
|
||||||
export function GetLiveStations():Promise<Array<main.LiveStation>>;
|
export function GetLiveStations():Promise<Array<main.LiveStation>>;
|
||||||
|
|
||||||
|
export function GetLoTWDownloadAllCalls():Promise<boolean>;
|
||||||
|
|
||||||
|
export function GetLoTWQSLDetail():Promise<boolean>;
|
||||||
|
|
||||||
export function GetLoTWUsersStatus():Promise<main.LoTWUsersStatus>;
|
export function GetLoTWUsersStatus():Promise<main.LoTWUsersStatus>;
|
||||||
|
|
||||||
export function GetLogFilePath():Promise<string>;
|
export function GetLogFilePath():Promise<string>;
|
||||||
@@ -541,6 +548,8 @@ export function GetQSO(arg1:number):Promise<qso.QSO>;
|
|||||||
|
|
||||||
export function GetQSORate():Promise<main.QSORate>;
|
export function GetQSORate():Promise<main.QSORate>;
|
||||||
|
|
||||||
|
export function GetRadios():Promise<Array<main.RadioConfig>>;
|
||||||
|
|
||||||
export function GetRelayAuto():Promise<main.RelayAutoConfig>;
|
export function GetRelayAuto():Promise<main.RelayAutoConfig>;
|
||||||
|
|
||||||
export function GetRotatorHeading():Promise<main.RotatorHeading>;
|
export function GetRotatorHeading():Promise<main.RotatorHeading>;
|
||||||
@@ -593,6 +602,8 @@ export function GetUltrabeamSettings():Promise<main.UltrabeamSettings>;
|
|||||||
|
|
||||||
export function GetUltrabeamStatus():Promise<main.UltrabeamStatusInfo>;
|
export function GetUltrabeamStatus():Promise<main.UltrabeamStatusInfo>;
|
||||||
|
|
||||||
|
export function GetWatchlistContestPattern():Promise<string>;
|
||||||
|
|
||||||
export function GetWebPublishConfig():Promise<webpub.Config>;
|
export function GetWebPublishConfig():Promise<webpub.Config>;
|
||||||
|
|
||||||
export function GetWebPublishStatus():Promise<main.WebPublishStatus>;
|
export function GetWebPublishStatus():Promise<main.WebPublishStatus>;
|
||||||
@@ -745,6 +756,8 @@ export function ListQSO(arg1:qso.ListFilter):Promise<Array<qso.QSO>>;
|
|||||||
|
|
||||||
export function ListQSOFiltered(arg1:qso.QueryFilter):Promise<Array<qso.QSO>>;
|
export function ListQSOFiltered(arg1:qso.QueryFilter):Promise<Array<qso.QSO>>;
|
||||||
|
|
||||||
|
export function ListRadios():Promise<Array<main.RadioListEntry>>;
|
||||||
|
|
||||||
export function ListSerialPorts():Promise<Array<string>>;
|
export function ListSerialPorts():Promise<Array<string>>;
|
||||||
|
|
||||||
export function ListTQSLStationLocations():Promise<Array<extsvc.StationLocation>>;
|
export function ListTQSLStationLocations():Promise<Array<extsvc.StationLocation>>;
|
||||||
@@ -1037,6 +1050,8 @@ export function SaveProfile(arg1:profile.Profile):Promise<profile.Profile>;
|
|||||||
|
|
||||||
export function SaveQSLDefaults(arg1:main.QSLDefaults):Promise<void>;
|
export function SaveQSLDefaults(arg1:main.QSLDefaults):Promise<void>;
|
||||||
|
|
||||||
|
export function SaveRadios(arg1:Array<main.RadioConfig>):Promise<void>;
|
||||||
|
|
||||||
export function SaveRelayAuto(arg1:main.RelayAutoConfig):Promise<void>;
|
export function SaveRelayAuto(arg1:main.RelayAutoConfig):Promise<void>;
|
||||||
|
|
||||||
export function SaveRotators(arg1:Array<main.RotatorDevice>):Promise<void>;
|
export function SaveRotators(arg1:Array<main.RotatorDevice>):Promise<void>;
|
||||||
@@ -1083,6 +1098,8 @@ export function SendLogToDeveloper():Promise<void>;
|
|||||||
|
|
||||||
export function SendQSORecordingEmail(arg1:number):Promise<void>;
|
export function SendQSORecordingEmail(arg1:number):Promise<void>;
|
||||||
|
|
||||||
|
export function SetActiveRadio(arg1:string):Promise<void>;
|
||||||
|
|
||||||
export function SetActiveRotor(arg1:number):Promise<void>;
|
export function SetActiveRotor(arg1:number):Promise<void>;
|
||||||
|
|
||||||
export function SetAlertEmailTo(arg1:string):Promise<void>;
|
export function SetAlertEmailTo(arg1:string):Promise<void>;
|
||||||
@@ -1131,6 +1148,8 @@ export function SetKenwoodNB(arg1:boolean):Promise<void>;
|
|||||||
|
|
||||||
export function SetKenwoodNR(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 SetKenwoodPower(arg1:number):Promise<void>;
|
||||||
|
|
||||||
export function SetKenwoodPreamp(arg1:boolean):Promise<void>;
|
export function SetKenwoodPreamp(arg1:boolean):Promise<void>;
|
||||||
@@ -1139,6 +1158,8 @@ export function SetKenwoodRFGain(arg1:number):Promise<void>;
|
|||||||
|
|
||||||
export function SetKenwoodRIT(arg1:boolean):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 SetKenwoodSquelch(arg1:number):Promise<void>;
|
||||||
|
|
||||||
export function SetKenwoodTX(arg1:boolean):Promise<void>;
|
export function SetKenwoodTX(arg1:boolean):Promise<void>;
|
||||||
@@ -1147,6 +1168,10 @@ export function SetKenwoodXIT(arg1:boolean):Promise<void>;
|
|||||||
|
|
||||||
export function SetLinkedAmps(arg1:Array<string>):Promise<void>;
|
export function SetLinkedAmps(arg1:Array<string>):Promise<void>;
|
||||||
|
|
||||||
|
export function SetLoTWDownloadAllCalls(arg1:boolean):Promise<void>;
|
||||||
|
|
||||||
|
export function SetLoTWQSLDetail(arg1:boolean):Promise<void>;
|
||||||
|
|
||||||
export function SetMotorFollow(arg1:boolean,arg2:number,arg3:string):Promise<void>;
|
export function SetMotorFollow(arg1:boolean,arg2:number,arg3:string):Promise<void>;
|
||||||
|
|
||||||
export function SetOpsLogQSLReceived(arg1:number,arg2:boolean):Promise<void>;
|
export function SetOpsLogQSLReceived(arg1:number,arg2:boolean):Promise<void>;
|
||||||
@@ -1205,6 +1230,8 @@ export function SetUIPref(arg1:string,arg2:string):Promise<void>;
|
|||||||
|
|
||||||
export function SetUltrabeamDirection(arg1:number):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 SetWinkeyerTrace(arg1:boolean):Promise<void>;
|
||||||
|
|
||||||
export function SetWorkedCallVariants(arg1:boolean):Promise<void>;
|
export function SetWorkedCallVariants(arg1:boolean):Promise<void>;
|
||||||
@@ -1261,6 +1288,12 @@ export function SyncFolderNow():Promise<number>;
|
|||||||
|
|
||||||
export function SyncPOTAHunterLog(arg1:boolean,arg2:boolean):Promise<main.POTASyncResult>;
|
export function SyncPOTAHunterLog(arg1:boolean,arg2:boolean):Promise<main.POTASyncResult>;
|
||||||
|
|
||||||
|
export function TCISendCW(arg1:string):Promise<void>;
|
||||||
|
|
||||||
|
export function TCISetKeySpeed(arg1:number):Promise<void>;
|
||||||
|
|
||||||
|
export function TCIStopCW():Promise<void>;
|
||||||
|
|
||||||
export function TailLogFile(arg1:number):Promise<string>;
|
export function TailLogFile(arg1:number):Promise<string>;
|
||||||
|
|
||||||
export function TestCloudlogUpload():Promise<string>;
|
export function TestCloudlogUpload():Promise<string>;
|
||||||
@@ -1329,6 +1362,18 @@ export function UploadCallsign(arg1:string):Promise<string>;
|
|||||||
|
|
||||||
export function UploadQSOsManual(arg1:string,arg2:Array<number>):Promise<void>;
|
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 WebPublishColumns():Promise<Array<Record<string, string>>>;
|
||||||
|
|
||||||
export function WinkeyerBackspace():Promise<void>;
|
export function WinkeyerBackspace():Promise<void>;
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ export function ActivateProfile(arg1) {
|
|||||||
return window['go']['main']['App']['ActivateProfile'](arg1);
|
return window['go']['main']['App']['ActivateProfile'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ActiveRadioID() {
|
||||||
|
return window['go']['main']['App']['ActiveRadioID']();
|
||||||
|
}
|
||||||
|
|
||||||
export function AddQSO(arg1) {
|
export function AddQSO(arg1) {
|
||||||
return window['go']['main']['App']['AddQSO'](arg1);
|
return window['go']['main']['App']['AddQSO'](arg1);
|
||||||
}
|
}
|
||||||
@@ -942,6 +946,14 @@ export function GetLiveStations() {
|
|||||||
return window['go']['main']['App']['GetLiveStations']();
|
return window['go']['main']['App']['GetLiveStations']();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function GetLoTWDownloadAllCalls() {
|
||||||
|
return window['go']['main']['App']['GetLoTWDownloadAllCalls']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GetLoTWQSLDetail() {
|
||||||
|
return window['go']['main']['App']['GetLoTWQSLDetail']();
|
||||||
|
}
|
||||||
|
|
||||||
export function GetLoTWUsersStatus() {
|
export function GetLoTWUsersStatus() {
|
||||||
return window['go']['main']['App']['GetLoTWUsersStatus']();
|
return window['go']['main']['App']['GetLoTWUsersStatus']();
|
||||||
}
|
}
|
||||||
@@ -1022,6 +1034,10 @@ export function GetQSORate() {
|
|||||||
return window['go']['main']['App']['GetQSORate']();
|
return window['go']['main']['App']['GetQSORate']();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function GetRadios() {
|
||||||
|
return window['go']['main']['App']['GetRadios']();
|
||||||
|
}
|
||||||
|
|
||||||
export function GetRelayAuto() {
|
export function GetRelayAuto() {
|
||||||
return window['go']['main']['App']['GetRelayAuto']();
|
return window['go']['main']['App']['GetRelayAuto']();
|
||||||
}
|
}
|
||||||
@@ -1126,6 +1142,10 @@ export function GetUltrabeamStatus() {
|
|||||||
return window['go']['main']['App']['GetUltrabeamStatus']();
|
return window['go']['main']['App']['GetUltrabeamStatus']();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function GetWatchlistContestPattern() {
|
||||||
|
return window['go']['main']['App']['GetWatchlistContestPattern']();
|
||||||
|
}
|
||||||
|
|
||||||
export function GetWebPublishConfig() {
|
export function GetWebPublishConfig() {
|
||||||
return window['go']['main']['App']['GetWebPublishConfig']();
|
return window['go']['main']['App']['GetWebPublishConfig']();
|
||||||
}
|
}
|
||||||
@@ -1430,6 +1450,10 @@ export function ListQSOFiltered(arg1) {
|
|||||||
return window['go']['main']['App']['ListQSOFiltered'](arg1);
|
return window['go']['main']['App']['ListQSOFiltered'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ListRadios() {
|
||||||
|
return window['go']['main']['App']['ListRadios']();
|
||||||
|
}
|
||||||
|
|
||||||
export function ListSerialPorts() {
|
export function ListSerialPorts() {
|
||||||
return window['go']['main']['App']['ListSerialPorts']();
|
return window['go']['main']['App']['ListSerialPorts']();
|
||||||
}
|
}
|
||||||
@@ -2014,6 +2038,10 @@ export function SaveQSLDefaults(arg1) {
|
|||||||
return window['go']['main']['App']['SaveQSLDefaults'](arg1);
|
return window['go']['main']['App']['SaveQSLDefaults'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SaveRadios(arg1) {
|
||||||
|
return window['go']['main']['App']['SaveRadios'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
export function SaveRelayAuto(arg1) {
|
export function SaveRelayAuto(arg1) {
|
||||||
return window['go']['main']['App']['SaveRelayAuto'](arg1);
|
return window['go']['main']['App']['SaveRelayAuto'](arg1);
|
||||||
}
|
}
|
||||||
@@ -2106,6 +2134,10 @@ export function SendQSORecordingEmail(arg1) {
|
|||||||
return window['go']['main']['App']['SendQSORecordingEmail'](arg1);
|
return window['go']['main']['App']['SendQSORecordingEmail'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SetActiveRadio(arg1) {
|
||||||
|
return window['go']['main']['App']['SetActiveRadio'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
export function SetActiveRotor(arg1) {
|
export function SetActiveRotor(arg1) {
|
||||||
return window['go']['main']['App']['SetActiveRotor'](arg1);
|
return window['go']['main']['App']['SetActiveRotor'](arg1);
|
||||||
}
|
}
|
||||||
@@ -2202,6 +2234,10 @@ export function SetKenwoodNR(arg1) {
|
|||||||
return window['go']['main']['App']['SetKenwoodNR'](arg1);
|
return window['go']['main']['App']['SetKenwoodNR'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SetKenwoodPanelMode(arg1) {
|
||||||
|
return window['go']['main']['App']['SetKenwoodPanelMode'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
export function SetKenwoodPower(arg1) {
|
export function SetKenwoodPower(arg1) {
|
||||||
return window['go']['main']['App']['SetKenwoodPower'](arg1);
|
return window['go']['main']['App']['SetKenwoodPower'](arg1);
|
||||||
}
|
}
|
||||||
@@ -2218,6 +2254,10 @@ export function SetKenwoodRIT(arg1) {
|
|||||||
return window['go']['main']['App']['SetKenwoodRIT'](arg1);
|
return window['go']['main']['App']['SetKenwoodRIT'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SetKenwoodRITOffset(arg1) {
|
||||||
|
return window['go']['main']['App']['SetKenwoodRITOffset'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
export function SetKenwoodSquelch(arg1) {
|
export function SetKenwoodSquelch(arg1) {
|
||||||
return window['go']['main']['App']['SetKenwoodSquelch'](arg1);
|
return window['go']['main']['App']['SetKenwoodSquelch'](arg1);
|
||||||
}
|
}
|
||||||
@@ -2234,6 +2274,14 @@ export function SetLinkedAmps(arg1) {
|
|||||||
return window['go']['main']['App']['SetLinkedAmps'](arg1);
|
return window['go']['main']['App']['SetLinkedAmps'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SetLoTWDownloadAllCalls(arg1) {
|
||||||
|
return window['go']['main']['App']['SetLoTWDownloadAllCalls'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SetLoTWQSLDetail(arg1) {
|
||||||
|
return window['go']['main']['App']['SetLoTWQSLDetail'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
export function SetMotorFollow(arg1, arg2, arg3) {
|
export function SetMotorFollow(arg1, arg2, arg3) {
|
||||||
return window['go']['main']['App']['SetMotorFollow'](arg1, arg2, arg3);
|
return window['go']['main']['App']['SetMotorFollow'](arg1, arg2, arg3);
|
||||||
}
|
}
|
||||||
@@ -2350,6 +2398,10 @@ export function SetUltrabeamDirection(arg1) {
|
|||||||
return window['go']['main']['App']['SetUltrabeamDirection'](arg1);
|
return window['go']['main']['App']['SetUltrabeamDirection'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SetWatchlistContestPattern(arg1) {
|
||||||
|
return window['go']['main']['App']['SetWatchlistContestPattern'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
export function SetWinkeyerTrace(arg1) {
|
export function SetWinkeyerTrace(arg1) {
|
||||||
return window['go']['main']['App']['SetWinkeyerTrace'](arg1);
|
return window['go']['main']['App']['SetWinkeyerTrace'](arg1);
|
||||||
}
|
}
|
||||||
@@ -2462,6 +2514,18 @@ export function SyncPOTAHunterLog(arg1, arg2) {
|
|||||||
return window['go']['main']['App']['SyncPOTAHunterLog'](arg1, arg2);
|
return window['go']['main']['App']['SyncPOTAHunterLog'](arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function TCISendCW(arg1) {
|
||||||
|
return window['go']['main']['App']['TCISendCW'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function TCISetKeySpeed(arg1) {
|
||||||
|
return window['go']['main']['App']['TCISetKeySpeed'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function TCIStopCW() {
|
||||||
|
return window['go']['main']['App']['TCIStopCW']();
|
||||||
|
}
|
||||||
|
|
||||||
export function TailLogFile(arg1) {
|
export function TailLogFile(arg1) {
|
||||||
return window['go']['main']['App']['TailLogFile'](arg1);
|
return window['go']['main']['App']['TailLogFile'](arg1);
|
||||||
}
|
}
|
||||||
@@ -2598,6 +2662,30 @@ export function UploadQSOsManual(arg1, arg2) {
|
|||||||
return window['go']['main']['App']['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() {
|
export function WebPublishColumns() {
|
||||||
return window['go']['main']['App']['WebPublishColumns']();
|
return window['go']['main']['App']['WebPublishColumns']();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1072,6 +1072,7 @@ export namespace cat {
|
|||||||
model?: string;
|
model?: string;
|
||||||
elecraft: boolean;
|
elecraft: boolean;
|
||||||
mode?: string;
|
mode?: string;
|
||||||
|
data_sub?: string;
|
||||||
transmitting: boolean;
|
transmitting: boolean;
|
||||||
split: boolean;
|
split: boolean;
|
||||||
split_tx_hz: number;
|
split_tx_hz: number;
|
||||||
@@ -1108,6 +1109,7 @@ export namespace cat {
|
|||||||
this.model = source["model"];
|
this.model = source["model"];
|
||||||
this.elecraft = source["elecraft"];
|
this.elecraft = source["elecraft"];
|
||||||
this.mode = source["mode"];
|
this.mode = source["mode"];
|
||||||
|
this.data_sub = source["data_sub"];
|
||||||
this.transmitting = source["transmitting"];
|
this.transmitting = source["transmitting"];
|
||||||
this.split = source["split"];
|
this.split = source["split"];
|
||||||
this.split_tx_hz = source["split_tx_hz"];
|
this.split_tx_hz = source["split_tx_hz"];
|
||||||
@@ -1196,6 +1198,7 @@ export namespace cat {
|
|||||||
low_hz: number;
|
low_hz: number;
|
||||||
high_hz: number;
|
high_hz: number;
|
||||||
fixed: boolean;
|
fixed: boolean;
|
||||||
|
unsupported: boolean;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
return new ScopeSweep(source);
|
return new ScopeSweep(source);
|
||||||
@@ -1208,6 +1211,7 @@ export namespace cat {
|
|||||||
this.low_hz = source["low_hz"];
|
this.low_hz = source["low_hz"];
|
||||||
this.high_hz = source["high_hz"];
|
this.high_hz = source["high_hz"];
|
||||||
this.fixed = source["fixed"];
|
this.fixed = source["fixed"];
|
||||||
|
this.unsupported = source["unsupported"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class TCIPanelState {
|
export class TCIPanelState {
|
||||||
@@ -3066,6 +3070,8 @@ export namespace main {
|
|||||||
entity_worked: string;
|
entity_worked: string;
|
||||||
not_worked: string;
|
not_worked: string;
|
||||||
current_entry: string;
|
current_entry: string;
|
||||||
|
mark_worked: string;
|
||||||
|
mark_confirmed: string;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
return new MatrixColors(source);
|
return new MatrixColors(source);
|
||||||
@@ -3080,6 +3086,8 @@ export namespace main {
|
|||||||
this.entity_worked = source["entity_worked"];
|
this.entity_worked = source["entity_worked"];
|
||||||
this.not_worked = source["not_worked"];
|
this.not_worked = source["not_worked"];
|
||||||
this.current_entry = source["current_entry"];
|
this.current_entry = source["current_entry"];
|
||||||
|
this.mark_worked = source["mark_worked"];
|
||||||
|
this.mark_confirmed = source["mark_confirmed"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3569,6 +3577,62 @@ export namespace main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class RadioConfig {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
settings: CATSettings;
|
||||||
|
my_rig: string;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new RadioConfig(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.id = source["id"];
|
||||||
|
this.name = source["name"];
|
||||||
|
this.settings = this.convertValues(source["settings"], CATSettings);
|
||||||
|
this.my_rig = source["my_rig"];
|
||||||
|
}
|
||||||
|
|
||||||
|
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 class RadioListEntry {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
label: string;
|
||||||
|
backend: string;
|
||||||
|
active: boolean;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new RadioListEntry(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.id = source["id"];
|
||||||
|
this.name = source["name"];
|
||||||
|
this.label = source["label"];
|
||||||
|
this.backend = source["backend"];
|
||||||
|
this.active = source["active"];
|
||||||
|
}
|
||||||
|
}
|
||||||
export class RelayAutoRule {
|
export class RelayAutoRule {
|
||||||
device_id: string;
|
device_id: string;
|
||||||
relay: number;
|
relay: number;
|
||||||
@@ -4237,6 +4301,24 @@ export namespace main {
|
|||||||
this.text = source["text"];
|
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 {
|
export class WebPublishStatus {
|
||||||
last_run: string;
|
last_run: string;
|
||||||
last_err: string;
|
last_err: string;
|
||||||
@@ -4971,6 +5053,7 @@ export namespace qso {
|
|||||||
band: string;
|
band: string;
|
||||||
class: string;
|
class: string;
|
||||||
status: string;
|
status: string;
|
||||||
|
call?: string;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
return new BandStatus(source);
|
return new BandStatus(source);
|
||||||
@@ -4981,6 +5064,7 @@ export namespace qso {
|
|||||||
this.band = source["band"];
|
this.band = source["band"];
|
||||||
this.class = source["class"];
|
this.class = source["class"];
|
||||||
this.status = source["status"];
|
this.status = source["status"];
|
||||||
|
this.call = source["call"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class Bucket {
|
export class Bucket {
|
||||||
@@ -5924,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 namespace webpub {
|
||||||
|
|
||||||
export class Config {
|
export class Config {
|
||||||
|
|||||||
@@ -674,6 +674,12 @@ type ScopeSweep struct {
|
|||||||
LowHz int64 `json:"low_hz"` // left edge frequency (0 when unknown)
|
LowHz int64 `json:"low_hz"` // left edge frequency (0 when unknown)
|
||||||
HighHz int64 `json:"high_hz"` // right edge frequency (0 when unknown)
|
HighHz int64 `json:"high_hz"` // right edge frequency (0 when unknown)
|
||||||
Fixed bool `json:"fixed"` // true = fixed-span mode, false = center-on-VFO
|
Fixed bool `json:"fixed"` // true = fixed-span mode, false = center-on-VFO
|
||||||
|
// Unsupported: this radio refuses the waveform-output command, so there will
|
||||||
|
// never be a sweep. The IC-7851 does — its last firmware is from 2016, older
|
||||||
|
// than the CI-V waveform stream — while still answering the scope's other
|
||||||
|
// commands. Reported so the panadapter can say so instead of showing a black
|
||||||
|
// rectangle that looks like a bug in OpsLog.
|
||||||
|
Unsupported bool `json:"unsupported"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// IcomState returns the current Icom DSP state, or (zero, false) when the active
|
// IcomState returns the current Icom DSP state, or (zero, false) when the active
|
||||||
|
|||||||
+70
-17
@@ -94,6 +94,9 @@ type IcomSerial struct {
|
|||||||
// reassembled sweep; scopeMu guards it (written by the scope goroutine, read
|
// reassembled sweep; scopeMu guards it (written by the scope goroutine, read
|
||||||
// via ScopeData from the binding goroutine).
|
// via ScopeData from the binding goroutine).
|
||||||
dualScope bool
|
dualScope bool
|
||||||
|
// Set when the rig rejects the waveform-output command in both shapes: it has
|
||||||
|
// no stream to give, and asking again on every enable is noise.
|
||||||
|
scopeUnsupported bool
|
||||||
scopeMu sync.Mutex
|
scopeMu sync.Mutex
|
||||||
scopeAmp []byte
|
scopeAmp []byte
|
||||||
scopeLow int64 // spectrum left-edge frequency (from the sweep's header frame)
|
scopeLow int64 // spectrum left-edge frequency (from the sweep's header frame)
|
||||||
@@ -848,6 +851,19 @@ func (b *IcomSerial) scopeLoop(spec chan civ.Decoded, done chan struct{}) {
|
|||||||
loggedCfg[f.Data[0]] = true
|
loggedCfg[f.Data[0]] = true
|
||||||
applog.Printf("icom scope cfg 0x%02X: data=[% X]", f.Data[0], f.Data)
|
applog.Printf("icom scope cfg 0x%02X: data=[% X]", f.Data[0], f.Data)
|
||||||
}
|
}
|
||||||
|
// The rig just told us its own layout: a mode/span/edge answer of
|
||||||
|
// three bytes or more carries the main/sub selector, one of two
|
||||||
|
// bytes does not. Worth reading, because the SET commands take the
|
||||||
|
// same shape and several firmwares answer a wrong-shaped set with
|
||||||
|
// silence rather than a rejection — which is not something the
|
||||||
|
// retry in execScope can act on.
|
||||||
|
if f.Data[0] == civ.SubScopeMode && len(f.Data) >= 2 {
|
||||||
|
if sel := len(f.Data) >= 3; sel != b.dualScope {
|
||||||
|
applog.Printf("icom scope: the rig answers 0x%02X with %d bytes — using the %s form",
|
||||||
|
f.Data[0], len(f.Data)-1, map[bool]string{true: "27 xx 00 …", false: "27 xx …"}[sel])
|
||||||
|
b.dualScope = sel
|
||||||
|
}
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if rawN < 24 {
|
if rawN < 24 {
|
||||||
@@ -982,6 +998,43 @@ func (b *IcomSerial) assembleSweep(regions map[byte][]byte, total byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// execScope sends a 0x27 SET and, if the rig rejects it, sends it once more in
|
||||||
|
// the other shape — with or without the leading main/sub selector byte — and
|
||||||
|
// remembers which one this rig speaks.
|
||||||
|
//
|
||||||
|
// The shape used to be decided from the CI-V address, which meant every new
|
||||||
|
// model was a blank scope until someone reported it: the IC-7851 (0x8E) rejects
|
||||||
|
// "27 11 01" outright and wants "27 11 00 01", exactly as the IC-7610 does not.
|
||||||
|
// A rejection is a cheap and unambiguous answer, so ask the rig instead of
|
||||||
|
// keeping a list. Only the SET commands need this — the waveform parser already
|
||||||
|
// detects the selector per frame.
|
||||||
|
func (b *IcomSerial) execScope(what string, sub byte, args ...byte) error {
|
||||||
|
try := func(sel bool) error {
|
||||||
|
p := []byte{civ.CmdScope, sub}
|
||||||
|
if sel {
|
||||||
|
p = append(p, 0x00) // main scope
|
||||||
|
}
|
||||||
|
return b.exec(append(p, args...)...)
|
||||||
|
}
|
||||||
|
err := try(b.dualScope)
|
||||||
|
// Only a REJECTION means "wrong shape". A timeout says nothing (several
|
||||||
|
// firmwares simply don't ack a 0x27 set), and retrying it in the other shape
|
||||||
|
// would flip a working rig onto the wrong one.
|
||||||
|
if err == nil || !strings.Contains(err.Error(), "rejected") {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err2 := try(!b.dualScope)
|
||||||
|
applog.Printf("icom scope: %s rejected in the %s form — the other form gave: %v",
|
||||||
|
what, map[bool]string{true: "27 xx 00 …", false: "27 xx …"}[b.dualScope], err2)
|
||||||
|
if err2 == nil {
|
||||||
|
b.dualScope = !b.dualScope
|
||||||
|
applog.Printf("icom scope: %s rejected — this rig wants the %s form (selector=%v)",
|
||||||
|
what, map[bool]string{true: "27 xx 00 …", false: "27 xx …"}[b.dualScope], b.dualScope)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// SetScope enables or disables the spectrum scope. Two commands are needed and
|
// SetScope enables or disables the spectrum scope. Two commands are needed and
|
||||||
// RS-BA1 sends both: 0x27 0x10 turns the scope DISPLAY on (without it the rig
|
// RS-BA1 sends both: 0x27 0x10 turns the scope DISPLAY on (without it the rig
|
||||||
// streams nothing — the case when we're remote and can't touch the front panel),
|
// streams nothing — the case when we're remote and can't touch the front panel),
|
||||||
@@ -1000,15 +1053,25 @@ func (b *IcomSerial) SetScope(on bool) error {
|
|||||||
// radio, and closing OpsLog (SetScope(false)) blanking a local IC-7300's
|
// radio, and closing OpsLog (SetScope(false)) blanking a local IC-7300's
|
||||||
// screen is exactly the regression this avoids. Some firmwares don't ack a
|
// screen is exactly the regression this avoids. Some firmwares don't ack a
|
||||||
// 0x27 set; a timeout isn't fatal, so log and continue.
|
// 0x27 set; a timeout isn't fatal, so log and continue.
|
||||||
if err := b.exec(civ.CmdScope, civ.SubScopeOnOff, 0x01); err != nil {
|
if err := b.execScope("display on", civ.SubScopeOnOff, 0x01); err != nil {
|
||||||
applog.Printf("icom scope: display on ack: %v", err)
|
applog.Printf("icom scope: display on ack: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Waveform data OUTPUT over CI-V: enabled with the scope, and — crucially —
|
// Waveform data OUTPUT over CI-V: enabled with the scope, and — crucially —
|
||||||
// the ONLY thing we switch off on disable, so the radio's own scope display is
|
// the ONLY thing we switch off on disable, so the radio's own scope display is
|
||||||
// left exactly as the operator had it.
|
// left exactly as the operator had it.
|
||||||
if err := b.exec(civ.CmdScope, civ.SubScopeOn, boolByte(on)); err != nil {
|
if err := b.execScope("data output", civ.SubScopeOn, boolByte(on)); err != nil {
|
||||||
applog.Printf("icom scope: output on=%v ack: %v", on, err)
|
applog.Printf("icom scope: output on=%v ack: %v", on, err)
|
||||||
|
// Rejected in both shapes = the command does not exist on this rig, which
|
||||||
|
// is a permanent answer and not a bad guess on our part. Remember it: the
|
||||||
|
// panel can then say so, and we stop asking a radio that has already
|
||||||
|
// said no.
|
||||||
|
if strings.Contains(err.Error(), "rejected") {
|
||||||
|
applog.Printf("icom scope: %s does not stream its scope over CI-V — control commands only", b.model)
|
||||||
|
b.scopeMu.Lock()
|
||||||
|
b.scopeUnsupported = true
|
||||||
|
b.scopeMu.Unlock()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
b.scopeMu.Lock()
|
b.scopeMu.Lock()
|
||||||
b.scopeOn = on
|
b.scopeOn = on
|
||||||
@@ -1041,13 +1104,7 @@ func (b *IcomSerial) scopeReadCfg() {
|
|||||||
// makes the scope follow the VFO, so tuning pans the view left/right.
|
// makes the scope follow the VFO, so tuning pans the view left/right.
|
||||||
func (b *IcomSerial) SetScopeMode(fixed bool) error {
|
func (b *IcomSerial) SetScopeMode(fixed bool) error {
|
||||||
mode := boolByte(fixed) // 0 = center, 1 = fixed (verify on rig via the cfg log)
|
mode := boolByte(fixed) // 0 = center, 1 = fixed (verify on rig via the cfg log)
|
||||||
var payload []byte
|
if err := b.execScope("set mode", civ.SubScopeMode, mode); err != nil {
|
||||||
if b.dualScope {
|
|
||||||
payload = []byte{civ.CmdScope, civ.SubScopeMode, 0x00, mode}
|
|
||||||
} else {
|
|
||||||
payload = []byte{civ.CmdScope, civ.SubScopeMode, mode}
|
|
||||||
}
|
|
||||||
if err := b.exec(payload...); err != nil {
|
|
||||||
applog.Printf("icom scope: set mode fixed=%v ack: %v", fixed, err)
|
applog.Printf("icom scope: set mode fixed=%v ack: %v", fixed, err)
|
||||||
}
|
}
|
||||||
b.scopeMu.Lock()
|
b.scopeMu.Lock()
|
||||||
@@ -1093,13 +1150,8 @@ func (b *IcomSerial) SetScopeEdges(low, high int64) error {
|
|||||||
if rangeID == 0 {
|
if rangeID == 0 {
|
||||||
return fmt.Errorf("icom scope: freq out of range")
|
return fmt.Errorf("icom scope: freq out of range")
|
||||||
}
|
}
|
||||||
if b.dualScope {
|
_ = b.execScope("fixed mode", civ.SubScopeMode, 0x01)
|
||||||
_ = b.exec(civ.CmdScope, civ.SubScopeMode, 0x00, 0x01) // fixed mode (main)
|
_ = b.execScope("edge set 1", civ.SubScopeEdge, 0x01)
|
||||||
_ = b.exec(civ.CmdScope, civ.SubScopeEdge, 0x00, 0x01) // activate edge set 1
|
|
||||||
} else {
|
|
||||||
_ = b.exec(civ.CmdScope, civ.SubScopeMode, 0x01)
|
|
||||||
_ = b.exec(civ.CmdScope, civ.SubScopeEdge, 0x01)
|
|
||||||
}
|
|
||||||
payload := append([]byte{civ.CmdScope, civ.SubScopeFixEdge, rangeID, 0x01}, civ.FreqToBCD(low)...)
|
payload := append([]byte{civ.CmdScope, civ.SubScopeFixEdge, rangeID, 0x01}, civ.FreqToBCD(low)...)
|
||||||
payload = append(payload, civ.FreqToBCD(high)...)
|
payload = append(payload, civ.FreqToBCD(high)...)
|
||||||
b.scopeMu.Lock()
|
b.scopeMu.Lock()
|
||||||
@@ -1263,7 +1315,8 @@ func (b *IcomSerial) ScopeData() ScopeSweep {
|
|||||||
for i, v := range b.scopeAmp {
|
for i, v := range b.scopeAmp {
|
||||||
amp[i] = int(v)
|
amp[i] = int(v)
|
||||||
}
|
}
|
||||||
return ScopeSweep{Amp: amp, Seq: b.scopeSeq, LowHz: b.scopeLow, HighHz: b.scopeHigh, Fixed: b.scopeFixed}
|
return ScopeSweep{Amp: amp, Seq: b.scopeSeq, LowHz: b.scopeLow, HighHz: b.scopeHigh, Fixed: b.scopeFixed,
|
||||||
|
Unsupported: b.scopeUnsupported}
|
||||||
}
|
}
|
||||||
|
|
||||||
// exec sends a set command and waits for the rig's OK (FB) / NG (FA) ack.
|
// exec sends a set command and waits for the rig's OK (FB) / NG (FA) ack.
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ type KenwoodTXState struct {
|
|||||||
Model string `json:"model,omitempty"`
|
Model string `json:"model,omitempty"`
|
||||||
Elecraft bool `json:"elecraft"` // a K3/K4 rather than a Kenwood
|
Elecraft bool `json:"elecraft"` // a K3/K4 rather than a Kenwood
|
||||||
Mode string `json:"mode,omitempty"`
|
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"`
|
Transmitting bool `json:"transmitting"`
|
||||||
Split bool `json:"split"`
|
Split bool `json:"split"`
|
||||||
@@ -107,10 +112,12 @@ type KenwoodPanelController interface {
|
|||||||
SetKenwoodRIT(bool) error
|
SetKenwoodRIT(bool) error
|
||||||
SetKenwoodXIT(bool) error
|
SetKenwoodXIT(bool) error
|
||||||
NudgeKenwoodRIT(int) error
|
NudgeKenwoodRIT(int) error
|
||||||
|
SetKenwoodRITOffset(int) error
|
||||||
ClearKenwoodRIT() error
|
ClearKenwoodRIT() error
|
||||||
SetKenwoodTX(bool) error
|
SetKenwoodTX(bool) error
|
||||||
TuneKenwoodATU() error
|
TuneKenwoodATU() error
|
||||||
ToggleKenwoodATU() error
|
ToggleKenwoodATU() error
|
||||||
|
SetKenwoodPanelMode(string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// kenwoodPanelSlowBeat is how many polls pass between full re-reads of the
|
// 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 {
|
if v, ok := k.askNum("NR;", "NR", 1); ok {
|
||||||
k.panel.NR = v != 0
|
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 {
|
if v, ok := k.askNum("GT;", "GT", 3); ok {
|
||||||
k.panel.AGC = kenwoodAGCName(v)
|
k.panel.AGC = kenwoodAGCName(v)
|
||||||
}
|
}
|
||||||
@@ -564,6 +579,16 @@ func (k *Kenwood) SetKenwoodXIT(on bool) error {
|
|||||||
|
|
||||||
// ClearKenwoodRIT zeroes the RIT/XIT offset, both at once — which is what RC
|
// ClearKenwoodRIT zeroes the RIT/XIT offset, both at once — which is what RC
|
||||||
// does and what the operator means by "clear it".
|
// 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 {
|
func (k *Kenwood) ClearKenwoodRIT() error {
|
||||||
return k.setPanel("RC;")
|
return k.setPanel("RC;")
|
||||||
}
|
}
|
||||||
@@ -650,3 +675,58 @@ func (k *Kenwood) askNum(cmd, prefix string, digits int) (int, bool) {
|
|||||||
}
|
}
|
||||||
return n, true
|
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
|
||||||
|
}
|
||||||
|
|||||||
+111
-6
@@ -27,6 +27,14 @@ type TCI struct {
|
|||||||
|
|
||||||
digitalDefault string // surfaced when the rig reports a digital mode (FT8/…)
|
digitalDefault string // surfaced when the rig reports a digital mode (FT8/…)
|
||||||
spotsEnabled bool // mirror cluster spots onto the TCI panorama
|
spotsEnabled bool // mirror cluster spots onto the TCI panorama
|
||||||
|
// wantFreq is the frequency last COMMANDED and not yet echoed back, used to
|
||||||
|
// pick the sideband before the radio has confirmed the move.
|
||||||
|
wantFreq int64
|
||||||
|
// What the server said it is, from its "protocol:" announcement.
|
||||||
|
serverName string
|
||||||
|
serverVersion string
|
||||||
|
// How many spots have been logged verbatim (the first few only).
|
||||||
|
spotsSent int
|
||||||
|
|
||||||
// OnSpotClick is called when the user clicks one of our spots on the TCI
|
// OnSpotClick is called when the user clicks one of our spots on the TCI
|
||||||
// panorama (callsign + freq), so the host can fill the entry form. Set before
|
// panorama (callsign + freq), so the host can fill the entry form. Set before
|
||||||
@@ -149,6 +157,15 @@ func (t *TCI) Connect() error {
|
|||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
debugLog.Printf("TCI: connected to %s", url)
|
debugLog.Printf("TCI: connected to %s", url)
|
||||||
go t.reader(conn)
|
go t.reader(conn)
|
||||||
|
// Ask for the meters. Nothing measures anything until this goes out: the
|
||||||
|
// S-meter, the transmit power and the SWR are all pushed by the radio, and
|
||||||
|
// only to a client that has subscribed. 200 ms is the rate the protocol's own
|
||||||
|
// examples use — fast enough for a needle, slow enough not to flood a socket
|
||||||
|
// that also carries audio.
|
||||||
|
if t.spotsEnabled {
|
||||||
|
debugLog.Printf("TCI: panorama spots are ON — spots will be sent to the radio")
|
||||||
|
}
|
||||||
|
t.subscribeSensors("connect")
|
||||||
if t.spotsEnabled {
|
if t.spotsEnabled {
|
||||||
// Forget what we thought was on the panorama at the same moment the radio
|
// 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
|
// is told to drop it. Kept, the memory would suppress the next spot for
|
||||||
@@ -228,11 +245,19 @@ func (t *TCI) SendSpot(s SpotInfo) error {
|
|||||||
// other two matching what already works here.
|
// other two matching what already works here.
|
||||||
_ = t.send(fmt.Sprintf("spot_delete:%s;", call))
|
_ = t.send(fmt.Sprintf("spot_delete:%s;", call))
|
||||||
}
|
}
|
||||||
// TCI's SPOT command wants the colour as a signed 32-bit DECIMAL integer in
|
// The colour is a DECIMAL ARGB integer, and an UNSIGNED one.
|
||||||
// 0xAARRGGBB order — NOT a "0x…" hex string (e.g. "spot:UN7GK,cw,14025000,
|
//
|
||||||
// -16776961,test;"). ExpertSDR silently drops a spot whose colour field it
|
// Expert Electronics' own protocol document gives the whole command:
|
||||||
// can't parse as a number, which is why spots never showed on the panorama
|
//
|
||||||
// while tuning (a separate command) still worked.
|
// SPOT:RN6LHF,CW,7100000,16711680,ANY_TEXT;
|
||||||
|
//
|
||||||
|
// 16711680 is 0x00FF0000 — positive, alpha zero. This backend was sending
|
||||||
|
// the same number as a SIGNED 32-bit value, taken from a third-party
|
||||||
|
// example: with the alpha byte set to FF for opacity, 0xFFFFA500 becomes
|
||||||
|
// -22336, and a spot whose colour field ExpertSDR cannot read is dropped in
|
||||||
|
// silence. Reported on ExpertSDR3 1.3 (which speaks TCI 2.x, so the version
|
||||||
|
// was never the problem): everything else worked and the panorama stayed
|
||||||
|
// empty.
|
||||||
hex := strings.TrimPrefix(strings.TrimPrefix(strings.TrimSpace(s.Color), "#"), "0x")
|
hex := strings.TrimPrefix(strings.TrimPrefix(strings.TrimSpace(s.Color), "#"), "0x")
|
||||||
if hex == "" {
|
if hex == "" {
|
||||||
hex = "FFFFA500" // opaque orange default
|
hex = "FFFFA500" // opaque orange default
|
||||||
@@ -253,7 +278,15 @@ func (t *TCI) SendSpot(s SpotInfo) error {
|
|||||||
}
|
}
|
||||||
// Commas/semicolons would break TCI's comma-separated argument parsing.
|
// Commas/semicolons would break TCI's comma-separated argument parsing.
|
||||||
text := strings.NewReplacer(",", " ", ";", " ").Replace(s.Comment)
|
text := strings.NewReplacer(",", " ", ";", " ").Replace(s.Comment)
|
||||||
return t.send(fmt.Sprintf("spot:%s,%s,%d,%d,%s;", call, mode, s.FreqHz, int32(argb), text))
|
cmd := fmt.Sprintf("spot:%s,%s,%d,%d,%s;", call, mode, s.FreqHz, argb, text)
|
||||||
|
// The first few, verbatim. A spot that the radio ignores leaves no trace at
|
||||||
|
// all — no reply, no error — so the only evidence that OpsLog sent one, and
|
||||||
|
// in what shape, is this line.
|
||||||
|
if n := t.spotsSent; n < 3 {
|
||||||
|
t.spotsSent = n + 1
|
||||||
|
debugLog.Printf("TCI: sending spot #%d: %s", n+1, strings.TrimSuffix(cmd, ";"))
|
||||||
|
}
|
||||||
|
return t.send(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect closes the WebSocket; the reader goroutine then exits.
|
// Disconnect closes the WebSocket; the reader goroutine then exits.
|
||||||
@@ -334,6 +367,11 @@ func (t *TCI) ReadState() (RigState, error) {
|
|||||||
|
|
||||||
// SetFrequency tunes VFO A (the main/RX VFO).
|
// SetFrequency tunes VFO A (the main/RX VFO).
|
||||||
func (t *TCI) SetFrequency(hz int64) error {
|
func (t *TCI) SetFrequency(hz int64) error {
|
||||||
|
// Remember what we ASKED for. SetMode reads it to choose the sideband, and
|
||||||
|
// the radio's own echo can be a moment behind — see SetMode.
|
||||||
|
t.mu.Lock()
|
||||||
|
t.wantFreq = hz
|
||||||
|
t.mu.Unlock()
|
||||||
return t.send(fmt.Sprintf("vfo:0,0,%d;", hz))
|
return t.send(fmt.Sprintf("vfo:0,0,%d;", hz))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,6 +380,17 @@ func (t *TCI) SetFrequency(hz int64) error {
|
|||||||
func (t *TCI) SetMode(mode string) error {
|
func (t *TCI) SetMode(mode string) error {
|
||||||
t.mu.Lock()
|
t.mu.Lock()
|
||||||
freq := t.freqA
|
freq := t.freqA
|
||||||
|
// Prefer the frequency we just COMMANDED over the one the radio has echoed.
|
||||||
|
//
|
||||||
|
// Clicking a spot sets the frequency and then the mode, and the sideband is
|
||||||
|
// chosen from the frequency (below 10 MHz → LSB). Read from the echo, that
|
||||||
|
// is the frequency we were on BEFORE the click whenever the echo has not
|
||||||
|
// landed yet: a 14 MHz spot clicked from 7 MHz got LSB, and clicking the same
|
||||||
|
// spot again — now that the echo has arrived — got USB. Reported from a
|
||||||
|
// SunSDR as "the frequency is right, the mode is wrong until I click twice".
|
||||||
|
if t.wantFreq > 0 {
|
||||||
|
freq = t.wantFreq
|
||||||
|
}
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
m := adifToTCIMode(mode, freq)
|
m := adifToTCIMode(mode, freq)
|
||||||
if m == "" {
|
if m == "" {
|
||||||
@@ -411,6 +460,24 @@ func (t *TCI) SetTXAudioSource(src string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send writes a command to the WebSocket (one writer at a time).
|
// 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 {
|
func (t *TCI) send(cmd string) error {
|
||||||
t.mu.Lock()
|
t.mu.Lock()
|
||||||
c := t.conn
|
c := t.conn
|
||||||
@@ -493,6 +560,18 @@ func (t *TCI) handle(msg string) {
|
|||||||
switch lower {
|
switch lower {
|
||||||
case "device":
|
case "device":
|
||||||
t.device = strings.TrimSpace(args)
|
t.device = strings.TrimSpace(args)
|
||||||
|
// The server's own announcement: "protocol:ExpertSDR3,1.9;" — its name and
|
||||||
|
// the TCI version it speaks. Worth keeping rather than filing under
|
||||||
|
// "unhandled": panorama spots need a version that HAS the spot command, and
|
||||||
|
// without this an operator on an older ExpertSDR sees nothing on the
|
||||||
|
// waterfall and nothing anywhere saying why.
|
||||||
|
case "protocol":
|
||||||
|
t.serverName, t.serverVersion = get(0), get(1)
|
||||||
|
debugLog.Printf("TCI: server is %s, TCI %s", t.serverName, t.serverVersion)
|
||||||
|
if t.spotsEnabled && tciSpotsUnsupported(t.serverVersion) {
|
||||||
|
debugLog.Printf("TCI: this server speaks TCI %s — panorama spots need 1.5 or later, so they will not appear",
|
||||||
|
t.serverVersion)
|
||||||
|
}
|
||||||
// The radio ANNOUNCES its audio format at connect —
|
// The radio ANNOUNCES its audio format at connect —
|
||||||
// "audio_stream_sample_type:float32" and "audio_stream_channels:2" — which
|
// "audio_stream_sample_type:float32" and "audio_stream_channels:2" — which
|
||||||
// is better evidence than anything derived from a frame, and it arrives
|
// is better evidence than anything derived from a frame, and it arrives
|
||||||
@@ -505,6 +584,13 @@ func (t *TCI) handle(msg string) {
|
|||||||
}
|
}
|
||||||
case "ready", "start":
|
case "ready", "start":
|
||||||
t.ready = true
|
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":
|
case "stop":
|
||||||
t.ready = false
|
t.ready = false
|
||||||
case "vfo":
|
case "vfo":
|
||||||
@@ -516,6 +602,10 @@ func (t *TCI) handle(msg string) {
|
|||||||
switch get(1) {
|
switch get(1) {
|
||||||
case "0":
|
case "0":
|
||||||
t.freqA = hz
|
t.freqA = hz
|
||||||
|
// The radio has caught up: from here the echo IS the truth.
|
||||||
|
if t.wantFreq != 0 && absInt64(hz-t.wantFreq) < 100 {
|
||||||
|
t.wantFreq = 0
|
||||||
|
}
|
||||||
case "1":
|
case "1":
|
||||||
t.freqB = hz
|
t.freqB = hz
|
||||||
}
|
}
|
||||||
@@ -651,3 +741,18 @@ func adifToTCIMode(mode string, freqHz int64) string {
|
|||||||
return "digu"
|
return "digu"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tciSpotsUnsupported reports whether a TCI version predates the spot commands.
|
||||||
|
//
|
||||||
|
// SPOT / SPOT_DELETE / SPOT_CLEAR arrived in TCI 1.5. An older ExpertSDR accepts
|
||||||
|
// the connection, answers frequency and mode perfectly, and silently ignores
|
||||||
|
// every spot — which is indistinguishable from a bug in the logger unless
|
||||||
|
// somebody says so. Anything unparseable is treated as supported: refusing to
|
||||||
|
// draw on a doubt would be the worse mistake.
|
||||||
|
func tciSpotsUnsupported(version string) bool {
|
||||||
|
var maj, min int
|
||||||
|
if n, err := fmt.Sscanf(strings.TrimSpace(version), "%d.%d", &maj, &min); n < 2 || err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return maj < 1 || (maj == 1 && min < 5)
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package cat
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CW keying over TCI — a sixth CW engine, so a SunSDR needs no WinKeyer and no
|
||||||
|
// second serial port: the radio's own macro keyer is driven over the WebSocket
|
||||||
|
// that already carries the CAT.
|
||||||
|
//
|
||||||
|
// The commands, from the TCI command table (confirmed against ars-ka0s/eesdr-tci,
|
||||||
|
// the same source that settled SPOT):
|
||||||
|
//
|
||||||
|
// CW_MACROS:<trx>,<text>; send text through the radio's keyer
|
||||||
|
// CW_MACROS_SPEED:<wpm>; the speed those macros are keyed at
|
||||||
|
// CW_MACROS_STOP; abort what is being keyed
|
||||||
|
// CW_MACROS_EMPTY; the radio saying the buffer has run dry
|
||||||
|
//
|
||||||
|
// CW_MSG (TCI 2.0) does the same with separate before/after callsign fields.
|
||||||
|
// CW_MACROS is used instead because it exists from 1.6 and OpsLog resolves the
|
||||||
|
// variables itself — the text handed here is already what should go on the air.
|
||||||
|
//
|
||||||
|
// Notably absent: there is no backspace. The FlexRadio CWX keyer can un-type
|
||||||
|
// what has not been sent yet; TCI can only stop. So the type-ahead correction
|
||||||
|
// the Flex engine offers is not offered here rather than faked.
|
||||||
|
|
||||||
|
// tciCWTextLimit caps one macro. A runaway paste down a WebSocket that also
|
||||||
|
// carries audio is worth refusing, and no real CW message is this long.
|
||||||
|
const tciCWTextLimit = 512
|
||||||
|
|
||||||
|
// SendCW keys a message through the radio's macro keyer.
|
||||||
|
func (t *TCI) SendCW(text string) error {
|
||||||
|
msg := sanitiseTCICW(text)
|
||||||
|
if msg == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return t.send(fmt.Sprintf("cw_macros:0,%s;", msg))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StopCW aborts the message being keyed.
|
||||||
|
func (t *TCI) StopCW() error { return t.send("cw_macros_stop;") }
|
||||||
|
|
||||||
|
// SetCWSpeed sets the macro keyer speed in words per minute.
|
||||||
|
//
|
||||||
|
// Only the MACRO speed: the paddle keyer has its own (CW_KEYER_SPEED) and an
|
||||||
|
// operator who has set their paddle to 28 wpm did not ask the logger to change
|
||||||
|
// it because a macro went out at 25.
|
||||||
|
func (t *TCI) SetCWSpeed(wpm int) error {
|
||||||
|
if wpm < 5 {
|
||||||
|
wpm = 5
|
||||||
|
}
|
||||||
|
if wpm > 60 {
|
||||||
|
wpm = 60
|
||||||
|
}
|
||||||
|
return t.send(fmt.Sprintf("cw_macros_speed:%d;", wpm))
|
||||||
|
}
|
||||||
|
|
||||||
|
// sanitiseTCICW makes a message safe to put in a TCI command.
|
||||||
|
//
|
||||||
|
// Commas and semicolons are the protocol's own separators — a comma inside the
|
||||||
|
// text would be read as another argument and a semicolon would end the command
|
||||||
|
// early, keying half a message and leaving the rest to be parsed as a command of
|
||||||
|
// its own. Neither belongs in Morse anyway.
|
||||||
|
func sanitiseTCICW(text string) string {
|
||||||
|
s := strings.ToUpper(strings.TrimSpace(text))
|
||||||
|
s = strings.NewReplacer(",", " ", ";", " ", "\r", " ", "\n", " ").Replace(s)
|
||||||
|
if len(s) > tciCWTextLimit {
|
||||||
|
s = s[:tciCWTextLimit]
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(s)
|
||||||
|
}
|
||||||
@@ -96,3 +96,26 @@ func (m *Manager) TCIPanelDo(fn func(TCIPanelController) error) error {
|
|||||||
return fn(tc)
|
return fn(tc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TCICWController is the radio's CW keyer, as the CW engine uses it.
|
||||||
|
//
|
||||||
|
// Three methods, and no backspace: TCI can stop a message but cannot un-type one
|
||||||
|
// (see tci_cw.go). Kept as its own interface rather than folded into the console
|
||||||
|
// one so a CW engine does not have to depend on forty panel setters to key a
|
||||||
|
// message.
|
||||||
|
type TCICWController interface {
|
||||||
|
SendCW(text string) error
|
||||||
|
StopCW() error
|
||||||
|
SetCWSpeed(wpm int) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// TCICWDo dispatches one keyer command onto the CAT goroutine.
|
||||||
|
func (m *Manager) TCICWDo(fn func(TCICWController) error) error {
|
||||||
|
return m.exec(func(b Backend) error {
|
||||||
|
tc, ok := b.(TCICWController)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("the active CAT backend is not a TCI radio")
|
||||||
|
}
|
||||||
|
return fn(tc)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
// it. What the radio actually announces after the command settles whether
|
||||||
// this is our reading or its doing, and no amount of reasoning will.
|
// this is our reading or its doing, and no amount of reasoning will.
|
||||||
switch name {
|
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
|
// 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,
|
// showed the transmit meters being asked for and nothing coming back,
|
||||||
// which on its own proves nothing — a reply that arrived and failed to
|
// which on its own proves nothing — a reply that arrived and failed to
|
||||||
@@ -233,6 +234,42 @@ func (t *TCI) handlePanel(name string, get func(int) string, args string) bool {
|
|||||||
if n, ok := num(get(1)); ok && forRX0() {
|
if n, ok := num(get(1)); ok && forRX0() {
|
||||||
p.SMeter = n
|
p.SMeter = n
|
||||||
}
|
}
|
||||||
|
// The meters of ExpertSDR3. The S-meter used to be read only from RX_SMETER
|
||||||
|
// and the transmit ones from TX_POWER / TX_SWR — commands this radio simply
|
||||||
|
// never sends, which is why the console's meters sat empty on a SunSDR in
|
||||||
|
// both RX and TX while everything else worked.
|
||||||
|
//
|
||||||
|
// The protocol's own answer (TCI Protocol.pdf, §4.4) is a SUBSCRIPTION:
|
||||||
|
//
|
||||||
|
// RX_SENSORS:<rx>,<dBm>; (deprecated in 2.0)
|
||||||
|
// RX_CHANNEL_SENSORS:<rx>,<channel>,<dBm>; (its replacement)
|
||||||
|
// TX_SENSORS:<trx>,<mic dBm>,<power W>,<peak W>,<SWR>;
|
||||||
|
//
|
||||||
|
// none of which arrives until the client asks with RX_SENSORS_ENABLE and
|
||||||
|
// TX_SENSORS_ENABLE — see Connect.
|
||||||
|
case "rx_sensors":
|
||||||
|
if v, err := strconv.ParseFloat(strings.TrimSpace(get(1)), 64); err == nil && forRX0() {
|
||||||
|
p.SMeter = int(v)
|
||||||
|
}
|
||||||
|
case "rx_channel_sensors":
|
||||||
|
// Main channel (A) of receiver 0: the one the console is showing.
|
||||||
|
if v, err := strconv.ParseFloat(strings.TrimSpace(get(2)), 64); err == nil &&
|
||||||
|
get(0) == "0" && get(1) == "0" {
|
||||||
|
p.SMeter = int(v)
|
||||||
|
}
|
||||||
|
case "tx_sensors":
|
||||||
|
if get(0) != "0" {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// arg3 is RMS power, arg4 the peak. The peak is what a power meter's
|
||||||
|
// needle does on speech; the RMS is what the operator is asked to keep
|
||||||
|
// under the amplifier's limit — so RMS is the number, as elsewhere.
|
||||||
|
if v, err := strconv.ParseFloat(strings.TrimSpace(get(2)), 64); err == nil {
|
||||||
|
p.TXPowerW = v
|
||||||
|
}
|
||||||
|
if v, err := strconv.ParseFloat(strings.TrimSpace(get(4)), 64); err == nil {
|
||||||
|
p.TXSWR = v
|
||||||
|
}
|
||||||
case "tune":
|
case "tune":
|
||||||
if forRX0() {
|
if forRX0() {
|
||||||
p.Tuning = yes(get(1))
|
p.Tuning = yes(get(1))
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package cat
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestTCISpotsUnsupported(t *testing.T) {
|
||||||
|
// SPOT arrived in TCI 1.5. The SunSDR2 PRO report that prompted this was an
|
||||||
|
// ExpertSDR announcing 1.3 — spots accepted and silently dropped.
|
||||||
|
for _, c := range []struct {
|
||||||
|
version string
|
||||||
|
old bool
|
||||||
|
}{
|
||||||
|
{"1.3", true},
|
||||||
|
{"1.4", true},
|
||||||
|
{"1.5", false},
|
||||||
|
{"1.9", false},
|
||||||
|
{"2.0", false},
|
||||||
|
{"", false}, // unparseable → assume it works
|
||||||
|
{"weird", false}, // refusing to draw on a doubt is the worse mistake
|
||||||
|
} {
|
||||||
|
if got := tciSpotsUnsupported(c.version); got != c.old {
|
||||||
|
t.Errorf("tciSpotsUnsupported(%q) = %v, want %v", c.version, got, c.old)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSanitiseTCICW(t *testing.T) {
|
||||||
|
// The separators must never survive: a comma would become another argument
|
||||||
|
// and a semicolon would end the command with the message half sent.
|
||||||
|
for _, c := range []struct{ in, want string }{
|
||||||
|
{"cq cq de f4bpo", "CQ CQ DE F4BPO"},
|
||||||
|
{" tu 599 ", "TU 599"},
|
||||||
|
{"73, gl", "73 GL"},
|
||||||
|
{"test;cw_macros_stop", "TEST CW_MACROS_STOP"},
|
||||||
|
{"line\r\nbreak", "LINE BREAK"},
|
||||||
|
{" ", ""},
|
||||||
|
} {
|
||||||
|
if got := sanitiseTCICW(c.in); got != c.want {
|
||||||
|
t.Errorf("sanitiseTCICW(%q) = %q, want %q", c.in, got, c.want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,6 +75,10 @@ type Spot struct {
|
|||||||
Historical bool `json:"historical,omitempty"`
|
Historical bool `json:"historical,omitempty"`
|
||||||
POTARef string `json:"pota_ref,omitempty"` // park id if this station is activating (api.pota.app)
|
POTARef string `json:"pota_ref,omitempty"` // park id if this station is activating (api.pota.app)
|
||||||
POTAName string `json:"pota_name,omitempty"` // park name
|
POTAName string `json:"pota_name,omitempty"` // park name
|
||||||
|
// SOTARef comes from the COMMENT, not from an API: the SOTA clusters put the
|
||||||
|
// summit in the text of the spot they send ("W9/WI-001"), and there is no
|
||||||
|
// per-callsign endpoint to ask the way POTA has one.
|
||||||
|
SOTARef string `json:"sota_ref,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// State enumerates the per-server lifecycle.
|
// State enumerates the per-server lifecycle.
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package cluster
|
||||||
|
|
||||||
|
import "regexp"
|
||||||
|
|
||||||
|
// sotaRefRe matches a SOTA summit reference inside a spot comment.
|
||||||
|
//
|
||||||
|
// The shape is association/region-NNN — "W9/WI-001", "DM/BM-063", "VK3/VC-014",
|
||||||
|
// "F/AM-123" — and the association may carry digits. Anchored on both sides so
|
||||||
|
// a callsign like DL/SP9DPM/P can never be read as one, and deliberately
|
||||||
|
// narrower than "anything with a slash and a dash": POTA (US-4475) and WWFF
|
||||||
|
// (DLFF-0001) refs share the comment field and must not be caught here.
|
||||||
|
var sotaRefRe = regexp.MustCompile(`\b([A-Z0-9]{1,4}(?:/[A-Z0-9]{1,4})?/[A-Z]{2}-[0-9]{3})\b`)
|
||||||
|
|
||||||
|
// SOTARefFrom returns the first SOTA reference in a spot comment, or "".
|
||||||
|
func SOTARefFrom(comment string) string {
|
||||||
|
m := sotaRefRe.FindStringSubmatch(comment)
|
||||||
|
if m == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return m[1]
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package cluster
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestSOTARefFrom(t *testing.T) {
|
||||||
|
// Left column: real comments seen on the SOTA cluster feed.
|
||||||
|
cases := []struct{ in, want string }{
|
||||||
|
{"W9/WI-001", "W9/WI-001"},
|
||||||
|
{"DM/BM-063", "DM/BM-063"},
|
||||||
|
{"W7Y/TT-122", "W7Y/TT-122"},
|
||||||
|
{"VK3/VC-014 s2s", "VK3/VC-014"},
|
||||||
|
{"[SOTA] F/AM-123 cq", "F/AM-123"},
|
||||||
|
{"", ""},
|
||||||
|
// The other reference schemes that share this field.
|
||||||
|
{"POTA US-4475", ""},
|
||||||
|
{"WWFF DLFF-0001", ""},
|
||||||
|
// A portable callsign is not a summit.
|
||||||
|
{"DL/SP9DPM/P calling", ""},
|
||||||
|
}
|
||||||
|
for _, c := range cases {
|
||||||
|
if got := SOTARefFrom(c.in); got != c.want {
|
||||||
|
t.Errorf("SOTARefFrom(%q) = %q, want %q", c.in, got, c.want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
-2
@@ -5,6 +5,7 @@ package email
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wneessen/go-mail"
|
"github.com/wneessen/go-mail"
|
||||||
@@ -86,12 +87,42 @@ func SendFiles(cfg Config, to, subject, body string, attachPaths []string) error
|
|||||||
return fmt.Errorf("smtp client: %w", err)
|
return fmt.Errorf("smtp client: %w", err)
|
||||||
}
|
}
|
||||||
if err := client.DialAndSend(m); err != nil {
|
if err := client.DialAndSend(m); err != nil {
|
||||||
return fmt.Errorf("send via %s:%d (%s, %s): %w",
|
return fmt.Errorf("send via %s:%d (%s, %s): %w%s",
|
||||||
cfg.Host, cfg.Port, cfg.Encryption, describeSize(attachPaths), err)
|
cfg.Host, cfg.Port, cfg.Encryption, describeSize(attachPaths), err, explainSMTP(err))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// explainSMTP turns a server's refusal into the thing to go and do.
|
||||||
|
//
|
||||||
|
// A rejection is quoted verbatim above it — the server's own words are the
|
||||||
|
// evidence — but several of them name a policy rather than a mistake, and no
|
||||||
|
// amount of re-checking the password will fix those. Microsoft's is the one
|
||||||
|
// operators keep hitting: basic authentication for SMTP is switched off across
|
||||||
|
// Microsoft 365 and outlook.com, and an app password does not bring it back.
|
||||||
|
func explainSMTP(err error) string {
|
||||||
|
msg := strings.ToLower(err.Error())
|
||||||
|
switch {
|
||||||
|
case strings.Contains(msg, "basic authentication is disabled"),
|
||||||
|
strings.Contains(msg, "5.7.139"):
|
||||||
|
return "\n\nMicrosoft has switched off password-based SMTP for this account. " +
|
||||||
|
"An app password does not restore it — the server refuses the password itself, not the one you typed. " +
|
||||||
|
"On a Microsoft 365 tenant an administrator can re-enable it for this mailbox " +
|
||||||
|
"(Set-CASMailbox -SmtpClientAuthenticationDisabled $false, plus the tenant-wide setting); " +
|
||||||
|
"otherwise use another provider for alerts (a Gmail account with an app password works, so does any ordinary IMAP/SMTP host)."
|
||||||
|
case strings.Contains(msg, "application-specific password"),
|
||||||
|
strings.Contains(msg, "5.7.9"):
|
||||||
|
return "\n\nThis account needs an APP PASSWORD rather than the one you sign in with " +
|
||||||
|
"(Google, Yahoo and others require it once two-factor authentication is on)."
|
||||||
|
case strings.Contains(msg, "5.7.8"), strings.Contains(msg, "authentication failed"),
|
||||||
|
strings.Contains(msg, "535"):
|
||||||
|
return "\n\nThe server rejected the username or the password."
|
||||||
|
case strings.Contains(msg, "must issue a starttls"):
|
||||||
|
return "\n\nThe server requires encryption: set STARTTLS (usually port 587) or SSL (465)."
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// describeSize reports what was attached, in bytes.
|
// describeSize reports what was attached, in bytes.
|
||||||
//
|
//
|
||||||
// "An existing connection was forcibly closed" during DATA is the same message
|
// "An existing connection was forcibly closed" during DATA is the same message
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package email
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestExplainSMTP(t *testing.T) {
|
||||||
|
// The real refusal, from an operator's Outlook account.
|
||||||
|
outlook := errors.New("SMTP AUTH failed: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled.")
|
||||||
|
if got := explainSMTP(outlook); !strings.Contains(got, "Microsoft has switched off") {
|
||||||
|
t.Errorf("the Microsoft policy refusal is not explained: %q", got)
|
||||||
|
}
|
||||||
|
// A plain wrong password must NOT claim a policy: the advice would send the
|
||||||
|
// operator to an administrator over a typo.
|
||||||
|
wrong := errors.New("535 5.7.8 authentication failed")
|
||||||
|
got := explainSMTP(wrong)
|
||||||
|
if strings.Contains(got, "Microsoft") {
|
||||||
|
t.Errorf("a wrong password was explained as a Microsoft policy: %q", got)
|
||||||
|
}
|
||||||
|
if !strings.Contains(got, "rejected the username") {
|
||||||
|
t.Errorf("a wrong password is not explained: %q", got)
|
||||||
|
}
|
||||||
|
// Anything else is left to speak for itself.
|
||||||
|
if got := explainSMTP(errors.New("dial tcp: i/o timeout")); got != "" {
|
||||||
|
t.Errorf("an unrelated error got an explanation: %q", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
+161
-8
@@ -12,6 +12,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -20,6 +21,67 @@ import (
|
|||||||
// document of the user's QSOs (optionally only confirmed ones).
|
// document of the user's QSOs (optionally only confirmed ones).
|
||||||
const lotwReportURL = "https://lotw.arrl.org/lotwuser/lotwreport.adi"
|
const lotwReportURL = "https://lotw.arrl.org/lotwuser/lotwreport.adi"
|
||||||
|
|
||||||
|
const (
|
||||||
|
// How long LoTW may take to START answering. It builds the whole report
|
||||||
|
// before sending anything, so this is the slow part of a big account.
|
||||||
|
lotwHeaderTimeout = 10 * time.Minute
|
||||||
|
// How long the transfer may stall once it HAS started. A download that has
|
||||||
|
// not moved in this long is not slow, it is dead — and saying so beats a
|
||||||
|
// progress window that sits at "working" until someone gives up.
|
||||||
|
lotwIdleTimeout = 2 * time.Minute
|
||||||
|
lotwMaxBytes = 256 * 1024 * 1024
|
||||||
|
)
|
||||||
|
|
||||||
|
// readWithProgress reads the body in chunks, reporting the running total and
|
||||||
|
// failing fast on a stall.
|
||||||
|
//
|
||||||
|
// Reported as it arrives rather than at the end: an 18 MB report over a slow
|
||||||
|
// link is minutes of silence otherwise, which is indistinguishable from a hang —
|
||||||
|
// and that is exactly what operators were reporting.
|
||||||
|
func say(note func(string), msg string) {
|
||||||
|
if note != nil {
|
||||||
|
note(msg)
|
||||||
|
}
|
||||||
|
LogSink("%s", msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
func readWithProgress(ctx context.Context, r io.Reader, note func(string)) ([]byte, error) {
|
||||||
|
var (
|
||||||
|
out []byte
|
||||||
|
total int64
|
||||||
|
last = time.Now()
|
||||||
|
buf = make([]byte, 64*1024)
|
||||||
|
next = int64(256 * 1024) // first report early — proof it is moving
|
||||||
|
)
|
||||||
|
for {
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
n, err := r.Read(buf)
|
||||||
|
if n > 0 {
|
||||||
|
out = append(out, buf[:n]...)
|
||||||
|
total += int64(n)
|
||||||
|
last = time.Now()
|
||||||
|
if total >= next {
|
||||||
|
say(note, fmt.Sprintf(" … %.1f MB received", float64(total)/(1024*1024)))
|
||||||
|
next = total + 512*1024
|
||||||
|
}
|
||||||
|
if total >= lotwMaxBytes {
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err == io.EOF {
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if time.Since(last) > lotwIdleTimeout {
|
||||||
|
return nil, fmt.Errorf("the transfer stalled after %d KB — LoTW stopped sending", total/1024)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// DownloadLoTWConfirmations fetches confirmed QSOs from LoTW as ADIF text.
|
// DownloadLoTWConfirmations fetches confirmed QSOs from LoTW as ADIF text.
|
||||||
// Uses the LoTW *website* login (Username/Password), not the TQSL cert. When
|
// Uses the LoTW *website* login (Username/Password), not the TQSL cert. When
|
||||||
// since is non-empty (YYYY-MM-DD) only confirmations received since then are
|
// since is non-empty (YYYY-MM-DD) only confirmations received since then are
|
||||||
@@ -27,7 +89,7 @@ const lotwReportURL = "https://lotw.arrl.org/lotwuser/lotwreport.adi"
|
|||||||
// non-empty, only confirmations for that station callsign are returned (an
|
// non-empty, only confirmations for that station callsign are returned (an
|
||||||
// LoTW account holds every call you operate — F4BPO, F4BPO/P, TM2Q — so this
|
// LoTW account holds every call you operate — F4BPO, F4BPO/P, TM2Q — so this
|
||||||
// scopes the pull to the active profile's call).
|
// scopes the pull to the active profile's call).
|
||||||
func DownloadLoTWConfirmations(ctx context.Context, client *http.Client, cfg ServiceConfig, since, ownCall string) (string, error) {
|
func DownloadLoTWConfirmations(ctx context.Context, client *http.Client, cfg ServiceConfig, since, ownCall string, detail bool, note func(string)) (string, error) {
|
||||||
user := strings.TrimSpace(cfg.Username)
|
user := strings.TrimSpace(cfg.Username)
|
||||||
if user == "" || cfg.Password == "" {
|
if user == "" || cfg.Password == "" {
|
||||||
return "", fmt.Errorf("lotw: website login (username/password) not set")
|
return "", fmt.Errorf("lotw: website login (username/password) not set")
|
||||||
@@ -37,27 +99,118 @@ func DownloadLoTWConfirmations(ctx context.Context, client *http.Client, cfg Ser
|
|||||||
q.Set("password", cfg.Password)
|
q.Set("password", cfg.Password)
|
||||||
q.Set("qso_query", "1")
|
q.Set("qso_query", "1")
|
||||||
q.Set("qso_qsl", "yes") // only QSLed (confirmed) records
|
q.Set("qso_qsl", "yes") // only QSLed (confirmed) records
|
||||||
q.Set("qso_qsldetail", "yes") // include QSL_RCVD / QSLRDATE detail
|
// qso_qsldetail is what LoTW charges for: it adds the QSL date and the
|
||||||
|
// station's own DXCC / grid / state / county to every record, and takes an
|
||||||
|
// order of magnitude longer to build — a report that arrives in two minutes
|
||||||
|
// without it takes twenty with it, measured on the same account.
|
||||||
|
//
|
||||||
|
// What we actually need to mark a confirmation is call, date, band and mode.
|
||||||
|
// The rest is worth its price only when the download is also ADDING the QSOs
|
||||||
|
// it cannot find, which is the one case where the extra fields are the only
|
||||||
|
// source for them.
|
||||||
|
if detail {
|
||||||
|
q.Set("qso_qsldetail", "yes")
|
||||||
|
}
|
||||||
if c := strings.TrimSpace(ownCall); c != "" {
|
if c := strings.TrimSpace(ownCall); c != "" {
|
||||||
q.Set("qso_owncall", c) // restrict to this station callsign
|
q.Set("qso_owncall", c) // restrict to this station callsign
|
||||||
}
|
}
|
||||||
if s := strings.TrimSpace(since); s != "" {
|
// qso_qslsince is ALWAYS sent, even for "everything".
|
||||||
q.Set("qso_qslsince", s)
|
//
|
||||||
|
// Left out, LoTW does not answer "all confirmations" — it answers with a
|
||||||
|
// handful of recent ones, which arrives as a 200 and a valid ADIF and reads
|
||||||
|
// as a successful download of a nearly empty account. Asking from a date
|
||||||
|
// older than the service itself is the only way to mean "all".
|
||||||
|
sinceDate := strings.TrimSpace(since)
|
||||||
|
if sinceDate == "" {
|
||||||
|
sinceDate = "1945-11-15" // older than any QSO LoTW will accept
|
||||||
}
|
}
|
||||||
|
q.Set("qso_qslsince", sinceDate)
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, lotwReportURL+"?"+q.Encode(), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, lotwReportURL+"?"+q.Encode(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("lotw: build request: %w", err)
|
return "", fmt.Errorf("lotw: build request: %w", err)
|
||||||
}
|
}
|
||||||
|
// Named, because LoTW's front end throttles unidentified clients harder than
|
||||||
|
// it throttles known ones, and an operator reporting a 503 deserves a request
|
||||||
|
// that says who is asking.
|
||||||
|
req.Header.Set("User-Agent", "OpsLog")
|
||||||
if client == nil {
|
if client == nil {
|
||||||
client = &http.Client{Timeout: 120 * time.Second}
|
// NO overall deadline. A full account is tens of megabytes and LoTW spends
|
||||||
|
// minutes building it before the first byte; a total timeout turns a slow
|
||||||
|
// but healthy download into "context deadline exceeded", and a longer one
|
||||||
|
// turns a dead connection into a window that says "working" for twenty
|
||||||
|
// minutes. What matters is not how long it takes but whether it is still
|
||||||
|
// moving — see the idle watchdog below.
|
||||||
|
client = &http.Client{
|
||||||
|
Transport: &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
|
ResponseHeaderTimeout: lotwHeaderTimeout,
|
||||||
|
TLSHandshakeTimeout: 30 * time.Second,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// LoTW answers 503 when it is busy, which for a report covering more than a
|
||||||
|
// few days is often — other loggers get the same answer and simply ask
|
||||||
|
// again. Three tries, spaced, and each one said out loud: an operator whose
|
||||||
|
// download takes four minutes because the ARRL is loaded should be able to
|
||||||
|
// see that rather than guess it.
|
||||||
|
// LoTW sends nothing at all until the whole report is built — minutes for a
|
||||||
|
// large account. That silence was the entire complaint: a window saying
|
||||||
|
// "working" with no way to tell a busy server from a dead one. Count it out
|
||||||
|
// loud until the first byte.
|
||||||
|
beat := make(chan struct{})
|
||||||
|
go func() {
|
||||||
|
start := time.Now()
|
||||||
|
tick := time.NewTicker(15 * time.Second)
|
||||||
|
defer tick.Stop()
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-beat:
|
||||||
|
return
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case <-tick.C:
|
||||||
|
say(note, fmt.Sprintf(" … still waiting for LoTW to build the report (%.0f s)", time.Since(start).Seconds()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
// Stopped where the WAIT ends, not where the function does: deferred, the
|
||||||
|
// heartbeat went on counting between the megabyte lines and read as if the
|
||||||
|
// report were still being built while it was already arriving.
|
||||||
|
stopBeat := sync.OnceFunc(func() { close(beat) })
|
||||||
|
defer stopBeat()
|
||||||
|
|
||||||
|
var resp *http.Response
|
||||||
|
for attempt := 1; ; attempt++ {
|
||||||
|
resp, err = client.Do(req) //nolint:bodyclose // closed below or in the retry
|
||||||
|
if err == nil && resp.StatusCode != http.StatusServiceUnavailable &&
|
||||||
|
resp.StatusCode != http.StatusBadGateway && resp.StatusCode != http.StatusGatewayTimeout {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if attempt >= 3 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
wait := time.Duration(attempt*20) * time.Second
|
||||||
|
if resp != nil {
|
||||||
|
say(note, fmt.Sprintf("LoTW is busy (HTTP %d) — asking again in %s…", resp.StatusCode, wait))
|
||||||
|
resp.Body.Close()
|
||||||
|
} else {
|
||||||
|
say(note, fmt.Sprintf("LoTW did not answer (%v) — asking again in %s…", err, wait))
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return "", ctx.Err()
|
||||||
|
case <-time.After(wait):
|
||||||
|
}
|
||||||
|
req = req.Clone(ctx)
|
||||||
}
|
}
|
||||||
resp, err := client.Do(req)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("lotw: request failed: %w", err)
|
return "", fmt.Errorf("lotw: request failed: %w", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
body, err := io.ReadAll(io.LimitReader(resp.Body, 32*1024*1024))
|
stopBeat()
|
||||||
|
say(note, fmt.Sprintf("LoTW answered (HTTP %d) — receiving…", resp.StatusCode))
|
||||||
|
body, err := readWithProgress(ctx, resp.Body, note)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("lotw: read response: %w", err)
|
return "", fmt.Errorf("lotw: read response: %w", err)
|
||||||
}
|
}
|
||||||
@@ -365,7 +518,7 @@ func TestLoTW(cfg ServiceConfig, stationDataPath string) (string, error) {
|
|||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
if _, err := DownloadLoTWConfirmations(ctx, nil, cfg, "2099-01-01", ""); err != nil {
|
if _, err := DownloadLoTWConfirmations(ctx, nil, cfg, "2099-01-01", "", false, nil); err != nil {
|
||||||
return "", fmt.Errorf("%s — but the DOWNLOAD login failed: %w", up, err)
|
return "", fmt.Errorf("%s — but the DOWNLOAD login failed: %w", up, err)
|
||||||
}
|
}
|
||||||
return up + ". Download login accepted.", nil
|
return up + ". Download login accepted.", nil
|
||||||
|
|||||||
+130
-3
@@ -868,6 +868,44 @@ var bulkEditableCols = map[string]bool{
|
|||||||
|
|
||||||
// BulkSetField sets one whitelisted column to value on every listed QSO in a
|
// BulkSetField sets one whitelisted column to value on every listed QSO in a
|
||||||
// single statement. value "" clears the field. Returns rows affected.
|
// 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) {
|
func (r *Repo) BulkSetField(ctx context.Context, ids []int64, column, value string) (int64, error) {
|
||||||
if !bulkEditableCols[column] {
|
if !bulkEditableCols[column] {
|
||||||
return 0, fmt.Errorf("field %q is not bulk-editable", column)
|
return 0, fmt.Errorf("field %q is not bulk-editable", column)
|
||||||
@@ -1901,10 +1939,24 @@ type WorkedBefore struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BandStatus is one cell in the worked-before grid.
|
// BandStatus is one cell in the worked-before grid.
|
||||||
|
//
|
||||||
|
// Status is the single highest thing true of the cell, which is what colours
|
||||||
|
// it. Call is the SAME cell's answer to a different question — "have I worked
|
||||||
|
// THIS callsign here" — kept separately because the two are asked at the same
|
||||||
|
// moment and one was hiding the other.
|
||||||
|
//
|
||||||
|
// Chasing an expedition, an operator needs both: whether the slot is still
|
||||||
|
// missing for the entity (does this fill a DXCC hole) and whether this
|
||||||
|
// expedition has already been worked on it (would this be a dupe). A confirmed
|
||||||
|
// entity outranks a worked callsign in Status — correctly, for awards — so a
|
||||||
|
// slot worked with the DX yesterday can read "entity confirmed" and say nothing
|
||||||
|
// at all about yesterday.
|
||||||
type BandStatus struct {
|
type BandStatus struct {
|
||||||
Band string `json:"band"` // ADIF lowercase band, e.g. "20m"
|
Band string `json:"band"` // ADIF lowercase band, e.g. "20m"
|
||||||
Class string `json:"class"` // "PH" | "CW" | "DIG"
|
Class string `json:"class"` // "PH" | "CW" | "DIG"
|
||||||
Status string `json:"status"` // "call_c" | "call_w" | "dxcc_c" | "dxcc_w"
|
Status string `json:"status"` // "call_c" | "call_w" | "dxcc_c" | "dxcc_w"
|
||||||
|
// Call is "", "w" (worked with this callsign) or "c" (confirmed with it).
|
||||||
|
Call string `json:"call,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Band-status codes, lowest first. The ORDER is the rule: a cell shows the
|
// Band-status codes, lowest first. The ORDER is the rule: a cell shows the
|
||||||
@@ -1951,6 +2003,39 @@ func bandStatusCode(callWorked, callConfirmed, entityConfirmed bool) int {
|
|||||||
|
|
||||||
// modeClass collapses ADIF modes into the three buckets DXers care about.
|
// modeClass collapses ADIF modes into the three buckets DXers care about.
|
||||||
// Anything not voice and not CW is treated as digital.
|
// 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 {
|
func modeClass(mode string) string {
|
||||||
switch strings.ToUpper(mode) {
|
switch strings.ToUpper(mode) {
|
||||||
case "SSB", "USB", "LSB", "AM", "FM", "DIGITALVOICE", "PHONE":
|
case "SSB", "USB", "LSB", "AM", "FM", "DIGITALVOICE", "PHONE":
|
||||||
@@ -2222,13 +2307,17 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
|
|||||||
// The grid answers "what do I still need on this band and mode", and for
|
// The grid answers "what do I still need on this band and mode", and for
|
||||||
// that question confirmation is the axis that matters: a confirmed entity
|
// that question confirmation is the axis that matters: a confirmed entity
|
||||||
// needs nothing, whoever else was worked afterwards.
|
// needs nothing, whoever else was worked afterwards.
|
||||||
|
// The two per-callsign columns use the SAME predicate as the callsign count
|
||||||
|
// above, portable variants included: a cell that counts RI1FJL/1 in "worked
|
||||||
|
// with this call" and a header that does not would be two answers to one
|
||||||
|
// question.
|
||||||
// Filter NULL/empty band+mode rows — they'd create a NULL group key
|
// Filter NULL/empty band+mode rows — they'd create a NULL group key
|
||||||
// that Scan into *string can't handle and would error out the whole
|
// that Scan into *string can't handle and would error out the whole
|
||||||
// WorkedBefore call, blanking the matrix in the UI.
|
// WorkedBefore call, blanking the matrix in the UI.
|
||||||
statusRows, err := r.db.QueryContext(ctx, `
|
statusRows, err := r.db.QueryContext(ctx, `
|
||||||
SELECT band, mode,
|
SELECT band, mode,
|
||||||
MAX(CASE WHEN callsign = ? THEN 1 ELSE 0 END),
|
MAX(CASE WHEN `+pred+` THEN 1 ELSE 0 END),
|
||||||
MAX(CASE WHEN callsign = ?
|
MAX(CASE WHEN `+pred+`
|
||||||
AND (lotw_rcvd IN `+ConfirmedValues+` OR qsl_rcvd IN `+ConfirmedValues+` OR eqsl_rcvd IN `+ConfirmedValues+`)
|
AND (lotw_rcvd IN `+ConfirmedValues+` OR qsl_rcvd IN `+ConfirmedValues+` OR eqsl_rcvd IN `+ConfirmedValues+`)
|
||||||
THEN 1 ELSE 0 END),
|
THEN 1 ELSE 0 END),
|
||||||
MAX(CASE WHEN lotw_rcvd IN `+ConfirmedValues+` OR qsl_rcvd IN `+ConfirmedValues+` OR eqsl_rcvd IN `+ConfirmedValues+`
|
MAX(CASE WHEN lotw_rcvd IN `+ConfirmedValues+` OR qsl_rcvd IN `+ConfirmedValues+` OR eqsl_rcvd IN `+ConfirmedValues+`
|
||||||
@@ -2237,12 +2326,14 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
|
|||||||
WHERE dxcc = ?
|
WHERE dxcc = ?
|
||||||
AND band IS NOT NULL AND band != ''
|
AND band IS NOT NULL AND band != ''
|
||||||
AND mode IS NOT NULL AND mode != ''
|
AND mode IS NOT NULL AND mode != ''
|
||||||
GROUP BY band, mode`, wb.Callsign, wb.Callsign, dxcc)
|
GROUP BY band, mode`, append(append(append([]any{}, predArgs...), predArgs...), dxcc)...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return wb, fmt.Errorf("band status: %w", err)
|
return wb, fmt.Errorf("band status: %w", err)
|
||||||
}
|
}
|
||||||
type cellKey struct{ band, class string }
|
type cellKey struct{ band, class string }
|
||||||
best := map[cellKey]int{}
|
best := map[cellKey]int{}
|
||||||
|
// The call's own answer per cell, independent of the ladder above.
|
||||||
|
callByCell := map[cellKey]string{}
|
||||||
for statusRows.Next() {
|
for statusRows.Next() {
|
||||||
var band, mode string
|
var band, mode string
|
||||||
var callW, callC, dxccConfirmed int
|
var callW, callC, dxccConfirmed int
|
||||||
@@ -2255,12 +2346,21 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
|
|||||||
if cur, ok := best[k]; !ok || code > cur {
|
if cur, ok := best[k]; !ok || code > cur {
|
||||||
best[k] = code
|
best[k] = code
|
||||||
}
|
}
|
||||||
|
// Confirmed beats worked here too, and neither is ever erased by the
|
||||||
|
// entity: this is only ever about the callsign.
|
||||||
|
switch {
|
||||||
|
case callC == 1:
|
||||||
|
callByCell[k] = "c"
|
||||||
|
case callW == 1 && callByCell[k] == "":
|
||||||
|
callByCell[k] = "w"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
statusRows.Close()
|
statusRows.Close()
|
||||||
codeStr := bandStatusNames
|
codeStr := bandStatusNames
|
||||||
for k, code := range best {
|
for k, code := range best {
|
||||||
wb.BandStatus = append(wb.BandStatus, BandStatus{
|
wb.BandStatus = append(wb.BandStatus, BandStatus{
|
||||||
Band: k.band, Class: k.class, Status: codeStr[code],
|
Band: k.band, Class: k.class, Status: codeStr[code],
|
||||||
|
Call: callByCell[k],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return wb, nil
|
return wb, nil
|
||||||
@@ -2955,6 +3055,33 @@ func DedupeKey(callsign, qsoDateMinute, band, mode string) string {
|
|||||||
return strings.ToUpper(callsign) + "|" + qsoDateMinute + "|" + strings.ToLower(band) + "|" + strings.ToUpper(mode)
|
return strings.ToUpper(callsign) + "|" + qsoDateMinute + "|" + strings.ToLower(band) + "|" + strings.ToUpper(mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StationCallsigns lists the distinct station callsigns the logbook was worked
|
||||||
|
// under, upper-cased and without the blanks.
|
||||||
|
//
|
||||||
|
// Used to decide whether a downloaded confirmation belongs to THIS log at all:
|
||||||
|
// one LoTW account can hold several stations (a home call, a portable, an
|
||||||
|
// expedition), and a confirmation for a station this logbook has never used is
|
||||||
|
// somebody else's log — here, another profile's.
|
||||||
|
func (r *Repo) StationCallsigns(ctx context.Context) (map[string]bool, error) {
|
||||||
|
rows, err := r.db.QueryContext(ctx,
|
||||||
|
`SELECT DISTINCT COALESCE(station_callsign,'') FROM qso`)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
out := map[string]bool{}
|
||||||
|
for rows.Next() {
|
||||||
|
var c string
|
||||||
|
if err := rows.Scan(&c); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if c = strings.ToUpper(strings.TrimSpace(c)); c != "" {
|
||||||
|
out[c] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out, rows.Err()
|
||||||
|
}
|
||||||
|
|
||||||
// DedupeKeyIDs returns a map of dedupe key → QSO id, for matching downloaded
|
// DedupeKeyIDs returns a map of dedupe key → QSO id, for matching downloaded
|
||||||
// confirmations back to local QSOs.
|
// confirmations back to local QSOs.
|
||||||
func (r *Repo) DedupeKeyIDs(ctx context.Context) (map[string]int64, error) {
|
func (r *Repo) DedupeKeyIDs(ctx context.Context) (map[string]int64, error) {
|
||||||
|
|||||||
@@ -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 (
|
const (
|
||||||
// appVersion is stamped on every heartbeat (and could feed the About box).
|
// appVersion is stamped on every heartbeat (and could feed the About box).
|
||||||
appVersion = "0.26.18"
|
appVersion = "0.27.0"
|
||||||
|
|
||||||
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
|
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
|
||||||
// to https://us.i.posthog.com for a US project.
|
// to https://us.i.posthog.com for a US project.
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
// Placing a window at an absolute desktop coordinate is Windows-specific; every
|
||||||
|
// caller falls back to the toolkit's own call when this says no.
|
||||||
|
func setWindowPosAbsolute(x, y int) bool { return false }
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"hamlog/internal/applog"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Moving the window to an ABSOLUTE virtual-desktop position.
|
||||||
|
//
|
||||||
|
// Wails' own WindowSetPosition cannot do it. Its Windows implementation reads:
|
||||||
|
//
|
||||||
|
// func (cba *ControlBase) SetPos(x, y int) {
|
||||||
|
// info := getMonitorInfo(cba.hwnd)
|
||||||
|
// w32.SetWindowPos(cba.hwnd, HWND_TOP, int(info.RcWork.Left)+x, int(info.RcWork.Top)+y, ...)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// — the coordinates are relative to the CURRENT monitor's work area, while
|
||||||
|
// WindowGetPosition returns GetWindowRect, which is absolute. Saving one and
|
||||||
|
// restoring the other is only harmless on the primary monitor, where the work
|
||||||
|
// area starts at 0.
|
||||||
|
//
|
||||||
|
// On a second monitor to the LEFT it compounds at every launch. Reported from a
|
||||||
|
// two-screen station with the left monitor at x = -3840: OpsLog saved -3844,
|
||||||
|
// reopened on that monitor, added the monitor's own origin, and stored -7684 —
|
||||||
|
// then -11524, each launch one screen further into nowhere.
|
||||||
|
//
|
||||||
|
// So we place the window ourselves. Same call the toolkit makes, without the
|
||||||
|
// offset.
|
||||||
|
const (
|
||||||
|
swpNoSize = 0x0001
|
||||||
|
swpNoZOrder = 0x0004
|
||||||
|
swpNoActivate = 0x0010
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
procSetWindowPos = user32Dll.NewProc("SetWindowPos")
|
||||||
|
procEnumWindows = user32Dll.NewProc("EnumWindows")
|
||||||
|
procGetWindowThreadProcessID = user32Dll.NewProc("GetWindowThreadProcessId")
|
||||||
|
procGetWindowTextLengthW = user32Dll.NewProc("GetWindowTextLengthW")
|
||||||
|
procGetWindow = user32Dll.NewProc("GetWindow")
|
||||||
|
kernel32Dll = syscall.NewLazyDLL("kernel32.dll")
|
||||||
|
procGetCurrentProcessIDWinPos = kernel32Dll.NewProc("GetCurrentProcessId")
|
||||||
|
)
|
||||||
|
|
||||||
|
// mainWindowHandle finds this process's own top-level window.
|
||||||
|
//
|
||||||
|
// Wails does not expose the handle, so it is looked up: the first top-level
|
||||||
|
// window belonging to this process id that has no owner and a title. The window
|
||||||
|
// is created hidden (StartHidden), and EnumWindows lists hidden windows too,
|
||||||
|
// which is what makes this usable before the window is shown.
|
||||||
|
func mainWindowHandle() uintptr {
|
||||||
|
self, _, _ := procGetCurrentProcessIDWinPos.Call()
|
||||||
|
var found uintptr
|
||||||
|
cb := syscall.NewCallback(func(hwnd uintptr, _ uintptr) uintptr {
|
||||||
|
var pid uint32
|
||||||
|
procGetWindowThreadProcessID.Call(hwnd, uintptr(unsafe.Pointer(&pid)))
|
||||||
|
if uintptr(pid) != self {
|
||||||
|
return 1 // keep going
|
||||||
|
}
|
||||||
|
// GW_OWNER = 4: skip tool windows and dialogs owned by the main one.
|
||||||
|
if owner, _, _ := procGetWindow.Call(hwnd, 4); owner != 0 {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
if n, _, _ := procGetWindowTextLengthW.Call(hwnd); n == 0 {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
found = hwnd
|
||||||
|
return 0 // stop
|
||||||
|
})
|
||||||
|
procEnumWindows.Call(cb, 0)
|
||||||
|
return found
|
||||||
|
}
|
||||||
|
|
||||||
|
// setWindowPosAbsolute moves the window to a virtual-desktop coordinate.
|
||||||
|
// Reports whether it could; the caller falls back to the toolkit's own call.
|
||||||
|
func setWindowPosAbsolute(x, y int) bool {
|
||||||
|
hwnd := mainWindowHandle()
|
||||||
|
if hwnd == 0 {
|
||||||
|
applog.Printf("window: could not find our own window handle — falling back to the toolkit's placement")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
r, _, err := procSetWindowPos.Call(hwnd, 0, uintptr(int32(x)), uintptr(int32(y)), 0, 0,
|
||||||
|
swpNoSize|swpNoZOrder|swpNoActivate)
|
||||||
|
if r == 0 {
|
||||||
|
applog.Printf("window: SetWindowPos(%d,%d) failed: %v", x, y, err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user