Compare commits

..
36 Commits
Author SHA1 Message Date
rouggy b24f880d62 chore: release v0.26.21 2026-08-28 08:48:14 +02:00
rouggy ef71ddb648 docs(changelog): open 0.26.21 with the entries written after the release
Miles and the LoTW download progress landed after v0.26.20 was tagged, so they
belonged to the next block: an entry appended to a shipped one never reaches the
operators who installed it, and misstates what that version contained. The .20
block is byte-identical to the tag again.
2026-08-28 08:47:00 +02:00
rouggy 0143a84cee fix(lotw): stop the heartbeat when the report starts arriving
Deferred, it stopped at the end of the function — so 'still waiting for LoTW to
build the report' kept printing between the megabyte lines, saying the opposite
of what was happening.
2026-08-28 08:43:06 +02:00
rouggy 82721110ed fix(lotw): count out the wait before the first byte
The progress lines only start once bytes arrive, and on a large account nothing
arrives for minutes — LoTW builds the entire report before sending any of it.
That silence WAS the complaint: the window still just said 'working'.

A heartbeat every fifteen seconds until the headers land, then the HTTP status,
then the megabytes — the first at 256 KB rather than 1 MB, so the very first
sign that it is moving comes early.
2026-08-28 08:38:34 +02:00
rouggy aec363b152 fix(lotw): show the download moving, retry a busy server, fail a dead one
Three reports of the same shape: a 503 for anything wider than a few days
before, and since the timeout was raised, a window that sits at 'working'
forever. Both are the same missing thing — nothing said what the transfer was
doing.

The body is now read in chunks and every megabyte is reported. A 503/502/504 is
retried twice, 20 s then 40 s, each attempt announced: LoTW answers 'busy' to a
wide report often enough that other loggers simply ask again. And the deadline
is no longer on the whole exchange, which either cut off a healthy slow download
or hid a dead one for twenty minutes — it is ten minutes to START answering
(LoTW builds the whole report first) and two minutes of silence once it has,
which is the difference between slow and dead.
2026-08-28 08:29:26 +02:00
rouggy 9a21c936b1 feat(units): show distances in miles
Everything is computed in kilometres and converted once at display time, in
lib/units — storing miles anywhere would give the same number two sources of
truth and a rounding error that grows with every hop.

The grids capture the unit inside their column definitions, header and formatter
both, so a change is published to them the way the date format already is;
without that a toggle would only appear after a language change or a restart.
The preference is portable, like the other display ones.
2026-08-28 08:25:02 +02:00
rouggy d8f0fd7b4f chore: release v0.26.20 2026-08-27 23:47:14 +02:00
rouggy 4a942a04c3 docs(changelog): name the SOTA cluster server in the SOTA entry 2026-08-27 23:27:26 +02:00
rouggy ecae68ca79 merge: matrix call mark, Icom scope, KPA chip, SOTA column, awards slots, LoTW download fixes 2026-08-27 23:24:34 +02:00
rouggy 9270b227b0 fix(lotw): send a date even for 'all', and give the report time to arrive
Without qso_qslsince LoTW does not answer 'every confirmation' — it answers
with a few recent ones, as a 200 and a valid ADIF. 'All' therefore downloaded a
nearly empty report and said 'matched 1 of 1' on an account holding twelve
thousand. It now asks from 1945-11-15, older than any QSO LoTW accepts.

And the request had two minutes: LoTW spends several of them building a full
account before the first byte, so asking for everything ended in 'context
deadline exceeded while reading body' — a network-shaped message for a
too-short deadline. Twenty minutes, and the read cap raised past the 18 MB such
a report actually weighs.
2026-08-27 23:15:54 +02:00
rouggy cff590fe8a fix(lotw): keep another station's confirmations out, and show a suspect report
Unscoped, the report carries every station on the account — including the calls
belonging to another profile's logbook. Those match nothing here, and with 'add
the ones not found' ticked they would pour a second log into this one. The
station callsigns this logbook actually holds are now the filter: a portable
worked here is kept, an expedition call never used here is skipped and counted.

A near-empty report is also the failure that reads as success — 'matched 1 of 1'
where the account holds twelve thousand. Under 4 KB, what LoTW answered is shown
verbatim instead.
2026-08-27 23:12:44 +02:00
rouggy 4366083152 feat(lotw): let the download cover every callsign on the account
The download passes qso_owncall so one profile does not pull another's
confirmations. That scope also hides them: a QSO made as F4BPO/P is confirmed at
LoTW and can never come back to an F4BPO profile, so it stays unconfirmed here
for good while the ARRL counts it — found while reconciling a DXCC account
against the panel, where it was the whole of the CW gap (Jersey, worked as
F4BPO/P).

Off by default: the scope is right for anyone whose profiles are separate
stations.
2026-08-27 22:43:46 +02:00
rouggy 8865af35fd feat(qsl): a QRZ button beside the paper-QSL search 2026-08-27 21:53:59 +02:00
rouggy bfad51268b style(awards): fade the confirmed cells while chasing the ones to confirm
The filter keeps a REFERENCE for its unconfirmed slots, so its confirmed ones
come along — and green on grey means the answer is the quietest thing in the
row. Faded to a quarter under that filter only, not hidden: which band is
already done is part of deciding which one to chase.
2026-08-27 21:45:46 +02:00
rouggy 0e77e8d61f feat(awards): find the slots worked but not confirmed
The Challenge line says 1832 worked against 1554 confirmed and stops there —
278 band-slots waiting for a card with nothing pointing at them. Every existing
filter works per REFERENCE, so an entity confirmed on 20 m answers 'confirmed'
and its unconfirmed 15 m contact stays invisible.

The new filter keeps the references holding at least one such slot, and the
count beside the reference total is the gap itself, recomputed over whatever the
other filters left on screen and over the bands actually displayed — so it
always adds up to the columns in front of the operator.
2026-08-27 21:38:25 +02:00
rouggy 08d316b1e0 feat(cluster): a SOTA column, and a spot click that credits the summit
The SOTA feeds put the summit in the spot's own text, so there is nothing to
poll: a regex on the comment gives the reference, and clicking the spot writes
SOTA@<ref> into the award references the way a park already wrote POTA@<ref>.

The regex is narrow on purpose — association/region-NNN, anchored — because
POTA (US-4475), WWFF (DLFF-0001) and portable callsigns (DL/SP9DPM/P) share
that field and none of them is a summit. Pinned by a table test.

Off by default: the reference is only there on the summit feeds, and an empty
column for every operator who does not chase them is worse than a checkbox.
2026-08-27 21:33:17 +02:00
rouggy b8796369ba fix(amp): the KPA was missing from the status-bar chip
The chip read a.spe ?? a.acom ?? a.pgxl, so a KPA fell through to the
not-connected fallback: red on a working amplifier, and a click that opened the
settings instead of switching to STANDBY. Reported from a KPA500 whose panel
showed band, SWR and temperature at the same time.

The card's offline text also borrowed the Acom's string, so a KPA that dropped
its link announced itself as an Acom.
2026-08-27 18:55:55 +02:00
rouggy fa1c41388d fix(icom): say when a radio has no scope stream instead of drawing nothing
The CI-V trace settles it: the IC-7851 answers 27 10 01 with FB and 27 14 00
with its mode, but refuses 27 11 in BOTH shapes — it controls its scope over
CI-V and never streams it. Its last firmware is from 2016, older than the
waveform stream itself; Hamlib's caps claim otherwise, the radio is the
authority.

Rejected both ways is a permanent answer, so it is remembered and reported:
the panadapter says the radio does not send its scope, which is the one thing a
black rectangle could not say.
2026-08-27 16:30:39 +02:00
rouggy d2cfad490a revert(icom): keep 0x27 0x11 as the scope data switch, log what the retry got
Hamlib documents the spectrum scope on the IC-785x, so a rejected 0x27 0x11 is
not proof the command is missing — and taking 0x27 0x10 for the data switch
would have blanked that operator's own scope screen when OpsLog disabled it.

Both shapes were refused within 96 ms, so neither was a timeout, and guessing
the next subcommand is how the last two rounds went. The retry now logs the
second attempt's own error and the failure points at the CI-V trace.
2026-08-27 16:25:29 +02:00
rouggy 69d78ba8c0 fix(icom): fall back to 0x27 0x10 when a rig has no 0x27 0x11
The IC-7851 rejects 0x27 0x11 in BOTH shapes: on that radio 0x27 0x10 is the
waveform-output switch itself, not a display switch. Rejected both ways, take
0x10 as the output command and switch it off on disable too — there it stops a
stream rather than blanking the operator's own scope screen.

A mode/span/edge answer also settles the selector question directly: three bytes
or more means the rig wants the main/sub form. Worth reading, because a
wrong-shaped SET is answered with silence on this firmware, and a timeout is
something the rejection retry cannot act on — which is why the fixed/centre
sets were timing out.
2026-08-27 16:18:55 +02:00
rouggy 9cf1984fb2 fix(icom): ask the radio which shape its scope commands take
The IC-7851 rejects "27 11 01" and wants "27 11 00 01" — the main/sub selector
its two scopes need. The shape was picked from a list of CI-V addresses, so an
address not on it got the wrong one and the scope stayed blank with a rejection
in the log and nothing on screen.

A rejection is an unambiguous answer, so a rejected 0x27 set is now re-sent in
the other shape and the winner remembered. A TIMEOUT deliberately is not
retried: several firmwares never ack a 0x27 set, and treating silence as a
wrong guess would flip a rig that was already working.
2026-08-27 16:14:53 +02:00
rouggy ee8fd32bf7 fix(matrix): dot the portable variants too
The header counts QSOs with the callsign through callMatch — RI1FJL/1 and
ZA/RI1FJL included — while the grid's own per-callsign columns matched the bare
string. A cell could hold one of the QSOs the header had counted and show
nothing.
2026-08-27 15:57:41 +02:00
rouggy f357dad629 feat(appearance): give the worked-with-this-call dot its own two colours
The dot is drawn over all five cell backgrounds, so it cannot borrow one of
their colours; it defaults to the theme foreground with a background ring and
now takes two overrides of its own, worked and confirmed, alongside the rest of
the matrix palette.
2026-08-27 15:29:01 +02:00
rouggy b3547364d4 style(matrix): move the worked-with-this-call dot in from the corner 2026-08-27 09:01:31 +02:00
rouggy 965ed4c792 feat(matrix): mark the slots already worked with the callsign in hand
The worked-before cell answered one question with two facts fused into it.
bandStatusCode takes the highest of them, so a confirmed entity outranks a
worked callsign — right for awards, wrong while chasing: a slot worked with the
DXpedition this morning reads "entity confirmed" and says nothing about it.

BandStatus now carries the callsign's own answer alongside the entity's, and the
cell draws a dot for it. The dot is deliberately identical everywhere — same
shape, same colour, over all five backgrounds — so it is read as one thing
rather than as five variants of the colour underneath it.
2026-08-27 08:55:37 +02:00
rouggy 32dbfbd04e chore(changelog): open 0.26.20 with the per-radio MY_RIG 2026-08-27 01:09:09 +02:00
rouggy a930a4f02d merge: MY_RIG follows the connected radio
Operating conditions describe a plan; a logged QSO asks which radio was
keying. With one rig those were the same answer, with several they are
not — so each saved radio carries its own MY_RIG, ahead of the per-band
station and doing nothing at all when left empty.
2026-08-27 01:08:19 +02:00
rouggy f98a831195 feat(cat): MY_RIG follows the radio that is connected
With one rig, MY_RIG belonged in Operating conditions and nowhere else.
With several, that becomes the wrong place: operating conditions describe
a PLAN — 'on 20 m I use the beam and the 7300' — while the question a
logged QSO asks is which radio was keying.

So each saved radio carries its own MY_RIG, consulted BEFORE the per-band
station. When the two disagree — a second rig borrowed for one evening on
20 m — the one that is transmitting is the true answer.

Left empty it changes nothing at all: the old chain (band default, then
the profile's rig) answers exactly as it did, which is what every
single-radio station will keep doing without touching a setting.
2026-08-27 01:03:27 +02:00
rouggy 9d21af9f7c chore: release v0.26.19 2026-08-27 00:55:38 +02:00
rouggy 0680181016 chore: drop a stray temp file committed by accident
theirs.tmp was scratch from comparing the GitHub readme against ours. It
had no business in the repository and none in a release.
2026-08-27 00:47:37 +02:00
rouggy afd0714301 chore(changelog): open 0.26.19 with the multi-radio switch 2026-08-27 00:47:28 +02:00
rouggy 8855eaf05a merge: several radios, switched from the status bar
The answer to 'I have two rigs' was 'make two profiles', which moves the
whole station — logbook included — to change which radio is connected.
Radios are a list now, like amplifiers, and the CAT chip switches between
them while everything else stays put.

The active radio still lives in the settings keys the rest of OpsLog
reads, so the consoles, the CAT sharing and the band-follow needed no
change at all.
2026-08-27 00:46:18 +02:00
rouggy 2594697e00 fix(cat): the chip says what YOU called the radio
It showed what the radio calls itself over CAT — 'Kenwood (911)' for a K3,
a bare 'CAT' for a Flex that reports nothing useful. That is the answer to
a question nobody asks once the rig has a name in the list, and it made
the two radios look alike in the one place they have to be told apart.

The name the operator typed comes first now, on the chip and in the menu,
and falls back to the radio's own identity when they typed none. The model
identity is still in the tooltip, where it answers 'what is actually
connected' without taking the place of 'which of my rigs is this'.
2026-08-27 00:42:26 +02:00
rouggy cf5efea3e4 fix(cat): the chip opens the radio menu with one radio too
It only became a menu from two radios, on the reasoning that a single
radio has nothing to switch to. That hides the feature from precisely the
operator who has not made a second radio yet — the click lands on a
settings dialog they did not ask for, which is what happened on the first
try. With one radio the menu now shows that radio and 'Add a radio…'.

Right-click still goes straight to the CAT settings.
2026-08-27 00:32:00 +02:00
rouggy 4689505fb9 feat(cat): several radios, switched from the status bar
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 — so switching one to change
which radio is connected takes all of that with it, including a change of
logbook when the profiles point at different databases.

Radios are a list now, the way amplifiers already are. The CAT chip in the
status bar opens it, one click connects the chosen rig, and nothing else
about the station moves.

The storage keeps the ACTIVE radio in the same settings keys everything
already reads (cat.backend, cat.icom_port, …), and switching writes the
chosen entry into them and reloads the link. So the consoles, the CAT
sharing, the band-follow and every panel see exactly what they saw before
and needed no change at all — the list is a second store beside the
configuration, not a replacement for it.

Details that matter more than they look:
  - An operator who has run one rig for a year opens the list and finds it
    there, because a missing list reads as the CURRENT settings rather
    than as nothing. It is written on the first save, not on the first
    read.
  - Editing the CAT panel updates the active entry, or an edit made before
    switching away would be lost on the way back.
  - A new radio starts as a COPY of the current one: a second rig is
    usually the same shape with one port changed, and an empty form is a
    form to fill in twice.
  - Switching saves the panel first, so edits to the radio being left
    behind are kept.
  - The chip only becomes a menu with more than one radio; with one it
    opens the CAT settings exactly as it always did.
2026-08-27 00:22:19 +02:00
rouggy 23f425f95f docs(readme): restore it, and bring it up to date
THE README WAS GONE. A commit of mine last night replaced OpsLog's readme
with the text of the TCI protocol specification — 322 lines of ours for 77
of Expert Electronics' — and nobody noticed because nothing builds from
it. Restored from the commit before, then updated.

What it was missing, all of it shipped since: the Kenwood/Elecraft and
Yaesu CAT backends and their consoles, the SunSDR console, TCI audio in
both directions, CAT sharing over Hamlib rigctl or TCI, the Elecraft
KPA500/KPA1500 and the Tuner Genius XL, Cloudlog and HAMLOG uploads, the
RDA district work, the DXCC Challenge, the editable satellite list, four
main-view panes instead of two, and Esri basemaps in place of Carto.

Also a section on importing a log, which had none — including the rule
that matters most to somebody moving years of contacts across: a deleted
DXCC entity keeps the number the file gives it, because cty.dat only knows
where a callsign is today.
2026-08-26 23:38:35 +02:00
35 changed files with 1727 additions and 178 deletions
+398 -61
View File
@@ -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
synchronization between transceiver/receiver, contest loggers, digital mode software, skimmers
and other software, as well as external power amplifiers, bandpass filter units, antenna switches,
radio controllers and other devices.
A modern, fast ham-radio logger for Windows — single-strip entry, real-time CAT
for **OmniRig**, native **FlexRadio/SmartSDR**, native **Icom CI-V** (USB **and**
remote-over-internet, replacing RS-BA1) and **TCI** (SunSDR / Expert Electronics),
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
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.).
Developed by **F4BPO**.
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
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.
## Building / developing
Our company advocates universal unification of data exchange between devices and
software by creating the TCI interface for this purpose. Modern transceivers and software must
communicate using one protocol - the TCI protocol.
- **Dev:** `wails dev` (Vite hot-reload; Go methods reachable at http://localhost:34115).
- **Build:** `wails build` (use the project's wails v2.11 — `~/go/bin/wails.exe`).
- **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
arguments corresponding to this command. There are reserved characters that cannot be
included in the command name and command arguments.
## Logging
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:
1. Name of the command;
2. Separating character between command name and arguments «:»;
3. Separating character between arguments «,»;
4. End of the command character «;».
## Maps & antenna
If a command has no arguments, an end of command symbol is placed after the command
name. If the command is invalid, it is ignored. The case of letters does not matter.
- **Main view = two configurable panes** (per profile, Settings → General →
*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
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.
## DX Cluster
When a parameter change occurs in the ExpertSDR3 (server) program, the server notifies
all connected clients, i.e., clients do not need to poll the server constantly, any change of state
will be sent in time to all clients. If the client sends a new state, the server will set it to itself, as
well as send it to all clients, that is, the server acts as a synchronizer. All clients connected to the
server will be automatically synchronized. This way of work allows to minimize network load,
reducing traffic.
- Multiple cluster servers with auto-reconnect, a master for commands.
- **Filter sidebar** (callsign search, hide-worked, group duplicates, band /
mode / status / source) shared by the Cluster tab and the Main-view cluster
pane, with a show/hide toggle.
- Per-spot **status** (new / new-band / new-slot / worked), click-to-tune the
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
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.
## CAT control
TCI is also used to transmit audio signals of the receiver to clients and to receive audio
signals from clients, i.e., the client can transmit audio signals to ExpertSDR3 for radio
transmission. The audio stream exchange is designed to work with digital modes, where encoding
and decoding is performed by third-party software, as well as in voice modes, where audio macros
can be broadcasted, which is very much in demand in contest loggers.
Six native backends (Settings → CAT), each with auto-reconnect and a fast,
non-blocking connect so a powered-off radio never freezes the app. The settings
ask two questions rather than one — **which radio**, then **how it is
connected** — and only offer the links that radio actually has:
When working in contests, it is important to record all on the air operation, for this purpose
the audio stream from the line-output is sent to all clients. The resulting audio stream can be
recorded to a file or played back with a PC sound card.
- **OmniRig** (Rig 1/2, hot-swap) — works with any OmniRig-supported rig.
- **FlexRadio (SmartSDR)** over the radio's TCP API — real-time slice freq /
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 F1F6 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 16 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).*
+87 -2
View File
@@ -402,6 +402,7 @@ const (
keyExtLoTWTQSLPath = "extsvc.lotw.tqsl_path"
keyExtLoTWStationLoc = "extsvc.lotw.station_location"
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)
keyExtLoTWKeyPassword = "extsvc.lotw.key_password"
keyExtLoTWUploadFlag = "extsvc.lotw.upload_flag" // legacy single flag (migrated to upload_flags)
@@ -3338,6 +3339,10 @@ func (a *App) applyStationDefaults(q *qso.QSO, includeIdentity bool) {
// Per-band rig/antenna from Operating conditions (the antenna ticked as
// 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.
// 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 d, ok, _ := a.operating.BandDefault(a.ctx, p.ID, q.Band); ok {
if q.MyRig == "" {
@@ -8324,6 +8329,12 @@ func (a *App) SaveCATSettings(s CATSettings) error {
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)
return nil
}
@@ -8921,6 +8932,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.
if a.pota != nil {
if info, ok := a.pota.Lookup(s.DXCall); ok {
@@ -12081,6 +12097,17 @@ func manualRefFor(existing, code string) string {
return ""
}
// 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
// matching local QSOs' received status. LoTW only for now (the canonical
// confirmation system); runs in the background emitting the same
@@ -12152,7 +12179,30 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
case extsvc.ServiceLoTW:
sinceDate := resolveSince(keyExtLoTWLastDownload)
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
// 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 == "" {
callLabel = "all callsigns"
}
@@ -12162,13 +12212,29 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
emit(fmt.Sprintf("Downloading all LoTW confirmations for %s…", callLabel))
}
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.
adifText, err := extsvc.DownloadLoTWConfirmations(ctx, nil, cfg.LoTW, sinceDate, ownCall, emit)
if err != nil {
emit("Download failed: " + err.Error())
done(matched, total)
return
}
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)
if kerr != nil {
emit("Error reading local log: " + kerr.Error())
@@ -12186,6 +12252,7 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
sets, _ := a.qso.ConfirmedSlots(ctx, []string{"lotw_rcvd", "qsl_rcvd"})
var items []ConfirmationItem
var unmatched []string
skippedOtherStation := 0
perr := adif.Parse(strings.NewReader(adifText), func(rec adif.Record) error {
if ctx.Err() != nil {
return ctx.Err() // window closed / superseded
@@ -12194,6 +12261,16 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
if !ok {
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++
date := rec["qslrdate"]
if date == "" {
@@ -12274,6 +12351,9 @@ func (a *App) runDownloadConfirmations(ctx context.Context, svc extsvc.Service,
} else {
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 {
// Said out loud rather than folded silently into the total: these
// matched on the mode CLASS, not the mode. LoTW hands back "DATA" for
@@ -13395,7 +13475,12 @@ func (a *App) LogUDPLoggedADIF(adifText string) (int64, error) {
// ── Operating-conditions stamp ──
// 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 p, err := a.profiles.Active(a.ctx); err == nil {
if d, ok2, _ := a.operating.BandDefault(a.ctx, p.ID, q.Band); ok2 {
+237
View File
@@ -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 ""
}
+7
View File
@@ -174,6 +174,11 @@ type MatrixColors struct {
EntityWorked string `json:"entity_worked"`
NotWorked string `json:"not_worked"`
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.
@@ -196,6 +201,8 @@ func normMatrixColors(c MatrixColors) MatrixColors {
EntityWorked: clean(c.EntityWorked),
NotWorked: clean(c.NotWorked),
CurrentEntry: clean(c.CurrentEntry),
MarkWorked: clean(c.MarkWorked),
MarkConfirmed: clean(c.MarkConfirmed),
}
}
+48
View File
@@ -1,4 +1,52 @@
[
{
"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, LoTWs \"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 radios 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 QSOs 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 profiles 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",
"date": "",
+126 -23
View File
@@ -1,7 +1,7 @@
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import {
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';
import {
@@ -56,6 +56,8 @@ import {
} from '../wailsjs/go/main/App';
import { Combobox } from '@/components/ui/combobox';
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 type { adif as adifModels, lookup as lookupModels, cat as catModels } from '../wailsjs/go/models';
import type { QSOForm, WorkedBeforeView, StationSettingsForm, ListsSettingsForm, ModePresetForm } from '@/types';
@@ -290,6 +292,94 @@ function FreqWheelDisplay({ mhz, onNudge, className, placeholder = '—.——
// shortCatError condenses a backend error into a few words for the topbar
// pill. The full message stays in the tooltip. Recognises the common cases
// (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 {
if (!err) return '';
const e = err.toLowerCase();
@@ -3186,7 +3276,7 @@ export default function App() {
function handleSpotSelect(s: any) {
if (!s?.dx_call?.trim()) return;
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) {
@@ -3211,7 +3301,7 @@ export default function App() {
FlexZoomForSpot(m ?? '', s.freq_hz ?? 0).catch(() => {});
if (m) applyModeFromSpot(m);
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);
}
@@ -3672,14 +3762,14 @@ export default function App() {
restartRecordingForNewTarget(call);
// 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.
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.
const unsubTciSpot = EventsOn('tci:spot_clicked', (p: any) => {
const call = String(p?.call ?? '');
if (!applyUdpCall(call, true)) return;
restartRecordingForNewTarget(call);
applySpotPOTA(String(p?.pota_ref ?? ''));
applySpotRefs(String(p?.pota_ref ?? ''), String(p?.sota_ref ?? ''));
});
const unsubBulk = EventsOn('bulkupdate:progress', (p: any) => {
const total = Number(p?.total ?? 0);
@@ -4707,13 +4797,17 @@ export default function App() {
}
wbTimerRef.current = window.setTimeout(() => runWorkedBefore(call), 150);
}
// applySpotPOTA sets the QSO's POTA award reference(s) from a clicked spot's
// park ref ("US-4164" or n-fer "US-1,US-2"). Empty ref clears it (fresh
// target). Routed to the pota_ref column at save via applyAwardRefs.
function applySpotPOTA(potaRef?: string) {
const refs = String(potaRef || '')
.split(/[,;]/).map((x) => x.trim().toUpperCase()).filter(Boolean);
setDetails((d) => ({ ...d, award_refs: refs.map((r) => `POTA@${r}`).join(';') }));
// Award references carried by the spot itself: the park a station is
// activating, the summit it is on, or both. Written into award_refs the same
// way for each, so logging the contact credits it without retyping a
// reference that was on screen.
function applySpotRefs(potaRef?: string, sotaRef?: string) {
const split = (v?: string) => String(v || '').split(/[,;]/).map((x) => x.trim().toUpperCase()).filter(Boolean);
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 }) {
// Programmatic call-sets (force: spot click, UDP, external app) count as
@@ -6326,7 +6420,7 @@ export default function App() {
disabled={disabled}
onClick={() => p && goto(p.bearingShort, 'SP')}
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')}
className={cn(
'inline-flex items-center gap-1 px-2 py-0.5 transition-colors',
@@ -6342,7 +6436,7 @@ export default function App() {
type="button"
disabled={disabled}
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(
'px-1.5 py-0.5 border-l border-info-border text-[10px] transition-colors',
disabled
@@ -8312,11 +8406,16 @@ export default function App() {
</span>
<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={catUp}
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>}
title={catUp ? `CAT: ${catState.rig || catState.backend || 'connected'}` : (catState.error || 'CAT')}
onClick={() => { setSettingsSection('cat'); setShowSettings(true); }}
{/* The CAT chip is also the radio switch.
With one radio it behaves as it always did click opens the CAT
settings. With several it opens a menu: pick one and OpsLog
reconnects to it, leaving the rest of the station alone. The
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
on={rotatorHeading.enabled && rotatorHeading.ok}
@@ -8329,9 +8428,13 @@ export default function App() {
STANDBY, red = offline. CLICK toggles OPERATE STANDBY (optimistic
flip, the 2s poll reconciles); offline click opens the settings. */}
{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 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 operate = viaFlex ? !!flexAmp.amp_operate : !!raw.operate;
const dot = !connected ? 'bg-danger' : operate ? 'bg-success' : 'bg-warning';
@@ -8341,7 +8444,7 @@ export default function App() {
const want = !operate;
if (viaFlex) setFlexAmp((f: any) => ({ ...f, amp_operate: want }));
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));
(viaFlex ? FlexAmpOperate(want) : AmpOperate(a.id, want)).catch(() => {});
};
@@ -8468,7 +8571,7 @@ export default function App() {
"1.5k" and then appended the unit, giving "1.5kkm" and even
written correctly, "1.5k km" makes a reader do arithmetic to
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
earns a mark on the badge rather than a line in the tooltip. */}
{!o.in_season && <span className="opacity-90">!</span>}
+1 -1
View File
@@ -194,7 +194,7 @@ export function AmpCard({ amp, flex, t }: { amp: Amp; flex: any; t: (k: string,
</div>
<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')} />
{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>
{kpa.connected && (
<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-none" />
<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>
<button type="button" onClick={reset}
+40 -4
View File
@@ -65,6 +65,19 @@ function cellStatus(r: AwardRef, band: string): CellStatus {
if (r.bands?.includes(band)) return 'worked';
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> = {
validated: 'bg-success text-success-foreground',
confirmed: 'bg-warning text-warning-foreground',
@@ -112,7 +125,7 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged, onPaperQSL }: {
const [refSearch, setRefSearch] = useState('');
const [editing, setEditing] = useState(false);
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
// confirmed" is two questions at once, and answering only one of them is what
// 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 === 'notworked' && r.worked) 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') {
// A reference never worked has no mode, so "not worked" plus a mode is
// 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;
});
}, [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
// (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)} />
</div>
<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)}
className={cn('px-2 py-1', refFilter === k ? 'bg-accent font-medium' : 'hover:bg-accent/50 text-muted-foreground')}>
{label}
@@ -484,6 +508,11 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged, onPaperQSL }: {
))}
</div>
<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
scope but with no reference" needs a scope to be in: on a
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">
{s === 'none' ? <span className="block w-11 h-7" /> : (
<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 })}
onClick={() => setCell({ ref: r.ref, band: b, name: r.name })}
>{CELL_LABEL[s]}</button>
+49 -8
View File
@@ -81,23 +81,44 @@ const STATUS_CLASSES: Record<string, string> = {
// 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
// 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-work', label: 'mx.callWork' },
{ swatch: 'bg-mx-dx-conf', label: 'mx.dxConf' },
{ swatch: 'bg-mx-dx-work', label: 'mx.dxWork' },
{ swatch: 'bg-mx-none', label: 'mx.none' },
{ 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 =
status === 'call_c' ? t('mx.tipCallConf') :
status === 'call_w' ? t('mx.tipCallWork') :
status === 'dxcc_c' ? t('mx.tipDxConf') :
status === 'dxcc_w' ? t('mx.tipDxWork') :
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) {
@@ -126,6 +147,16 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
return m;
}, [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.
// Derived straight from the entity's real band_status (all bands it was
// worked on — not just the operator's configured column list).
@@ -308,21 +339,29 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
</th>
{cols.map((b) => {
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;
return (
<td
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}
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',
// Only a filled cell has anything to show — an empty one
// stays inert rather than opening a "no QSOs" dialog.
st && 'cursor-pointer hover:brightness-110',
isCurrent && 'ring-2 ring-mx-cur ring-inset',
)}
/>
>
{mine ? <CallMark state={mine} /> : null}
</td>
);
})}
</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
className={cn(
'inline-block size-3 rounded shrink-0',
'relative inline-block size-3 rounded shrink-0',
l.swatch,
l.ring && 'ring-2 ring-mx-cur ring-inset',
)}
/>
>
{l.mark ? <CallMark state={l.mark} /> : null}
</span>
{t(l.label)}
</span>
))}
+2 -1
View File
@@ -10,6 +10,7 @@
// new is being decoded on FT8/FT4/JS8 near here — not that the band is dead.
import { useEffect, useMemo, useState } from 'react';
import { Radar, Loader2, X } from 'lucide-react';
import { formatDistance } from '@/lib/units';
import { useI18n } from '@/lib/i18n';
import { markerColour } from '@/lib/spotMarkers';
import { cn } from '@/lib/utils';
@@ -186,7 +187,7 @@ export function ChaseNewPanel({ onPick, onClose }: Props) {
title={[
s.country,
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` : '',
].filter(Boolean).join(' · ')}
>
+22 -3
View File
@@ -15,6 +15,7 @@ import { cleanSpotter, inferSpotMode, spotStatusKey } from '@/lib/spot';
import { markerColour } from '@/lib/spotMarkers';
import { applySpotDisplay, readSpotDisplayOptions } from '@/lib/spotDisplay';
import { loadLocal, loadRemote, saveState, seedLocal, whenGridPrefsReady } from '@/lib/gridPrefs';
import { distanceUnit, distanceValue, subscribeDistanceUnit } from '@/lib/units';
import { useI18n } from '@/lib/i18n';
type TFn = (key: string, vars?: Record<string, string | number>) => string;
@@ -45,6 +46,7 @@ export type ClusterSpot = {
raw: string;
repeats?: number;
pota_ref?: string;
sota_ref?: string;
pota_name?: string;
};
@@ -336,6 +338,16 @@ const makeColCatalog = (t: TFn): ColEntry[] => [
: { color: 'var(--success)' }) as any,
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'), field: 'sota_ref' as any, width: 100, cellClass: 'font-mono',
defaultVisible: false,
cellStyle: () => ({ color: 'var(--success)' }) as any,
},
{
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',
@@ -432,8 +444,13 @@ const makeColCatalog = (t: TFn): ColEntry[] => [
},
{
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',
valueFormatter: (p) => p.value ? String(p.value) : '',
// The header carries the unit, so the cells stay bare numbers and the
// 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),
},
{
@@ -512,7 +529,9 @@ export function ClusterGrid({ rows, spotStatus, onSpotClick, onSpotSelect }: Pro
const [pickerOpen, setPickerOpen] = useState(false);
// 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
// matching column events. Without this guard those events were persisted, so a
+8 -1
View File
@@ -292,6 +292,9 @@ function ScopePanadapter() {
const wfRef = useRef<HTMLCanvasElement>(null); // waterfall
const peakRef = useRef(160); // running amplitude ceiling for auto-scale
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 vfoRef = useRef(0); // latest VFO frequency, for wheel-tune
const centerRef = useRef(0); // scope centre we last set (for pan ◀/▶)
@@ -333,6 +336,7 @@ function ScopePanadapter() {
if (!alive) return;
try {
const sw = await IcomScopeData();
if (sw?.unsupported) setUnsupported(true);
if (sw && sw.seq !== lastSeq && sw.amp && sw.amp.length) {
lastSeq = sw.seq;
setFixed(sw.fixed);
@@ -543,7 +547,10 @@ function ScopePanadapter() {
<Chip label={on ? 'ON' : 'OFF'} on={on} onClick={toggle} />
</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="rounded-xl overflow-hidden ring-1 ring-info/20 shadow-lg shadow-sky-500/5 bg-[#05070e]">
<canvas ref={canvasRef} onDoubleClick={onDblClick}
+3 -2
View File
@@ -4,6 +4,7 @@ import 'leaflet/dist/leaflet.css';
import { nightPolygon } from '../lib/greyline';
import { gridToLatLon, gridSquareBounds, greatCirclePoints, pathBetween, destinationPoint } from '@/lib/maidenhead';
import { writeUiPref } from '@/lib/uiPref';
import { formatDistance } from '@/lib/units';
// Persisted free-pan view of the world map (when auto-zoom is off).
function loadMapView(): { lat: number; lon: number; zoom: number } | null {
@@ -446,8 +447,8 @@ export function WorldMap({ fromGrid, toGrid, fromLabel, toLabel, beamAzimuths, b
</button>
{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><span className="text-muted-foreground">Dist</span> {Math.round(path.distanceShort).toLocaleString()} km
<span className="text-muted-foreground"> · LP</span> {Math.round(path.distanceLong).toLocaleString()} km</div>
<div><span className="text-muted-foreground">Dist</span> {formatDistance(path.distanceShort)}
<span className="text-muted-foreground"> · LP</span> {formatDistance(path.distanceLong)}</div>
<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>
</div>
+22 -1
View File
@@ -8,7 +8,7 @@ import {
Select, SelectTrigger, SelectValue, SelectContent, SelectItem,
} from '@/components/ui/select';
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 { 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 { RecentQSOsGrid } from '@/components/RecentQSOsGrid';
import { EventsOn } from '../../wailsjs/runtime/runtime';
@@ -255,6 +255,9 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
const [searching, setSearching] = useState(false);
const [error, setError] = useState('');
const [addNotFound, setAddNotFound] = useState(false);
// LoTW only: pull the whole account rather than this profile's callsign.
const [lotwAllCalls, setLotwAllCalls] = useState(false);
useEffect(() => { GetLoTWDownloadAllCalls().then((v: boolean) => setLotwAllCalls(!!v)).catch(() => {}); }, []);
// Download date window: 'last' = incremental since last pull, 'date' = from a
// chosen date, 'all' = everything.
const [sinceMode, setSinceMode] = useState<'last' | 'date' | 'all'>('last');
@@ -434,6 +437,18 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
{paperBusy ? <Loader2 className="size-3.5 animate-spin" /> : <Search className="size-3.5" />}
{t('qslm.search')}
</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>
</>
) : (
@@ -736,6 +751,12 @@ export function QSLManagerPanel({ onEditQSO, actions, paperRequest }: {
<Checkbox checked={addNotFound} onCheckedChange={(c) => setAddNotFound(!!c)} />
{t('qslm.addNotFound')}
</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>
<Button size="sm" onClick={upload} disabled={selectedCount === 0 || busy}>
+7 -3
View File
@@ -9,6 +9,7 @@ import { formatDateTimeUTC, formatDateOnly, getDateFormat, subscribeDateFormat }
import { AgGridReact } from 'ag-grid-react';
import { Columns3, FilterX, ListChecks } from 'lucide-react';
import type { QSOForm } from '@/types';
import { distanceUnit, distanceValue, subscribeDistanceUnit } from '@/lib/units';
import { QSOContextMenu, type QSOMenuState } from './QSOContextMenu';
import {
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' },
// Derived, not stored: computed from the two locations at display time, like
// 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',
valueGetter: (p) => qsoDistanceKm(p.data, myGrid),
{ group: 'Contacted', label: t('rqg.c.distance_km'), colId: 'distance_km',
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 },
{ 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 },
@@ -335,7 +337,9 @@ export function RecentQSOsGrid({ rows, myGrid, selectAllSignal, selectRowSignal,
// inside the column definitions, so nothing else would notice.
const [dateFmt, setDateFmt] = useState(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,
// select just it; then open the bulk-action menu on the whole selection.
+102 -1
View File
@@ -9,7 +9,7 @@ import {
import {
GetLookupSettings, SaveLookupSettings, ClearLookupCache, TestLookupProvider,
GetListsSettings, SaveListsSettings,
GetCATSettings, SaveCATSettings, DiscoverFlexRadios,
GetCATSettings, SaveCATSettings, GetRadios, SaveRadios, SetActiveRadio, DiscoverFlexRadios,
ListProfiles, GetActiveProfile, SaveProfile, DeleteProfile, ActivateProfile, DuplicateProfile,
GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop,
GetRotorPresets, SaveRotorPresets, ResetRotorPresets,
@@ -80,6 +80,7 @@ import {
} from '@/components/ui/select';
import { cn } from '@/lib/utils';
import { writeUiPref } from '@/lib/uiPref';
import { setUseMiles } from '@/lib/units';
import { getDateFormat, setDateFormat, type DateFormat } from '@/lib/dateFormat';
import { useI18n, FlagGB, FlagFR, type Lang } from '@/lib/i18n';
import { useTheme, CONCRETE_THEMES, type ThemeChoice } from '@/lib/theme';
@@ -1596,6 +1597,11 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
// exotic or experimental bands not listed).
const [bandDraft, setBandDraft] = 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>({
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: '',
@@ -1742,6 +1748,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
const [startEqEnd, setStartEqEnd] = useState(() => localStorage.getItem('opslog.startEqualsEnd') === '1');
const [lookupOnBlur, setLookupOnBlur] = useState(() => localStorage.getItem('opslog.lookupOnBlur') === '1');
const [groupDigital, setGroupDigital] = useState(() => localStorage.getItem('opslog.groupDigitalSlots') === '1');
const [milesUnit, setMilesUnit] = useState(() => localStorage.getItem('opslog.distanceMiles') === '1');
const [clusterWorkedSameSlot, setClusterWorkedSameSlot] = useState(() => localStorage.getItem('opslog.clusterWorkedSameSlot') === '1');
// Declared HERE and not in ClusterPanel: that renderer is called as a plain
// function by the PANELS map, so it must stay hooks-free.
@@ -2192,6 +2199,12 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
// on a normal open and Save then wrote an empty list over the operator's
// buttons. See rotorPresetsLoaded for the belt to this brace.
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 { setAntgenius(await GetAntGeniusSettings() as any); } catch {}
try { setTunergenius(await GetTunerGeniusSettings() as any); } catch {}
@@ -3189,6 +3202,87 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
hint={t('cat.hint')}
/>
<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">
<Checkbox checked={catCfg.enabled} onCheckedChange={(c) => setCatCfg((s) => ({ ...s, enabled: !!c }))} />
{t('cat.enable')}
@@ -7129,6 +7223,13 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
<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>
</label>
<label className="flex items-center gap-2 text-sm cursor-pointer">
{/* Distances are computed in km everywhere and converted at display
time see lib/units. Changing this repaints the columns that
already carry a distance; nothing stored moves. */}
<Checkbox checked={milesUnit} onCheckedChange={(c) => { const v = !!c; setMilesUnit(v); setUseMiles(v); }} />
{t('gen.miles')} <span className="text-xs text-muted-foreground">{t('gen.milesHint')}</span>
</label>
<label className="flex items-center gap-2 text-sm cursor-pointer">
<Checkbox checked={checkUpdates} onCheckedChange={(c) => { const v = !!c; setCheckUpdates(v); writeUiPref('opslog.checkUpdates', v ? '1' : '0'); }} />
{t('gen.checkUpdates')} <span className="text-xs text-muted-foreground">{t('gen.checkUpdatesHint')}</span>
File diff suppressed because one or more lines are too long
+6 -1
View File
@@ -14,9 +14,11 @@ export type MatrixColors = {
entity_worked: string;
not_worked: 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
// 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 }[] = [
@@ -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: 'not_worked', cssVar: '--mx-none', label: 'mx.none' },
{ 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 => ({
enabled: false,
call_confirmed: '', call_worked: '', entity_confirmed: '',
entity_worked: '', not_worked: '', current_entry: '',
mark_worked: '', mark_confirmed: '',
});
// applyMatrixColors stamps (or clears) the overrides on <html>. Safe to call as
+1
View File
@@ -40,6 +40,7 @@ const PORTABLE_KEYS = [
'opslog.clusterFilterSource', 'opslog.clusterGroup', 'opslog.clusterBands',
'opslog.clusterLockBand', 'opslog.clusterLockMode', 'opslog.clusterStatusFilter',
'opslog.clusterModeFilter', 'opslog.clusterSearch', 'opslog.clusterHideWorked',
'opslog.distanceMiles', // distances shown in statute miles rather than km
'opslog.activeTab', // last selected tab
'opslog.mainSplit', // Main tab: width share of the left pane (percent) — legacy, read once to seed mainShares
'opslog.mainShares', // Main tab: column shares per column count, as {2:[..],3:[..],4:[..]}
+49
View File
@@ -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()}`;
}
+7
View File
@@ -91,6 +91,11 @@
be recoloured on its own without dragging every other warning in the app
with it (Appearance → matrix colours). */
--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-hover: #968455;
@@ -981,6 +986,8 @@
--color-mx-dx-work: var(--mx-dx-work);
--color-mx-none: var(--mx-none);
--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;
+1 -1
View File
@@ -1,6 +1,6 @@
// Single source of truth for the app version shown in the UI (header + About).
// Bump this on a release (the release script updates it alongside telemetry.go).
export const APP_VERSION = '0.26.18';
export const APP_VERSION = '0.26.21';
// Author / credits, shown in Help -> About.
export const APP_AUTHOR = 'F4BPO';
+14
View File
@@ -43,6 +43,8 @@ export function ADIFVersion():Promise<string>;
export function ActivateProfile(arg1:number):Promise<void>;
export function ActiveRadioID():Promise<string>;
export function AddQSO(arg1:qso.QSO):Promise<number>;
export function AmpFanMode(arg1:string,arg2:string):Promise<void>;
@@ -501,6 +503,8 @@ export function GetLiveOpenings():Promise<Array<bandopen.Opening>>;
export function GetLiveStations():Promise<Array<main.LiveStation>>;
export function GetLoTWDownloadAllCalls():Promise<boolean>;
export function GetLoTWUsersStatus():Promise<main.LoTWUsersStatus>;
export function GetLogFilePath():Promise<string>;
@@ -541,6 +545,8 @@ export function GetQSO(arg1:number):Promise<qso.QSO>;
export function GetQSORate():Promise<main.QSORate>;
export function GetRadios():Promise<Array<main.RadioConfig>>;
export function GetRelayAuto():Promise<main.RelayAutoConfig>;
export function GetRotatorHeading():Promise<main.RotatorHeading>;
@@ -745,6 +751,8 @@ export function ListQSO(arg1:qso.ListFilter):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 ListTQSLStationLocations():Promise<Array<extsvc.StationLocation>>;
@@ -1037,6 +1045,8 @@ export function SaveProfile(arg1:profile.Profile):Promise<profile.Profile>;
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 SaveRotators(arg1:Array<main.RotatorDevice>):Promise<void>;
@@ -1083,6 +1093,8 @@ export function SendLogToDeveloper():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 SetAlertEmailTo(arg1:string):Promise<void>;
@@ -1147,6 +1159,8 @@ export function SetKenwoodXIT(arg1:boolean):Promise<void>;
export function SetLinkedAmps(arg1:Array<string>):Promise<void>;
export function SetLoTWDownloadAllCalls(arg1:boolean):Promise<void>;
export function SetMotorFollow(arg1:boolean,arg2:number,arg3:string):Promise<void>;
export function SetOpsLogQSLReceived(arg1:number,arg2:boolean):Promise<void>;
+28
View File
@@ -26,6 +26,10 @@ export function ActivateProfile(arg1) {
return window['go']['main']['App']['ActivateProfile'](arg1);
}
export function ActiveRadioID() {
return window['go']['main']['App']['ActiveRadioID']();
}
export function AddQSO(arg1) {
return window['go']['main']['App']['AddQSO'](arg1);
}
@@ -942,6 +946,10 @@ export function GetLiveStations() {
return window['go']['main']['App']['GetLiveStations']();
}
export function GetLoTWDownloadAllCalls() {
return window['go']['main']['App']['GetLoTWDownloadAllCalls']();
}
export function GetLoTWUsersStatus() {
return window['go']['main']['App']['GetLoTWUsersStatus']();
}
@@ -1022,6 +1030,10 @@ export function GetQSORate() {
return window['go']['main']['App']['GetQSORate']();
}
export function GetRadios() {
return window['go']['main']['App']['GetRadios']();
}
export function GetRelayAuto() {
return window['go']['main']['App']['GetRelayAuto']();
}
@@ -1430,6 +1442,10 @@ export function ListQSOFiltered(arg1) {
return window['go']['main']['App']['ListQSOFiltered'](arg1);
}
export function ListRadios() {
return window['go']['main']['App']['ListRadios']();
}
export function ListSerialPorts() {
return window['go']['main']['App']['ListSerialPorts']();
}
@@ -2014,6 +2030,10 @@ export function SaveQSLDefaults(arg1) {
return window['go']['main']['App']['SaveQSLDefaults'](arg1);
}
export function SaveRadios(arg1) {
return window['go']['main']['App']['SaveRadios'](arg1);
}
export function SaveRelayAuto(arg1) {
return window['go']['main']['App']['SaveRelayAuto'](arg1);
}
@@ -2106,6 +2126,10 @@ export function SendQSORecordingEmail(arg1) {
return window['go']['main']['App']['SendQSORecordingEmail'](arg1);
}
export function SetActiveRadio(arg1) {
return window['go']['main']['App']['SetActiveRadio'](arg1);
}
export function SetActiveRotor(arg1) {
return window['go']['main']['App']['SetActiveRotor'](arg1);
}
@@ -2234,6 +2258,10 @@ export function SetLinkedAmps(arg1) {
return window['go']['main']['App']['SetLinkedAmps'](arg1);
}
export function SetLoTWDownloadAllCalls(arg1) {
return window['go']['main']['App']['SetLoTWDownloadAllCalls'](arg1);
}
export function SetMotorFollow(arg1, arg2, arg3) {
return window['go']['main']['App']['SetMotorFollow'](arg1, arg2, arg3);
}
+64
View File
@@ -1196,6 +1196,7 @@ export namespace cat {
low_hz: number;
high_hz: number;
fixed: boolean;
unsupported: boolean;
static createFrom(source: any = {}) {
return new ScopeSweep(source);
@@ -1208,6 +1209,7 @@ export namespace cat {
this.low_hz = source["low_hz"];
this.high_hz = source["high_hz"];
this.fixed = source["fixed"];
this.unsupported = source["unsupported"];
}
}
export class TCIPanelState {
@@ -3066,6 +3068,8 @@ export namespace main {
entity_worked: string;
not_worked: string;
current_entry: string;
mark_worked: string;
mark_confirmed: string;
static createFrom(source: any = {}) {
return new MatrixColors(source);
@@ -3080,6 +3084,8 @@ export namespace main {
this.entity_worked = source["entity_worked"];
this.not_worked = source["not_worked"];
this.current_entry = source["current_entry"];
this.mark_worked = source["mark_worked"];
this.mark_confirmed = source["mark_confirmed"];
}
}
@@ -3569,6 +3575,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 {
device_id: string;
relay: number;
@@ -4971,6 +5033,7 @@ export namespace qso {
band: string;
class: string;
status: string;
call?: string;
static createFrom(source: any = {}) {
return new BandStatus(source);
@@ -4981,6 +5044,7 @@ export namespace qso {
this.band = source["band"];
this.class = source["class"];
this.status = source["status"];
this.call = source["call"];
}
}
export class Bucket {
+6
View File
@@ -674,6 +674,12 @@ type ScopeSweep struct {
LowHz int64 `json:"low_hz"` // left 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
// 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
+70 -17
View File
@@ -94,6 +94,9 @@ type IcomSerial struct {
// reassembled sweep; scopeMu guards it (written by the scope goroutine, read
// via ScopeData from the binding goroutine).
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
scopeAmp []byte
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
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
}
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
// 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),
@@ -1000,15 +1053,25 @@ func (b *IcomSerial) SetScope(on bool) error {
// 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
// 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)
}
}
// 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
// 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)
// 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.scopeOn = on
@@ -1041,13 +1104,7 @@ func (b *IcomSerial) scopeReadCfg() {
// makes the scope follow the VFO, so tuning pans the view left/right.
func (b *IcomSerial) SetScopeMode(fixed bool) error {
mode := boolByte(fixed) // 0 = center, 1 = fixed (verify on rig via the cfg log)
var payload []byte
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 {
if err := b.execScope("set mode", civ.SubScopeMode, mode); err != nil {
applog.Printf("icom scope: set mode fixed=%v ack: %v", fixed, err)
}
b.scopeMu.Lock()
@@ -1093,13 +1150,8 @@ func (b *IcomSerial) SetScopeEdges(low, high int64) error {
if rangeID == 0 {
return fmt.Errorf("icom scope: freq out of range")
}
if b.dualScope {
_ = b.exec(civ.CmdScope, civ.SubScopeMode, 0x00, 0x01) // fixed mode (main)
_ = 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)
}
_ = b.execScope("fixed mode", civ.SubScopeMode, 0x01)
_ = b.execScope("edge set 1", civ.SubScopeEdge, 0x01)
payload := append([]byte{civ.CmdScope, civ.SubScopeFixEdge, rangeID, 0x01}, civ.FreqToBCD(low)...)
payload = append(payload, civ.FreqToBCD(high)...)
b.scopeMu.Lock()
@@ -1263,7 +1315,8 @@ func (b *IcomSerial) ScopeData() ScopeSweep {
for i, v := range b.scopeAmp {
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.
+4
View File
@@ -75,6 +75,10 @@ type Spot struct {
Historical bool `json:"historical,omitempty"`
POTARef string `json:"pota_ref,omitempty"` // park id if this station is activating (api.pota.app)
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.
+21
View File
@@ -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]
}
+25
View File
@@ -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)
}
}
}
+149 -7
View File
@@ -12,6 +12,7 @@ import (
"os/exec"
"path/filepath"
"strings"
"sync"
"syscall"
"time"
)
@@ -20,6 +21,67 @@ import (
// document of the user's QSOs (optionally only confirmed ones).
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.
// 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
@@ -27,7 +89,7 @@ const lotwReportURL = "https://lotw.arrl.org/lotwuser/lotwreport.adi"
// non-empty, only confirmations for that station callsign are returned (an
// LoTW account holds every call you operate — F4BPO, F4BPO/P, TM2Q — so this
// 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, note func(string)) (string, error) {
user := strings.TrimSpace(cfg.Username)
if user == "" || cfg.Password == "" {
return "", fmt.Errorf("lotw: website login (username/password) not set")
@@ -41,23 +103,103 @@ func DownloadLoTWConfirmations(ctx context.Context, client *http.Client, cfg Ser
if c := strings.TrimSpace(ownCall); c != "" {
q.Set("qso_owncall", c) // restrict to this station callsign
}
if s := strings.TrimSpace(since); s != "" {
q.Set("qso_qslsince", s)
// qso_qslsince is ALWAYS sent, even for "everything".
//
// 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)
if err != nil {
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 {
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 {
return "", fmt.Errorf("lotw: request failed: %w", err)
}
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 {
return "", fmt.Errorf("lotw: read response: %w", err)
}
@@ -365,7 +507,7 @@ func TestLoTW(cfg ServiceConfig, stationDataPath string) (string, error) {
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
if _, err := DownloadLoTWConfirmations(ctx, nil, cfg, "2099-01-01", ""); err != nil {
if _, err := DownloadLoTWConfirmations(ctx, nil, cfg, "2099-01-01", "", nil); err != nil {
return "", fmt.Errorf("%s — but the DOWNLOAD login failed: %w", up, err)
}
return up + ". Download login accepted.", nil
+59 -3
View File
@@ -1901,10 +1901,24 @@ type WorkedBefore struct {
}
// 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 {
Band string `json:"band"` // ADIF lowercase band, e.g. "20m"
Class string `json:"class"` // "PH" | "CW" | "DIG"
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
@@ -2222,13 +2236,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
// that question confirmation is the axis that matters: a confirmed entity
// 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
// that Scan into *string can't handle and would error out the whole
// WorkedBefore call, blanking the matrix in the UI.
statusRows, err := r.db.QueryContext(ctx, `
SELECT band, mode,
MAX(CASE WHEN callsign = ? THEN 1 ELSE 0 END),
MAX(CASE WHEN callsign = ?
MAX(CASE WHEN `+pred+` THEN 1 ELSE 0 END),
MAX(CASE WHEN `+pred+`
AND (lotw_rcvd IN `+ConfirmedValues+` OR qsl_rcvd IN `+ConfirmedValues+` OR eqsl_rcvd IN `+ConfirmedValues+`)
THEN 1 ELSE 0 END),
MAX(CASE WHEN lotw_rcvd IN `+ConfirmedValues+` OR qsl_rcvd IN `+ConfirmedValues+` OR eqsl_rcvd IN `+ConfirmedValues+`
@@ -2237,12 +2255,14 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
WHERE dxcc = ?
AND band IS NOT NULL AND band != ''
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 {
return wb, fmt.Errorf("band status: %w", err)
}
type cellKey struct{ band, class string }
best := map[cellKey]int{}
// The call's own answer per cell, independent of the ladder above.
callByCell := map[cellKey]string{}
for statusRows.Next() {
var band, mode string
var callW, callC, dxccConfirmed int
@@ -2255,12 +2275,21 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
if cur, ok := best[k]; !ok || code > cur {
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()
codeStr := bandStatusNames
for k, code := range best {
wb.BandStatus = append(wb.BandStatus, BandStatus{
Band: k.band, Class: k.class, Status: codeStr[code],
Call: callByCell[k],
})
}
return wb, nil
@@ -2955,6 +2984,33 @@ func DedupeKey(callsign, qsoDateMinute, band, mode string) string {
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
// confirmations back to local QSOs.
func (r *Repo) DedupeKeyIDs(ctx context.Context) (map[string]int64, error) {
+1 -1
View File
@@ -21,7 +21,7 @@ import (
const (
// appVersion is stamped on every heartbeat (and could feed the About box).
appVersion = "0.26.18"
appVersion = "0.26.21"
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
// to https://us.i.posthog.com for a US project.