Compare commits

...
36 Commits
Author SHA1 Message Date
rouggy 23f324e606 chore: release v0.27.15 2026-09-06 20:25:56 +02:00
rouggy 44a18ec799 chore(ui): shorter WSJT-X highlight wording
The main hint named three fixed colours, which stopped being true the
moment the operator could choose them. And the paragraph under "Mark
stations already worked" explained a trade-off nobody reads standing at
the radio; the switch says what it does.
2026-09-06 20:15:56 +02:00
rouggy 1e003bbdb7 chore(changelog): 0.27.15 reads novelties first
Same order as the last block: what is new leads, each fix follows the
thing it belongs to — the antenna pair, then the Icom network run, then
the rest.
2026-09-06 20:13:46 +02:00
rouggy 421bc372ee fix(steppir): the same fast poll, and motion reported at the command
The shortened transmit gag was written for an Ultrabeam that is now polled
four times a second while it moves. The SteppIR was still on two seconds
and reported nothing at all until its own poll came round, so the gap
between the 900 ms grace and the first poll that would have seen the
movement was a hole in "block TX while the elements travel" — the
transmitter released in the middle of a move.

It now reports a commanded move at once (bounded, so an antenna that
never answers cannot latch the inhibit on), on a COPY of the cached
status so the flag cannot leak into what the poll goroutine owns, and
follows the motors with its poll rate exactly as the Ultrabeam does.
2026-09-06 20:10:39 +02:00
rouggy c8c48d408f feat(motor antenna): amber at the order, not at the answer
The transmit gag starts when the move is commanded; the indicator waited
for a status poll to say the elements were travelling, so the two
disagreed by a second or more — and on an automatic follow (band change
with tracking on) there was no sign at all until a poll landed. The
backend now announces the order as it goes out, the interface shows it at
once and re-reads the antenna immediately, and the real status takes over
the moment it arrives.

The WSJT-X "grey out stations already worked" switch is renamed "Mark
stations already worked": with the colour now chosen by the operator the
old name described the wrong thing, but the switch still answers a
question the palette cannot — WHETHER dupes should be marked at all. On a
well-filled log they are most of a period, and a window where nearly
every line is coloured has stopped saying anything.
2026-09-06 20:06:05 +02:00
rouggy d001616767 fix: release TX when the elements stop; WSJT-X colours, and worked beats the watch list
The motorised antenna gagged the transmitter for a second or two after it
had finished moving. Three delays were stacked: the antenna polled every
two seconds, the gag held for three after the command whatever the
antenna said, and the widget refreshed every three. The antenna is now
asked four times a second WHILE IT MOVES — an idle one has nothing to say
and stays at two seconds — the gag only bridges the command itself
(900 ms), and the widget follows at half a second while moving.

WSJT-X highlighting:

- A watch-list station already worked on this band and mode is no longer
  painted as one to call. The list is a statement of intent, not of what
  is left to do, and its pink outranked every other verdict including the
  log's, so a worked station stayed pink for the session with nothing to
  tell it from one still needed.
- The four colours are the operator's to choose (Settings → UDP). Only
  the background: the text colour is derived by luma, so a dark blue
  cannot come back as black-on-black in somebody else's window. Changing
  one clears the installed highlights, or the de-duplication would keep
  showing yesterday's colour until a callsign changed verdict.
2026-09-06 18:43:08 +02:00
rouggy 07ee48e20c feat(rotor dial): circular scale and a beam, from EC1KD's revision
The square ring put the ticks in the corners where the room is, and made
every distance from the centre depend on direction — a marker at 45 sat
further out than one at north. A dial is read by angle, so the ring it is
read against is the same distance away all the way round now, and the
markers need one radius instead of a per-direction one.

The antenna is a sector that fades outwards rather than an arrow: an
antenna does not look along a line, it looks through a lobe, and the
arrow claimed a precision the beamwidth does not have. Where the mouse
would send it is drawn the same way, and its azimuth cross-fades into the
big readout while aiming — the figure is read at the moment the beam is,
so it belongs in the same place rather than somewhere to look away to.

Three colours, three meanings, kept apart: green where the antenna IS
(as everywhere else in OpsLog), orange where a click would send it,
yellow what was ORDERED. His revision drew all of them orange and yellow,
which loses the distinction the dial exists for — and drew the second
lobe of a bidirectional Ultrabeam at full strength, indistinguishable
from the main one. It is dimmed again; the dashed boom, the REV/BI badge
and the compact form are untouched.
2026-09-06 18:31:52 +02:00
rouggy 9614e3498a fix(icom net): the audio starts at once, not half a minute later
The conninfo that authorises the RX stream goes out during the login,
before the audio socket exists — it has to, since it is what authorises
it. So the rig is told to send audio to :50003 while nothing is bound
there, gets an ICMP port-unreachable back, backs off, and the audio turns
up only when its own retry timer comes round: twenty to thirty seconds by
the operator's watch, ninety in one log.

It is sent once more the moment the port is listening, which is the same
message the session already carries — RS-BA1 repeats it too. The audio
dial moved above the pumps, because after ctrlPump is running the
control-stream auth state belongs to it.
2026-09-06 18:26:24 +02:00
rouggy 0f082e1301 diag(audio): say why the Listening device is silent
"I turned the sound back on and nothing comes out of the speakers", with
a log that reports success at every step: the network audio stream up,
664-byte packets arriving, the monitor started. The render goroutine's
error was thrown away — a device unplugged, renamed by Windows or unable
to open at 16 kHz fails exactly there, silently.

It is logged now, with the device id. Two once-only lines either side of
it say whether the decoded audio is reaching a running monitor or
arriving with nobody listening, which separates a device fault from the
speakers simply being switched off.
2026-09-06 18:22:39 +02:00
rouggy 2808bead97 fix(uploads): Club Log is configured — it never needed an API key
The guard I added for services with no credentials demanded one, and
nobody has ever set it: OpsLog carries its own Club Log APPLICATION key
(clublogAppAPIKey), so the account is an email, a password and the
logbook callsign. An operator whose live upload had been working for
months was told the service was not configured the moment he sent QSOs by
hand after an import.

Written in app.go, the rules drifted from the uploaders on the first try.
They now live in internal/extsvc beside the Upload* functions that
enforce them, each case mirroring that function's own guard — which also
caught Cloudlog, where the station profile is required and the check did
not ask for it. The message names the fields actually missing rather than
listing everything the service takes.
2026-09-06 18:06:06 +02:00
rouggy e8f9e68759 diag(icom net): name the last CI-V commands before the silence
Audio off, and the IC-7760 still answers at connect and then never again:
twenty-eight commands sent, not one reply, packets still arriving on the
stream. A count says how much went unanswered and never which command
went out last — which is the one thing that can identify a frame this rig
does not tolerate, on a radio nobody here has.

The transport now keeps the command headers of the last eight frames and
prints them with the silence report.
2026-09-06 17:49:32 +02:00
rouggy f2168d339b diag(icom net): name the audio stream when CI-V goes quiet
The RX audio stream is experimental and shares the rig's session with
CI-V. The shape in an operator's log is unmistakable: audio packets
arriving by the hundred while not one CI-V reply comes back, the watchdog
tearing the session down, twenty seconds' pause, and the whole thing
again — read from outside as "the Icom keeps disconnecting", with
nothing pointing at the switch that would end it.

The log now says it, and names the setting. icomAudio counts what it has
delivered so the line distinguishes "audio is enabled" from "audio is
arriving", which is the half that makes it a suspect.
2026-09-06 17:42:37 +02:00
rouggy 507d1f0882 fix(icom net): a sleeping rig keeps its session, and the console is reachable
From an operator's log: an IC-7760 in standby, and OpsLog dialling and
dropping every forty seconds for as long as it was left there — control
link up, login OK, token renewed, and not one CI-V answer.

lastGoodAt bounds "the link answers but no CI-V comes back". It belongs
to a session and was never cleared when a new one opened, so a rig that
went to standby half an hour ago handed every fresh session a
half-hour-old last good read: past the grace before the first command was
even sent. Torn down at once, redialled twenty seconds later, torn down
again. Cleared on connect, the rule reads as it was written — silent
since connect is a rig in standby, and the session is kept so it can be
woken.

The console it is woken from was missing too. It appeared only once the
live CAT state said "icom", which a sleeping rig never says, so the ON
button was absent at the one moment it exists for. It now follows the
CONFIGURED radio — which also had to start following a radio switched
from the status bar, instead of waiting for a trip through Settings and a
Save that changed nothing.
2026-09-06 17:35:53 +02:00
rouggy 381a7fdc40 fix(adif): one record, one line
An exported file was full of blank gaps: a record ran down a dozen lines
and the next appeared to start in the middle of the page. ADDRESS is a
multi-line field by the standard and callbooks and other loggers fill it
that way — "Kabul", four blank lines, "Afghanistan" — and the writer
copied the value out as it stood. The files were always valid, since ADIF
counts bytes; they were unreadable, and so was anything that quoted them.

Line breaks inside a value are now joined with a comma and tabs become
spaces, which is how an address reads on one line anyway. The length
prefix is computed after the flattening, so the record stays exact, and
every path through the writer gets it: the file exports, the uploads and
the record forwarded over UDP.

The changelog's 0.27.15 block also takes back the FT-map hover fix, which
landed after the 0.27.14 release commit and was sitting in that block.
2026-09-06 17:09:18 +02:00
rouggy c8e2e3a29f fix(ft map): the hover label came back
The invisible circle that catches the clicks sits ON TOP of the dot, so
it takes the hover as well — and the tooltip was bound only to the dot
underneath. From the moment the stations became clickable, pointing at
one said nothing: the callsign, square and report an operator reads off
the map had simply gone.
2026-09-06 16:56:58 +02:00
rouggy 92a3189784 chore(changelog): 0.27.14 reads novelties first
The block is read top to bottom: what is new leads, each fix follows the
thing it belongs to, and the five genuinely new features carry [NEW].
2026-09-06 14:58:54 +02:00
rouggy 0af6cdedcd chore: release v0.27.14 2026-09-06 14:58:42 +02:00
rouggy ab1b45da07 feat(ft map): click a station to take it, double-click to answer it
The map draws a dot per decoded station and they did nothing. They now
answer the same two gestures as the decodes list, because the two are
views of the same list and a click has to mean the same thing on both:
one takes the callsign into the entry (and points the PSK Reporter panel
at it), two answer it.

The handlers were written inline on the list, so the map could not offer
them without a second copy — they are named once now and given to both.
Leaflet leaves the telling apart of click and dblclick to the handler, an
invisible marker three times the dot's radius takes the clicks (a
three-pixel dot is a fine mark and a poor target), and the double click
is stopped rather than merely unpropagated: the map zooms on one, and
answering a station is not a request to zoom in on it.
2026-09-06 14:47:22 +02:00
rouggy ed66e9394b fix(autocall): rest in overs, no phantom miss, and a readable auto readout
The rest between two series was two minutes — four overs on FT8, by
which time the DX has worked four other callers and half the time has
gone. It is now counted in the station's OWN overs and is one by default:
seven calls, one over listened through, and it goes again if the station
is still there. The deadline lands mid-cycle on purpose, so "sit out one
over" means one over rather than depending on a millisecond of clock
skew.

A period the target was DECODED in is never counted as a miss. A period
is judged more than once — decodes arrive in a burst and stragglers
follow — and a later judgement holds a partial view of it, not evidence
of absence: D2ACE answered in the very period the counter then read as a
miss.

The readout moved out of the Auto button and beside it. "Auto D2ACE 1/7
·1/3" read as one number, and the control changed width every period.
The callsign is now the biggest thing on the row, the calls and the
missed periods each carry a label, the miss count appears only once there
is one, and a station being waited for gets its own amber chip.
2026-09-06 14:36:32 +02:00
rouggy f56630d7d6 feat(maps): remembered views for the FT and grid maps, and no wasted first paint
The world map was the only one that remembered anything. Panning and
zooming a map is the operator saying which part of the world they work,
and on the FT decodes map and the grid-square map that was thrown away on
every tab switch. Both now keep centre and zoom, through one shared
helper (lib/mapView) that the world map uses too, and the keys are
portable so a copied data folder brings the views with it.

The world map also waits for the station's square before it paints. It
drew the world at 0 degrees and then moved to the operator's longitude —
a screenful of Esri tiles fetched and discarded on every first run. It is
now built once, knowing where it is looking; a profile with no locator
gets the default view after two seconds rather than a blank panel.
2026-09-06 14:23:43 +02:00
rouggy 50e97a8e0d feat(map): the world map opens on the operator's own longitude
Centred on 0 degrees it left an Australian looking at their own country
in the bottom-right corner, with the paths to everywhere they work
running off both edges. Centred on their own longitude the same map reads
the way their antenna does: the Americas to the east, Europe and Africa
to the west. Leaflet repeats the world horizontally, so this is a choice
of viewpoint and costs nothing — the tiles either side are the same
world, and unwrapLon already draws the arcs across the seam.

The latitude is damped rather than followed (a station at 69 north
centred on itself would spend half the map on the Arctic), the station's
square arrives after the map is built so it re-centres once when it
lands, and a view the operator has panned to themselves still wins.
2026-09-06 14:14:36 +02:00
rouggy e0bba21ecc fix(rst): a change of mode changes the notation
An operator with a callsign in the field, switching FT8 to SSB, kept
"+00" as the report. The edited flag protects a report the operator
chose — 57 rather than 59 — and it was holding across a change of mode as
well, where it protects nothing: a decibel figure is not a weak SSB
report, it is not a report at all. Worse, anything that fills the field
from the rig sets that flag too (the S-meter readouts in the rig
consoles), so the field could be stuck in the wrong notation for the rest
of the QSO.

The flag now holds only while the report still belongs to the mode's
family. When it does not, the operator's own judgement is carried across
where it can be — 57 becomes 579, 599 becomes 59 — and the mode's preset
answers where it cannot.
2026-09-06 14:06:04 +02:00
rouggy 28f784fe88 fix(rst wheel): the S9+ ladder, not the S digit
Below 59+20 comes 59+15, then +10, +5, then a plain 59 and down through
58, 57. Stepping the S digit and leaving the suffix where it was turned
59+20 into 58+20, which nobody has ever said on the air. Five decibels at
a time above S9 — the same increment sMeterRST rounds an S-meter reading
to — and one S-unit below it.
2026-09-06 14:01:58 +02:00
rouggy b421da165a feat: wheel over RST; PSK Reporter keeps the band's window
The mouse wheel steps the RST fields — one S-unit on an RST or RS, one
decibel on a digital report, up for a better one — in the entry strip and
in the QSO editor. The dropdown beside them lists the reports worth
having to hand, not all 41 decibels, so the wheel works on the value
rather than walking the list. The listener is native and non-passive:
React attaches onWheel passively, where preventDefault does nothing and
the panel scrolls away under the field being adjusted.

PSK Reporter, whole-band scope: clicking a decode reset the report count
to zero. The window there is the BAND's — every FTx report on it,
filtered by target only when the analysis is drawn — and it was emptied
on every target change, throwing away an hour of evidence at the moment
the operator asked the question it answers. The narrow scope still clears
it: there the window is one station's, and keeping it would answer the
new question with the old station's evidence.
2026-09-06 13:58:25 +02:00
rouggy 8b59954ce0 fix: a watched callsign is never parked; refuse uploads to unconfigured services
ZD8GB — watch-listed, six streams a period, two of them RR73 — was
refused as "parked" for the rest of the session. Parking answers "it
will not answer, stop wasting the evening on it", which is a fair verdict
about a station the LOG picked out and the wrong one about a station the
OPERATOR named: a DXpedition running a pileup takes more than two series
of calls to get through to, which is exactly why it is on the list. The
rest between series still applies, so it cannot monopolise the
transmitter — it simply never becomes ineligible.

Send to (right-click) now refuses a service with no credentials and says
which are missing. The upload runs on its own goroutine and reports into
the QSL Manager's console, which is not open when the command came from
the QSO list, so an upload to an unconfigured service looked exactly like
one that worked. The toast is also raised only once the backend has
accepted the request, and Cloudlog / Wavelog and HamQTH name themselves
in it.
2026-09-06 13:45:35 +02:00
rouggy 70ada49776 fix: CI-V address 00, simplex uploaded as split, and S/F spots
Three field reports.

Icom CI-V address 00 could not be kept: zero was read as "not
configured" in all three places that validate it, so every save put the
rig back to the IC-7610's 0x98 — and the model dropdown followed, since
it is derived from the address rather than stored. Picking "Other
(custom address)" also had no effect of its own: the list re-derived
itself and snapped back to whatever rig matched. It now stays chosen.

Cloudlog/Wavelog showed "17m/17m" on ordinary FT8 contacts (OE6CLD).
Every QSO is stamped with a receive side equal to the transmit side, and
the uploaded record carried it; Wavelog draws band/band_rx whenever both
are there. In ADIF an absent BAND_RX means "same as transmit", so the
uploaded record now writes the receive side only when it differs. The
copy forwarded to another logger over UDP keeps writing it in full —
that is why it was stamped in the first place (Log4OM reads BAND_RX) —
through its own ForwardRecordADIF.

"S/F" in a spot comment joins superfox / sfox / F-H as FT8.
2026-09-06 13:12:00 +02:00
rouggy e20f32c918 chore(changelog): the late-decode fix opens 0.27.14
It went in after the 0.27.13 release commit, so the shipped build does not
contain it — and the entry had been folded into that block's fixes line,
where it claimed a fix nobody had. The 0.27.13 block is back to what was
released.
2026-09-06 06:56:01 +02:00
rouggy 71adbfd8ff fix(autocall): a late decode belongs to its own period
A decoder sends a period's decodes in a burst, and stragglers follow — a
deep decode a second behind the rest. The sweeper judged the burst and
CLEARED the buffer, so the straggler opened a fresh one under the same
period key and was judged on its own: the ladder applied to a handful of
late arrivals with the other thirty stations of that period nowhere in
sight, and often after the reply to the burst had already put us on the
air, where nothing can act on it at all.

The buffer now outlives the judgement. A period stays open until a decode
stamped with the NEXT slot arrives; a straggler appends to it and the
period is judged again, whole. Judged once per period otherwise — acDirty
says whether anything new has come in — and the same flag now answers the
dead-band case that the cleared buffer used to stand for.
2026-09-06 00:31:16 +02:00
rouggy cccdb354f8 chore: release v0.27.13 2026-09-06 00:11:20 +02:00
rouggy 4321eae647 fix(watchlist widget): one line per spot
Callsign, band, mode, badge, age in reading order, and the widget widened
to 290 px so the badge and the age never squeeze the callsign. Two lines
made the panel twice as tall for the same three facts; the entry that
matched — which only differs when it is a prefix — moved into the row's
tooltip.
2026-09-06 00:10:21 +02:00
rouggy 03e71bfdf2 feat: docked watch-list panel, and auto-call learns the orthogonal markers
The watch list was a tab, and an operator working FT8 lives on the decodes
one: a station they had asked to be told about turned up on a screen they
were not looking at. The same answer is now docked in the widget strip,
above the tabs, reduced to what is worth acting on — on the air and still
needed, one row per band and mode, with the cluster's own NEW DXCC /
NEW BAND / NEW SLOT badge and a click that tunes. Off by default. The
"active and needed" answer costs a debounced query per visible slot, so it
is written once (lib/watchlistSpots) and the tab uses it too.

Auto-call:

- It answers a new prefix, county, state, square or park. Those markers
  are orthogonal to the entity, they ranked as nothing-needed, and the
  engine sat through a never-worked WPX prefix calling CQ. New rung at
  the foot of the ladder, gated by the chase switches the badges use —
  which meant making those switches portable, since the backend cannot
  read localStorage.
- It calls THROUGH a pileup. Giving up the moment the DX answered
  somebody else is precisely how a queue is not worked; the call and miss
  counters already bound the effort, and a station in mid-exchange is
  still never chosen as a new target.

The PSK Reporter panel now follows the station auto-call is waiting for:
the analysis takes a history query and a period or two to fill, so
starting it when the DX comes free is starting it too late.

Callbook lookup: a compound callsign with a page of its OWN keeps that
page's location. QRZ files HP/WE9G under exactly that form, with the
Panama square the station is operating from, and the rule that drops a
home address from a portable call was throwing it away. The record's own
country tells an operation's page from a home page.

Changelog: entries may open with [NEW], drawn as a pill in the What's new
dialog — a release is mostly fixes and the two or three genuinely new
things should not have to be found by reading all of it.
2026-09-06 00:08:55 +02:00
rouggy 23323c91e0 fix(autocall): the QSO in progress outranks the ladder
Six faults from an evening on 60 m, all in the same family: the engine
judging a station by what the log wants from it and forgetting what is
already under way.

- An exchange was abandoned mid-QSO. The reply lands in the same period
  the ladder is re-read, and that period was judged before the reply was
  taken into account, so a better-ranked caller took the slot from a
  station that had just come back to us. The answer is settled first now,
  and our own report counts as being inside the exchange too — which also
  protects a QSO the operator started by hand.
- A station just picked started with misses against it. Its transmit slot
  was unknown until a second decode, and with the parity unknown every
  period counted, including the one spent transmitting to it.
- The freed slot after "it is working somebody else" was thrown away: the
  period's decodes are in hand, so the next station is picked from them
  rather than fifteen seconds later. Never mid-over.
- Auto-call is never armed from a stored setting — not at launch, not on
  a profile switch. It is the one feature that puts the station on the
  air by itself and OpsLog starts with Windows.
- It says what it is waiting for: a wanted station in a QSO with somebody
  else now shows beside the Auto button instead of looking idle.
- Switching profile left the previous logbook's verdicts on screen. The
  worked-index, chase-new and the frontend's cached verdicts are dropped
  when the logbook changes.

FT decodes: distance column, a message addressed to you set whole in
green (the station you are calling keeps a tint — most of what it sends
goes to other people), badge order L / Wkd / WL, list cleared when the
RIG changes band.

Rotor: new world-map compass from EC1KD's design, with the Ultrabeam boom
and second lobe restored and the compact form preserved; the classic dial
is kept and Settings → Rotator chooses between them. Stop no longer
flickers on a rotor standing still — movement was inferred from a degree,
less than the jitter a controller reports at rest.
2026-09-05 23:02:31 +02:00
rouggy 8dbc4b7e62 feat(ui): the FT decodes panel, two DXHunter themes, and the maps
Decodes:
- one click SELECTS, two transmit. A single click handed the decode
  straight to WSJT-X as a reply, so brushing a row while reading the
  band started calling a station.
- the list empties for a receiver that changes band, and a receiver
  column appears when more than one is feeding one merged list.
- the period clock turns red while transmitting: it is the one thing on
  the screen that moves, so it is where the eye already is.
- a WL badge, after the LoTW "L" — one letter, always in the same
  place, so the column does not shift from row to row.
- the auto-call switch, its target and its count, and the chase list:
  naming the station you are waiting for is done while watching the
  band, not in a settings tree.

Themes: DXHunter's slate with its own blue, and the same slate with
OpsLog's orange. Counted across its sources rather than guessed from
one panel — blue is 132 uses to violet's 25, and the violet is the PSK
Reporter panel alone.

Watchlist: drawn as DXHunter draws it — the callsign in the interface
font rather than monospaced, which is the difference that shows with
the two windows side by side.

FT Map: arcs no longer run off the side of the map. The map shows one
world, and a path crossing the antimeridian was drawn past 180° into
the blank space beside it — from VK that is most of them.

Cluster: "superfox", "fox/hound" and "F/H" in a comment are read as
FT8. They are WSJT-X's DXpedition transmit modes, and the comment fell
through to the band plan and came out DATA — which then decided the
band+mode verdict.

A decoder is named by what it IS: Nexus sends its packets as "Tempo",
the engine inside it, and OpsLog showed a program nobody has heard of.
2026-09-05 21:46:06 +02:00
rouggy e4a5d42b85 feat(app): auto-call, PSK Reporter analysis and the decode band change
The Wails boundary for the two features above, plus the pieces that
belong to neither:

- decodes are cut into periods PER RECEIVER, and judged 0.8 s after the
  last one arrives rather than a slot and four seconds after the period
  they belong to. That stamp is the START of the slot, thirteen seconds
  before its decodes exist, so every answer left four seconds into the
  next slot and the decoder began its call late.

- WSJT-X colouring can grey out a station already worked on this band
  AND in this mode. Its own switch, off by default: the other three
  verdicts pick out a handful of decodes, this one can match most of a
  period on a full log.

- the watch list's contest auto-add takes a list of callsigns as well
  as a pattern. A pattern collects a fleet that shares a string; it
  cannot collect the station taking part under a callsign that says
  nothing about the event.
2026-09-05 21:45:51 +02:00
rouggy 470eaf5d80 fix(pskr): a ten-minute window, both directions, and always an answer
Measured against DXHunter on the same station at the same second: 18
decodes here against 27 there.

- The window was five minutes. PSK Reporter's uploaders batch their
  reports, most of them every five, so a five-minute window catches
  about one upload cycle per station. Ten, as DXHunter has always had
  behind a label that says four.

- The history query ran once per target and only on the narrow feed.
  It now runs in both scopes and again every five minutes while a
  station is watched, which is the cadence the uploaders keep.

- It asked only what the target RECEIVED. Both directions now, so
  "who is hearing him" starts full too.

- The suggested call offset looked for a run of empty slots and said
  nothing when there was none — exactly the case it exists for: a
  hundred decodes across a 2800 Hz passband leave no gap. Failing a
  gap it names the quietest slot, ties to the higher offset, never
  above the ceiling.

Chase new: the receiver squares now follow the radius that was asked
for (it was one fixed ring whatever the setting said, so raising it
bought nothing), and the panel says what the feed is doing rather than
leaving an empty list to speak for itself. A change of hunt empties it:
its rows are verdicts reached under the old rule and nothing re-judged
them. Its own band selection, because what a station CAN work and what
is worth watching tonight are different questions.
2026-09-05 21:45:39 +02:00
rouggy a41626955e fix(autocall): the entity's verdict is not the station's
Six faults, all found on the air this evening and all in the same
feature. The decision trace added here is what found the first one:
one line per period, saying what was on the air and why each station
was refused.

- "worked" was read from the ENTITY's status, which means the country
  is in the log on this band and mode. On 10 m, where most countries
  are, twenty decodes out of twenty-one were refused as worked — the
  watched DXpedition among them. The entity decides what is NEEDED;
  the callsign's own slot decides whether calling it is a duplicate.
  candidateOf() is split out and tested because one line was wrong for
  weeks and nothing could catch it.

- A multi-answer line was read only up to its first message. MSHV
  answers two stations in one transmission ("YV5ALI RR73; F4BPO
  <HK0/PY8WW> -08") and the second half was a report to us: the engine
  saw a station working somebody else and dropped the target at the
  moment the DX was answering. The decodes panel already read every
  segment.

- The slot after a QSO belongs to our own 73. Handing straight on to
  the next station took it, switching the DX call mid-sequence, and
  the frame that closes the contact never went out whole.

- A station CALLING US is answered whether or not the log wants
  anything from it. It was refused for having nothing to gain, so a
  QSO would end, two stations would call, and both were ignored.

- Callability was tested when a station was CHOSEN and never again
  while it was held: one picked on its CQ that then answered another
  caller went on being called for the whole seven attempts.

- A watched callsign now outranks every station that is not on the
  list. Lifted one rung at a time it sat at the bottom with nothing
  needed from it, and was never reached on a busy band — the opposite
  of what putting it on the list means.

Halt is now a verdict: the station is set aside for the session rather
than released, and the chase list does not override it. The attempts
cap lets the over finish instead of cutting the call that counted it,
and a rest is a rest. Only what the decodes list is SHOWING can be
called — the panel publishes the callsigns it shows, so there is one
definition of "shown" and not two.
2026-09-05 21:45:25 +02:00
56 changed files with 5485 additions and 785 deletions
+102 -10
View File
@@ -753,6 +753,9 @@ type App struct {
// is consulted once per message.
chaseBandsMu sync.RWMutex
chaseBands map[string]bool
// The Chase new panel's OWN band filter, as the set switched off. Read per
// message like the list above, so an atomic rather than a settings lookup.
chaseNewBandsOff atomic.Value // map[string]bool
// pskr is the PSK Reporter MQTT feed, up only while the opening watch is on.
// It is the source that makes VHF detection work at all: the cluster and RBN
// carry a handful of 6 m spots where PSK Reporter carries hundreds.
@@ -773,8 +776,12 @@ type App struct {
// FT8 window and an FT4 one do not even share a period length — and one
// buffer for both cut every slot into fragments, each judged as a period of
// its own. The engine then counted a missed period several times a slot.
acPeriod map[string]string
acAt map[string]time.Time
acPeriod map[string]string
acAt map[string]time.Time
// acFed is when the last decode of the open period ARRIVED, wall clock. The
// period's own timestamp cannot answer "has it gone quiet" — it is the start
// of the slot, thirteen seconds before its decodes exist.
acFed map[string]time.Time
acTR map[string]int
acBuf map[string][]acDecode
acTX autocall.TXState
@@ -782,6 +789,15 @@ type App struct {
acLastJudge time.Time
// acTXPeriod is the last transmit period already counted — see autoCallNoteTX.
acTXPeriod string
// acJudged is the last period key each receiver has been judged on, and
// acDirty says decodes have arrived for it since. Together they let a period
// be judged AGAIN when a straggler turns up, with the whole period in hand.
acJudged map[string]string
acDirty map[string]bool
// What the decodes panel is SHOWING, and whether it is publishing at all.
// The panel owns the filters; this is its answer, not a second copy of them.
acVisible map[string]bool
acVisibleOn bool
// Self-spot throttle: when and on what frequency we last announced ourselves.
// Held in memory only — a restart legitimately re-announces the station.
selfSpotMu sync.Mutex
@@ -1172,6 +1188,7 @@ func (a *App) startup(ctx context.Context) {
audio.AlertSink = func(format string, args ...any) { a.toast(fmt.Sprintf(format, args...)) }
extsvc.LogSink = applog.Printf // log raw QRZ (and other) service responses for diagnosis
lookup.LogSink = applog.Printf // which call was queried, and why a portable lookup fell back
audio.Logf = applog.Printf // why the Listening device stayed silent, above all
db.LogSink = applog.Printf // which schema migrations ran, and how long they took
// Version and executable FIRST, before anything else can fail. Diagnosing a
// report means knowing which build produced the log, and that was previously
@@ -1653,6 +1670,7 @@ func (a *App) startup(ctx context.Context) {
a.startGridCache()
a.chaseNew = newChaseNewStore()
a.refreshChaseNew()
a.refreshChaseNewBands()
// PSK Reporter. After the operator's grid is known: without it there is no
// distance to measure and no receiver squares to filter on, so it stays down.
a.startBandOpenFeed()
@@ -2591,7 +2609,20 @@ func (a *App) switchLogbook(p profile.Profile) error {
_ = old.Close()
}
applog.Printf("logbook switched to %s for profile %q", backend, p.Name)
// EVERY worked/new verdict belonged to the OLD logbook.
//
// The award matrices above are only half of it: the in-memory worked-index
// the alert engine reads, the chase-new list, and the frontend's own cache of
// resolved spot verdicts all still hold the previous log's answers. An
// operator switching to an empty profile and back found every decode on the
// screen badged NEW — the empty log's verdicts, cached under the full one,
// and nothing short of a restart cleared them.
if a.chaseNew != nil {
a.chaseNew.clear()
}
go a.rebuildWorkedIndex()
if a.ctx != nil {
wruntime.EventsEmit(a.ctx, "spotstatus:invalidate")
wruntime.EventsEmit(a.ctx, "logbook:changed")
}
return nil
@@ -3124,7 +3155,7 @@ func (a *App) AddQSO(q qso.QSO) (id int64, err error) {
// a few lines above and is not on the copy taken at insert time.
a.syncPublishAsync(syncfolder.OpAdd, id, nil)
if a.udp != nil {
rec := adif.SingleRecordADIF(qc)
rec := adif.ForwardRecordADIF(qc)
a.udp.EmitLoggedADIF(rec)
a.udp.EmitLoggedQSOWSJT(wsjtLoggedQSO(qc), rec)
a.udpTriggerQSOLogged(qc)
@@ -8445,7 +8476,11 @@ func (a *App) SaveCATSettings(s CATSettings) error {
if s.IcomBaud <= 0 {
s.IcomBaud = 115200
}
if s.IcomAddr <= 0 || s.IcomAddr > 0xFF {
// 0x00 IS an address. Rejecting it as "unset" is what sent an operator's
// custom-address rig straight back to the IC-7610's 0x98 every time the
// settings were saved — the model dropdown snapping back with it, since it
// reads the address rather than a stored model.
if s.IcomAddr < 0 || s.IcomAddr > 0xFF {
s.IcomAddr = 0x98
}
if s.PollMs < 50 || s.PollMs > 2000 {
@@ -11786,10 +11821,34 @@ func (a *App) UploadQSOsManual(service string, ids []int64) error {
return fmt.Errorf("unknown service %q", service)
}
cfg := a.loadExternalServices()
// NOT CONFIGURED IS AN ANSWER, AND IT BELONGS HERE.
//
// The upload runs on its own goroutine and reports through the QSL Manager's
// console, which is not open when the command was given from a right-click in
// the QSO list: an upload to a service with no credentials looked exactly
// like one that worked. Refused synchronously instead, where the caller can
// show it.
if err := uploadConfigured(svc, cfg); err != nil {
return err
}
go a.runManualUpload(svc, ids, cfg)
return nil
}
// uploadConfigured reports whether a service can be uploaded to at all.
//
// The rules live in internal/extsvc, beside the uploaders that enforce them.
// Written here instead they drifted at once: Club Log was refused for a missing
// API key that nobody has ever set — OpsLog carries its own application key —
// and an operator whose live upload had worked for months was told his service
// was not configured.
func uploadConfigured(svc extsvc.Service, cfg extsvc.ExternalServices) error {
if err := extsvc.Configured(svc, cfg); err != nil {
return fmt.Errorf("%w (Settings → External services)", err)
}
return nil
}
func (a *App) runManualUpload(svc extsvc.Service, ids []int64, cfg extsvc.ExternalServices) {
emit := func(line string) {
if a.ctx != nil {
@@ -14289,7 +14348,7 @@ func (a *App) LogUDPLoggedADIF(adifText string) (int64, error) {
// path — otherwise a QSO logged FROM WSJT-X/JTDX/MSHV was never re-emitted
// to the outbound ADIF listeners (Log4OM, N1MM, gridtracker…).
if a.udp != nil {
rec := adif.SingleRecordADIF(qc)
rec := adif.ForwardRecordADIF(qc)
a.udp.EmitLoggedADIF(rec)
a.udp.EmitLoggedQSOWSJT(wsjtLoggedQSO(qc), rec)
a.udpTriggerQSOLogged(qc)
@@ -16692,10 +16751,13 @@ func (a *App) reloadAfterProfileSwitch() {
// Auto-call is per profile — attempts, the "call only" callsign, whether it
// is on at all — and it TRANSMITS. A switch that left the previous profile's
// settings running would have the wrong station calling on the wrong log.
//
// Off, exactly as at launch: a switch changes the callsign, the log and
// usually the antenna, and none of that is a state in which a transmitter
// should resume by itself because this profile's stored setting said on.
// Re-applied rather than restarted: the loop is one goroutine for the life
// of the process, and applyAutoCall clears the target when the feature is
// off in the profile just activated.
a.applyAutoCall()
// of the process.
a.disarmAutoCall("profile switch")
a.autoCallEngine().Reset()
}
@@ -18251,7 +18313,22 @@ func motorBandAllowed(bands []string, hz int64) bool {
// refreshed every couple of seconds — so a fresh command opens a short grace
// window during which TX stays inhibited even before the poll confirms motion,
// closing the gap at the start of a move.
func (a *App) noteMotorMoveCommanded() { a.motorMoveCmdNs.Store(time.Now().UnixNano()) }
// noteMotorMoveCommanded records — and ANNOUNCES — that the antenna has just
// been told to move.
//
// The transmit gag already started here; the screen did not. It waited for a
// status poll to come round and say the elements were travelling, so the
// indicator turned orange a second or more after the button was pressed, and on
// an automatic follow (band change with tracking on) the operator had no warning
// at all until the poll landed. The event lets the interface show it at the
// instant the order goes out, which is also when the transmitter is gagged —
// one moment, one appearance.
func (a *App) noteMotorMoveCommanded() {
a.motorMoveCmdNs.Store(time.Now().UnixNano())
if a.ctx != nil {
wruntime.EventsEmit(a.ctx, "motorant:move")
}
}
// applyMotorInhibit sets or clears the Flex transmit inhibit, but only when the
// active CAT backend IS a FlexRadio — the inhibit is a Flex-API feature; with any
@@ -18280,7 +18357,13 @@ func (a *App) applyMotorInhibit(on bool) {
// OR within a grace window after a commanded move — and always releases the
// inhibit when it stops (so a settings change / shutdown never leaves TX blocked).
func (a *App) motorTXInhibitLoop(c motorAntenna, bands []string, stop <-chan struct{}) {
const grace = 3 * time.Second // cover the poll latency at the very start of a move
// Just long enough to bridge ONE fast poll at the start of a move, when the
// antenna has been told to go but has not yet said it is going. It was three
// seconds, from when the status poll ran every two: a move that took a second
// left the transmitter gagged for two more, with the elements already in
// place. The antenna is now polled four times a second while it travels, so
// this only has to cover the command itself.
const grace = 900 * time.Millisecond
ticker := time.NewTicker(300 * time.Millisecond)
defer ticker.Stop()
defer a.applyMotorInhibit(false) // never leave TX blocked when the loop ends
@@ -20578,6 +20661,15 @@ func (a *App) SaveChaseSettings(cs ChaseSettings) error {
a.clusterStatusMu.Lock()
a.clusterStatusIdx = nil
a.clusterStatusMu.Unlock()
// Chase new judges each decode AS IT ARRIVES and keeps only what was new at
// that moment, so its list is a set of verdicts reached under the old rule —
// and nothing in it would ever be re-judged. Switching to "new only" left
// rows listed that are merely unconfirmed; switching the other way could not
// bring back what had already been refused. Emptied, it refills from the
// live feed within a period or two, under the rule now in force.
if a.chaseNew != nil {
a.chaseNew.clear()
}
// The frontend caches resolved verdicts and only asks about unknown keys —
// without this it kept judging half the screen under the OLD rules until a
// restart, which read as the new mode simply not working.
+1
View File
@@ -20,6 +20,7 @@ var deniedCallHashes = map[string]struct{}{
"0741c9e394b42f43191899105553b47155ddc3026da12b5360701f9c181ff123": {},
"ab4926a3a0ab76d41b5b99cd3ad0683584970c341c29427c1dfa4b3c329ce415": {},
"9d17c9c213a6cc89c12d7520bcf21c86a0cf43d17e82e74f33f3a77cb865d28a": {},
"94ee059335e587e501cc4bf90613e0814f00a7b08bc7c648fd865a2af6a22cc2": {},
}
// callDenied reports whether a callsign is on deniedCallHashes. The call is
+115 -23
View File
@@ -7,6 +7,8 @@ package main
// the spot grid, so the two windows can never disagree.
import (
"fmt"
"strconv"
"strings"
"hamlog/internal/applog"
@@ -18,6 +20,13 @@ const (
keyWsjtHighlight = "udp.wsjt.highlight"
keyWsjtFollowMode = "udp.wsjt.followmode" // spot clicks switch the decoder's mode
keyWsjtHLWorked = "udp.wsjt.highlight_worked"
// One key per verdict, holding "#RRGGBB". Only the BACKGROUND is stored: the
// text colour is computed from it, so a chosen colour can never come out
// unreadable in somebody else's window.
keyWsjtColWatchlist = "udp.wsjt.colour.watchlist"
keyWsjtColNewDXCC = "udp.wsjt.colour.new_dxcc"
keyWsjtColNewBand = "udp.wsjt.colour.new_band"
keyWsjtColWorked = "udp.wsjt.colour.worked"
)
// wsjtModes are the modes a Configure message can meaningfully ask for — the
@@ -53,8 +62,9 @@ func (a *App) ConfigureDecoderMode(mode string) {
a.udp.SendConfigureMode(mode)
}
// The palette. Fixed colours, not theme tokens — they are painted into another
// application's window, which has no idea what theme OpsLog wears.
// The DEFAULT palette. Fixed colours, not theme tokens — they are painted into
// another application's window, which has no idea what theme OpsLog wears, and
// the operator can change each of them (see WsjtHighlightColours).
var (
hlWatchlist = udp.RGB{R: 244, G: 114, B: 182} // the watchlist pink
hlNewDXCC = udp.RGB{R: 22, G: 130, B: 60} // green
@@ -64,10 +74,82 @@ var (
// Worked already, on this band and in this mode. Grey on purpose, and the
// only DIM colour of the four: the others say "look at this", and this one
// says the opposite — it has to recede, not compete with them.
hlWorked = udp.RGB{R: 75, G: 85, B: 99}
hlWorkedFg = udp.RGB{R: 203, G: 213, B: 225}
hlWorked = udp.RGB{R: 75, G: 85, B: 99}
)
// WsjtHighlightColours is the operator's palette, one background per verdict.
type WsjtHighlightColours struct {
Watchlist string `json:"watchlist"`
NewDXCC string `json:"new_dxcc"`
NewBand string `json:"new_band"`
Worked string `json:"worked"`
}
// GetWsjtHighlightColours returns the palette in "#RRGGBB", defaults included.
func (a *App) GetWsjtHighlightColours() WsjtHighlightColours {
return WsjtHighlightColours{
Watchlist: a.settingOr(keyWsjtColWatchlist, hexOfRGB(hlWatchlist)),
NewDXCC: a.settingOr(keyWsjtColNewDXCC, hexOfRGB(hlNewDXCC)),
NewBand: a.settingOr(keyWsjtColNewBand, hexOfRGB(hlNewBand)),
Worked: a.settingOr(keyWsjtColWorked, hexOfRGB(hlWorked)),
}
}
// SetWsjtHighlightColours stores the palette and repaints.
//
// The repaint is the whole point of clearing: the de-duplication remembers what
// it has already told each decoder, so without this a callsign keeps yesterday's
// colour until it changes verdict — and the operator, having just picked a new
// one, sees nothing happen.
func (a *App) SetWsjtHighlightColours(c WsjtHighlightColours) {
set := func(key, v, def string) {
if _, ok := parseHexRGB(v); !ok {
v = def
}
a.setSetting(key, strings.ToUpper(strings.TrimSpace(v)))
}
set(keyWsjtColWatchlist, c.Watchlist, hexOfRGB(hlWatchlist))
set(keyWsjtColNewDXCC, c.NewDXCC, hexOfRGB(hlNewDXCC))
set(keyWsjtColNewBand, c.NewBand, hexOfRGB(hlNewBand))
set(keyWsjtColWorked, c.Worked, hexOfRGB(hlWorked))
a.clearWsjtHighlights()
applog.Printf("wsjt highlight: palette changed — repainting")
}
// colourFor reads one verdict's background and picks a legible foreground.
//
// The text colour is DERIVED, never stored: an operator choosing a dark blue
// would otherwise get black text on it in somebody else's window and conclude
// the feature is broken. Rec. 601 luma, the same rule a browser's contrast
// checker uses, with the threshold where black stops being readable.
func (a *App) colourFor(key, def string) (udp.RGB, udp.RGB) {
bg, ok := parseHexRGB(a.settingOr(key, def))
if !ok {
bg, _ = parseHexRGB(def)
}
luma := (299*int(bg.R) + 587*int(bg.G) + 114*int(bg.B)) / 1000
if luma < 140 {
return bg, hlWhite
}
return bg, hlBlack
}
func hexOfRGB(c udp.RGB) string { return fmt.Sprintf("#%02X%02X%02X", c.R, c.G, c.B) }
// parseHexRGB reads "#RRGGBB" (or "RRGGBB"). Anything else is refused rather
// than half-read: a colour that silently becomes black is worse than a default.
func parseHexRGB(s string) (udp.RGB, bool) {
s = strings.TrimPrefix(strings.TrimSpace(s), "#")
if len(s) != 6 {
return udp.RGB{}, false
}
v, err := strconv.ParseUint(s, 16, 32)
if err != nil {
return udp.RGB{}, false
}
return udp.RGB{R: byte(v >> 16), G: byte(v >> 8), B: byte(v)}, true
}
// GetWsjtHighlightWorked reports whether stations already worked on this band
// and mode are greyed out as well.
//
@@ -174,42 +256,52 @@ func (a *App) maybeHighlightDecode(instance, call, band, mode string) {
// Anything else is "no colour", and the empty verdict doubles as the clear
// signal in maybeHighlightDecode.
func (a *App) decodeHighlightVerdict(call, band, mode string) (bg, fg *udp.RGB, verdict string) {
if a.watchlist != nil {
c := a.clusterStatusMaps()
// ALREADY WORKED HERE, whatever else the station is.
//
// Settled first because it is the one fact that cancels the others. A watch
// list entry worked on this band and mode stayed pink for the rest of the
// session — the list is a statement of intent, not of what is left to do, and
// the colour that means "call this one" was being shown for a station already
// in the log. From the operator's side there was no way to tell the two
// apart, which is the only thing the colours are for.
workedHere := false
if band != "" && mode != "" && c.workedCallSlots != nil {
m := strings.ToUpper(strings.TrimSpace(mode))
if c.normMode != nil {
m = c.normMode(m)
}
_, workedHere = c.workedCallSlots[strings.ToUpper(call)+"|"+strings.ToLower(band)+"|"+m]
}
if a.watchlist != nil && !workedHere {
if _, ok := a.watchlist.Match(call); ok {
c := hlWatchlist
f := hlBlack
return &c, &f, "watchlist"
bgc, fgc := a.colourFor(keyWsjtColWatchlist, hexOfRGB(hlWatchlist))
return &bgc, &fgc, "watchlist"
}
}
c := a.clusterStatusMaps()
if a.dxcc != nil {
if m, ok := a.dxcc.Lookup(call); ok && m.Entity != nil {
num := dxcc.EntityDXCC(m.Entity.Name)
ent := c.entities[num]
if ent == nil {
bgc, fgc := hlNewDXCC, hlWhite
bgc, fgc := a.colourFor(keyWsjtColNewDXCC, hexOfRGB(hlNewDXCC))
return &bgc, &fgc, "new-dxcc"
}
if band != "" {
if _, workedBand := ent.Bands[strings.ToLower(band)]; !workedBand {
bgc, fgc := hlNewBand, hlBlack
bgc, fgc := a.colourFor(keyWsjtColNewBand, hexOfRGB(hlNewBand))
return &bgc, &fgc, "new-band"
}
}
}
}
// Worked already, this exact callsign on this band in this mode — a dupe,
// judged by the same ledger and the same digital-mode grouping the cluster
// uses, so the two windows cannot disagree about what "worked" means.
if a.wsjtHLWorkedOn.Load() && band != "" && mode != "" {
m := strings.ToUpper(strings.TrimSpace(mode))
if c.normMode != nil {
m = c.normMode(m)
}
if _, ok := c.workedCallSlots[strings.ToUpper(call)+"|"+strings.ToLower(band)+"|"+m]; ok {
bgc, fgc := hlWorked, hlWorkedFg
return &bgc, &fgc, "worked"
}
// A dupe, judged by the same ledger and the same digital-mode grouping the
// cluster uses, so the two windows cannot disagree about what "worked" means.
// Its own option: on a well-filled log this matches most of a period, and a
// screen where nearly every line is coloured has stopped saying anything.
if workedHere && a.wsjtHLWorkedOn.Load() {
bgc, fgc := a.colourFor(keyWsjtColWorked, hexOfRGB(hlWorked))
return &bgc, &fgc, "worked"
}
return nil, nil, ""
}
+281 -39
View File
@@ -30,7 +30,12 @@ const (
keyAutoCallWatched = "autocall.watched_attempts"
keyAutoCallMisses = "autocall.misses"
keyAutoCallRounds = "autocall.max_rounds"
keyAutoCallRestMin = "autocall.rest_min"
// Periods, not minutes — see autocall.Settings.RestPeriods. A new key rather
// than a reinterpreted one: the old value was in minutes, and reading "2" as
// two periods or as two minutes are eight periods apart.
keyAutoCallRest = "autocall.rest_periods"
keyAutoCallOnScreen = "autocall.on_screen_only"
keyAutoCallTrace = "autocall.trace"
)
// AutoCallSettings is the panel's shape. Durations are in minutes because that
@@ -46,9 +51,28 @@ type AutoCallSettings struct {
// it, before it is given up on.
Misses int `json:"misses"`
// MaxRounds: how many series of calls one station gets in a session, and
// RestMin the pause between two of them.
MaxRounds int `json:"max_rounds"`
RestMin int `json:"rest_min"`
// RestPeriods the pause between two of them, counted in the station's own
// transmit periods.
MaxRounds int `json:"max_rounds"`
RestPeriods int `json:"rest_periods"`
// OnScreenOnly: call only what the decodes panel is showing, so its filters
// steer the transmitter as well as the eye.
OnScreenOnly bool `json:"on_screen_only"`
// Trace writes one line per period to the log: what was on the air, why
// each station was refused, and what was decided. For diagnosing "it is not
// calling anything" — and it is a line every fifteen seconds, so it is off
// unless asked for.
Trace bool `json:"trace"`
}
// intOr reads a stored integer, keeping a stored ZERO — which num() cannot,
// since it treats zero as "nothing set".
func intOr(v string, def int) int {
n, err := strconv.Atoi(strings.TrimSpace(v))
if err != nil || n < 0 {
return def
}
return n
}
func (a *App) GetAutoCallSettings() AutoCallSettings {
@@ -66,24 +90,36 @@ func (a *App) GetAutoCallSettings() AutoCallSettings {
Only: strings.ToUpper(strings.TrimSpace(a.settingOr(keyAutoCallOnly, ""))),
Attempts: num(keyAutoCallAttempts, d.Attempts),
WatchedAttempts: num(keyAutoCallWatched, d.WatchedAttempts),
Misses: num(keyAutoCallMisses, d.Misses),
MaxRounds: num(keyAutoCallRounds, d.MaxRounds),
RestMin: num(keyAutoCallRestMin, int(d.Rest/time.Minute)),
// On by default: the filters are in front of the operator, and a station
// they have hidden is one they have said they do not want.
OnScreenOnly: a.settingOr(keyAutoCallOnScreen, "1") == "1",
Trace: a.settingOr(keyAutoCallTrace, "0") == "1",
Misses: num(keyAutoCallMisses, d.Misses),
MaxRounds: num(keyAutoCallRounds, d.MaxRounds),
// Zero is meaningful (call it again next period), so it is read directly
// rather than through num(), which treats zero as "unset".
RestPeriods: intOr(a.settingOr(keyAutoCallRest, ""), d.RestPeriods),
}
}
func (a *App) SaveAutoCallSettings(s AutoCallSettings) error {
a.setSetting(keyAutoCallOn, map[bool]string{true: "1", false: "0"}[s.Enabled])
a.setSetting(keyAutoCallOnly, strings.ToUpper(strings.TrimSpace(s.Only)))
a.setSetting(keyAutoCallOnScreen, map[bool]string{true: "1", false: "0"}[s.OnScreenOnly])
a.setSetting(keyAutoCallTrace, map[bool]string{true: "1", false: "0"}[s.Trace])
for key, v := range map[string]int{
keyAutoCallAttempts: s.Attempts, keyAutoCallWatched: s.WatchedAttempts,
keyAutoCallMisses: s.Misses, keyAutoCallRounds: s.MaxRounds,
keyAutoCallRestMin: s.RestMin,
} {
if v > 0 {
a.setSetting(key, strconv.Itoa(v))
}
}
// Stored even at zero, unlike the counters above: no rest at all is a
// setting, not an empty field.
if s.RestPeriods >= 0 {
a.setSetting(keyAutoCallRest, strconv.Itoa(s.RestPeriods))
}
a.applyAutoCall()
applog.Printf("autocall: %v (only=%q, %d/%d calls, %d misses, %d rounds)",
s.Enabled, s.Only, s.Attempts, s.WatchedAttempts, s.Misses, s.MaxRounds)
@@ -121,10 +157,10 @@ func (a *App) autoCallEngine() *autocall.Engine {
func (a *App) autoCallSettings() autocall.Settings {
s := a.GetAutoCallSettings()
return autocall.Settings{
Enabled: s.Enabled, Only: s.Only,
Enabled: s.Enabled, Only: s.Only, OnScreenOnly: s.OnScreenOnly,
Attempts: s.Attempts, WatchedAttempts: s.WatchedAttempts,
Misses: s.Misses, MaxRounds: s.MaxRounds,
Rest: time.Duration(s.RestMin) * time.Minute,
RestPeriods: s.RestPeriods,
}
}
@@ -135,35 +171,63 @@ func (a *App) applyAutoCall() {
e := a.autoCallEngine()
s := a.autoCallSettings()
e.SetSettings(s)
if a.GetAutoCallSettings().Trace {
e.SetTrace(func(f string, args ...any) { applog.Printf("autocall: "+f, args...) })
} else {
e.SetTrace(nil)
}
if !s.Enabled {
e.Reset()
a.acMu.Lock()
a.acPeriod, a.acBuf = nil, nil
a.acJudged, a.acDirty = nil, nil
a.acMu.Unlock()
}
a.emitAutoCall()
}
// ResetAutoCall is the operator's restart after it gave up — and what Halt
// does, since halting means "not this station".
// ResetAutoCall is the operator's restart after the engine gave up on an
// explicit target: it clears every verdict, including the grey list.
func (a *App) ResetAutoCall() {
a.autoCallEngine().Reset()
a.emitAutoCall()
}
// HaltAutoCall is the Halt button while a call is in progress.
//
// It does NOT clear the engine's state, which is what Halt used to do: that
// wiped the rests and the rounds along with everything else, so the station the
// operator had just stopped was eligible again in the same second and the next
// period called it straight back.
func (a *App) HaltAutoCall() {
call := a.autoCallEngine().Halt()
if call != "" {
a.acMu.Lock()
a.acReason = fmt.Sprintf("%s stopped by the operator — set aside until auto-call is switched off and on", call)
a.acMu.Unlock()
applog.Printf("autocall: %s", a.acReason)
}
a.emitAutoCall()
}
// AutoCallStatus is what the toolbar shows.
type AutoCallStatus struct {
Enabled bool `json:"enabled"`
// Only is the chase list, carried in the status so the field in the decodes
// toolbar and the one in Preferences are never two versions of the truth:
// whichever is typed into, both show it.
Only string `json:"only"`
Target string `json:"target"`
Only string `json:"only"`
Target string `json:"target"`
// Waiting: what it would call if that station were not in a QSO.
Waiting string `json:"waiting"`
Calls int `json:"calls"`
Max int `json:"max"`
Misses int `json:"misses"`
MaxMiss int `json:"max_miss"`
Stopped bool `json:"stopped"`
// Greylisted counts the stations the operator has stopped this session, so
// the toolbar can say why a station on the air is never called.
Greylisted int `json:"greylisted"`
// Reason is the last decision in plain words. An auto-call that is doing
// nothing on purpose looks exactly like one that is broken.
Reason string `json:"reason"`
@@ -177,9 +241,10 @@ func (a *App) GetAutoCallStatus() AutoCallStatus {
set := a.GetAutoCallSettings()
return AutoCallStatus{
Enabled: set.Enabled, Only: set.Only,
Target: st.Target, Calls: st.Attempts, Max: st.Max,
Target: st.Target, Waiting: st.Waiting, Calls: st.Attempts, Max: st.Max,
Misses: st.Misses, MaxMiss: st.MaxMiss, Stopped: st.Stopped,
Reason: reason,
Greylisted: a.autoCallEngine().Greylisted(),
Reason: reason,
}
}
@@ -234,20 +299,60 @@ func (a *App) autoCallFeed(d autocall.Decode) {
a.acMu.Lock()
if a.acPeriod == nil {
a.acPeriod, a.acAt, a.acTR, a.acBuf = map[string]string{}, map[string]time.Time{}, map[string]int{}, map[string][]acDecode{}
a.acFed = map[string]time.Time{}
a.acJudged, a.acDirty = map[string]string{}, map[string]bool{}
}
if prev := a.acPeriod[inst]; prev != "" && prev != key {
prevAt, prevTR, buf := a.acAt[inst], a.acTR[inst], a.acBuf[inst]
// Only if something in it has NOT been judged. The buffer now outlives
// the judgement (see below), so without this the arrival of the next
// period would judge the previous one a second time on the very same
// decodes — and act on them, a slot late.
pending := a.acDirty[inst] || a.acJudged[inst] != prev
a.acPeriod[inst], a.acAt[inst], a.acTR[inst] = key, d.At, d.TRPeriod
a.acBuf[inst] = []acDecode{{d: d}}
a.acFed[inst], a.acDirty[inst] = time.Now(), true
a.acMu.Unlock()
a.autoCallJudge(inst, prev, prevAt, prevTR, buf)
// The previous period ends here whatever the sweeper was going to do: a
// decode stamped with the next slot is proof the old one is over.
if pending {
a.autoCallJudge(inst, prev, prevAt, prevTR, buf)
}
return
}
// APPENDED, never restarted. The buffer survives the period being judged,
// so a decode that arrives after the others belongs to the same period and
// is weighed against all of them.
//
// It used to be dropped and then judged on its own: the sweeper cleared the
// buffer, a straggler opened a "new" one under the same key, and the ladder
// was applied to whatever handful had come late — with the other thirty
// stations of that period nowhere in sight. A deep decode arriving a second
// after the burst is exactly the station worth calling.
a.acPeriod[inst], a.acAt[inst], a.acTR[inst] = key, d.At, d.TRPeriod
a.acFed[inst], a.acDirty[inst] = time.Now(), true
a.acBuf[inst] = append(a.acBuf[inst], acDecode{d: d})
a.acMu.Unlock()
}
// acQuiet is how long a period is left open after its LAST decode arrives.
//
// This is the whole timing budget of the feature. A decoder finishes a period
// and sends its decodes about a second before the next slot opens, so the
// answer has to be back before that boundary — a reply that arrives after it
// makes the decoder start its call several seconds into the slot, which is what
// an operator sees as "it calls late" and what a station on the other end sees
// as a message it cannot decode.
//
// It was a whole slot plus four seconds, measured from the DECODE'S OWN
// TIMESTAMP — the start of the period, not the moment it arrived — so the
// answer left about four seconds INTO the next slot, every time.
//
// 800 ms: long enough for a busy period's decodes to arrive together (measured
// in bursts of a few hundred milliseconds), short enough to answer inside the
// same second they landed.
const acQuiet = 800 * time.Millisecond
// autoCallSweep closes the periods nothing has closed for us. Called on a timer.
//
// Per receiver, because with two decoders one may fall silent while the other
@@ -273,15 +378,21 @@ func (a *App) autoCallSweep() {
if tr <= 0 {
tr = 15
}
// One slot plus a margin: decodes for a period keep arriving for a
// second or two after it ends, and judging early would count a station
// as missing that is about to be listed.
if time.Since(a.acAt[inst]) < time.Duration(tr)*time.Second+4*time.Second {
// Measured from when the last decode ARRIVED, not from the period it
// belongs to: a decode is stamped with the start of its own slot, so
// waiting "a slot plus four seconds" from that stamp is waiting until
// the middle of the NEXT slot. See acQuiet.
if time.Since(a.acFed[inst]) < acQuiet {
continue
}
// Judged once per period, and again only when something new has come in
// for it. The period itself is kept open until a decode from the NEXT one
// arrives, so a straggler is judged with the whole period behind it.
if a.acJudged[inst] == key && !a.acDirty[inst] {
continue
}
ready = append(ready, due{inst, key, a.acAt[inst], tr, a.acBuf[inst]})
delete(a.acPeriod, inst)
delete(a.acBuf, inst)
a.acJudged[inst], a.acDirty[inst] = key, false
}
a.acMu.Unlock()
for _, d := range ready {
@@ -304,7 +415,9 @@ func (a *App) autoCallSilence() {
return
}
a.acMu.Lock()
quiet := a.acPeriod[inst] == "" && time.Since(a.acLastJudge) > 20*time.Second
// Nothing pending for this receiver, and nothing judged for a while: the
// band has gone quiet under it.
quiet := !a.acDirty[inst] && time.Since(a.acLastJudge) > 20*time.Second
tr := a.acTR[inst]
a.acMu.Unlock()
if !quiet {
@@ -351,18 +464,18 @@ func (a *App) autoCallJudge(inst, key string, at time.Time, tr int, buf []acDeco
status[st.Call+"|"+st.Band+"|"+st.Mode] = st
}
chase := a.autoCallChase()
cands := make([]autocall.Candidate, 0, len(uniq))
for _, dd := range uniq {
st := status[dd.d.Call+"|"+dd.d.Band+"|"+dd.d.Mode]
cands = append(cands, autocall.Candidate{
Decode: dd.d,
Need: autoCallNeedOf(st.Status),
Watched: a.autoCallWatched(dd.d.Call),
Worked: st.Status == "worked",
})
c := candidateOf(dd.d, st, chase)
c.Watched = a.autoCallWatched(dd.d.Call)
c.Hidden = a.autoCallHidden(dd.d.Call)
cands = append(cands, c)
}
tx := a.autoCallTX()
act := a.autoCallEngine().OnPeriod(autocall.Period{
Instance: inst, Key: key, At: at, TRPeriod: tr, Decodes: cands, TX: tx,
MyCall: a.opCall,
@@ -370,6 +483,81 @@ func (a *App) autoCallJudge(inst, key string, at time.Time, tr int, buf []acDeco
a.autoCallDo(act)
}
// candidateOf turns one decode and the log's verdict on it into a candidate.
//
// Split out and kept pure because ONE line of it was wrong for weeks and
// nothing could catch it: the entity's verdict was read as the station's.
// chaseExtras is what the operator hunts BESIDES entities — the cluster's
// orthogonal markers, from the same switches that decide whether the badges are
// shown at all (Settings → DX Cluster). One answer for the eye and the
// transmitter: a marker withdrawn from the screen is not one to call for.
type chaseExtras struct{ pota, grid, pfx, county, state bool }
func candidateOf(d autocall.Decode, st SpotStatus, ch chaseExtras) autocall.Candidate {
c := autocall.Candidate{
Decode: d,
// The ENTITY's verdict decides what is still needed…
Need: autoCallNeedOf(st.Status),
// …and THIS CALLSIGN on this band and mode decides whether calling it
// would be a duplicate.
//
// Status was used for both. "worked" there means the COUNTRY is in the
// log on this band and mode, so on a band where the operator has most of
// them, nearly every station on the air was refused as already worked —
// a trace of one evening shows twenty decodes out of twenty-one turned
// away that way, the watched DXpedition among them.
Worked: st.WorkedSlot,
// The need exists only because a QSL never came: worth chasing, and worth
// less than the same need never worked at all.
Unconfirmed: st.UnconfStatus,
}
// NOTHING LEFT ON THE ENTITY, AND STILL WORTH A CALL.
//
// A prefix, a square, a county, a state, a park: never worked, orthogonal to
// the entity's verdict, and exactly what the operator ticked in the chase
// settings. They ranked at nothing-needed, so auto-call sat through a
// never-worked WPX prefix calling CQ and did not answer it.
//
// Only when the entity has nothing to add — a new band that is ALSO a new
// prefix is a new band, and says so.
if c.Need == autocall.NeedNone {
switch {
case ch.pfx && st.NewPfx:
c.Need, c.Extra, c.Unconfirmed = autocall.NeedExtra, "prefix", st.UnconfPfx
case ch.county && st.NewCounty:
c.Need, c.Extra, c.Unconfirmed = autocall.NeedExtra, "county", st.UnconfCty
case ch.state && st.NewState:
c.Need, c.Extra, c.Unconfirmed = autocall.NeedExtra, "state", st.UnconfState
case ch.grid && st.NewGrid:
c.Need, c.Extra, c.Unconfirmed = autocall.NeedExtra, "square", st.GridState == "unconf"
case ch.pota && st.NewPOTA:
c.Need, c.Extra = autocall.NeedExtra, "park"
}
}
return c
}
// autoCallChase reads the chase switches the cluster and the decode list use.
//
// Read once per period rather than per decode: they are settings-store reads,
// and the period loop runs over every station on the band.
func (a *App) autoCallChase() chaseExtras {
on := func(key string) bool {
if a.settings == nil {
return true
}
v, _ := a.settings.Get(a.ctx, "ui.opslog."+key)
return v != "0" // unset means on, as it does on the screen
}
return chaseExtras{
pota: on("chasePota"),
grid: on("chaseGrids"),
pfx: on("chasePfx"),
county: on("chaseCounty"),
state: on("chaseState"),
}
}
// autoCallDo carries out a decision and records it.
func (a *App) autoCallDo(act autocall.Action) {
if act.Reason != "" {
@@ -385,9 +573,9 @@ func (a *App) autoCallDo(act autocall.Action) {
applog.Printf("autocall: the call to %s could not be sent: %v", d.Call, err)
}
case autocall.DoHalt:
// autoTxOnly=false: stop now. The whole point of a brake is that it does
// not wait for the over in progress to finish.
if err := a.HaltDecodeTx("", false); err != nil {
// Soft: let the over finish, then stop transmitting. Hard: stop now.
// The engine decides — see Action.Soft.
if err := a.HaltDecodeTx("", act.Soft); err != nil {
applog.Printf("autocall: halt failed: %v", err)
}
}
@@ -433,6 +621,38 @@ func (a *App) autoCallSetTX(tx autocall.TXState) {
a.acMu.Unlock()
}
// SetAutoCallVisible is the decodes panel saying what it is SHOWING.
//
// The panel owns the filters and therefore owns the answer: reimplementing them
// here would give the screen and the transmitter two definitions of the same
// word, which is how they end up disagreeing. It sends the callsigns that
// survive its filters, and the engine calls nothing else.
//
// An empty list with active=false means "no filtering in force" — the panel was
// closed, or has never been opened this session — and the ladder decides alone.
func (a *App) SetAutoCallVisible(calls []string, active bool) {
set := make(map[string]bool, len(calls))
for _, c := range calls {
if c = strings.ToUpper(strings.TrimSpace(c)); c != "" {
set[c] = true
}
}
a.acMu.Lock()
a.acVisible, a.acVisibleOn = set, active
a.acMu.Unlock()
}
// autoCallHidden reports whether the panel's filters are keeping a station off
// the screen. Unknown when nothing is being published: not hidden.
func (a *App) autoCallHidden(call string) bool {
a.acMu.Lock()
defer a.acMu.Unlock()
if !a.acVisibleOn {
return false
}
return !a.acVisible[strings.ToUpper(strings.TrimSpace(call))]
}
// autoCallNeedOf maps the cluster's own status vocabulary onto the ladder. One
// vocabulary for both, so a station that reads NEW BAND in the decodes list is
// the same NEW BAND the auto-call ranks — two answers to one question is how
@@ -471,18 +691,40 @@ func (a *App) autoCallWatched(call string) bool {
return ok
}
// startAutoCall arms the engine at launch.
// startAutoCall starts the engine's loop, with auto-call OFF.
//
// The stored "on" is honoured, and the engine starts with NO target: a program
// that came up already calling a station chosen before the last shutdown is not
// something an operator can be expected to anticipate.
// It is never on from a stored value. This is the one setting in the program
// that puts the station on the air by itself, and the operator who left it on
// last night is not necessarily the one at the desk now — nor necessarily at
// the desk at all: OpsLog starts with Windows, and a rig that powers up with it
// would begin calling into an empty shack, on whatever band the radio happens
// to be on, hours after anybody decided that was a good idea.
//
// Arming it is one click, and it is a click somebody has to make.
func (a *App) startAutoCall() {
a.applyAutoCall()
a.disarmAutoCall("launch")
go a.autoCallLoop()
}
// disarmAutoCall switches auto-call off and writes that down.
//
// The setting is what the toolbar and the settings panel both read, so turning
// the engine off without storing it would show a lit switch over a silent
// transmitter — and the operator's next click, meaning "on", would send "off".
func (a *App) disarmAutoCall(why string) {
if a.settingOr(keyAutoCallOn, "0") == "1" {
applog.Printf("autocall: off at %s — it is never armed from a stored setting", why)
}
a.setSetting(keyAutoCallOn, "0")
a.applyAutoCall()
}
func (a *App) autoCallLoop() {
t := time.NewTicker(2 * time.Second)
// A quarter of a second. The sweeper is what closes a period, so its tick is
// part of the same budget as acQuiet: a two-second tick added up to two
// seconds of its own to every answer, which is most of the margin there is.
// The work per tick is a map read.
t := time.NewTicker(250 * time.Millisecond)
defer t.Stop()
for range t.C {
if a.ctx == nil {
+81
View File
@@ -0,0 +1,81 @@
package main
import (
"testing"
"hamlog/internal/autocall"
)
// The entity's verdict is not the station's.
//
// From the air: on 10 m, where most countries are already in the log, the
// engine refused twenty decodes out of twenty-one as "worked" — a watched
// DXpedition calling CQ among them — because the ENTITY's status was read as
// the station's.
// allChased is the default: every orthogonal marker ticked.
var allChased = chaseExtras{pota: true, grid: true, pfx: true, county: true, state: true}
func TestCandidateWorkedIsTheCallsignNotTheEntity(t *testing.T) {
d := autocall.Decode{Call: "J38DX", Band: "10m", Mode: "FT8", IsNew: true}
// Grenada worked on 10 m FT8, this callsign never worked: nothing is needed
// from it, and calling it is NOT a duplicate.
c := candidateOf(d, SpotStatus{Status: "worked", WorkedSlot: false}, allChased)
if c.Worked {
t.Error("a station never worked was refused because its entity was")
}
if c.Need != autocall.NeedNone {
t.Errorf("need = %v on a worked entity, want none", c.Need)
}
// The same callsign already in the log on this band and mode IS a duplicate.
if c := candidateOf(d, SpotStatus{Status: "worked", WorkedSlot: true}, allChased); !c.Worked {
t.Error("a callsign already worked on this band and mode was not flagged")
}
// And a real need still carries through, with the unconfirmed distinction.
c = candidateOf(d, SpotStatus{Status: "new-band", UnconfStatus: true}, allChased)
if c.Need != autocall.NeedBand || !c.Unconfirmed {
t.Errorf("new-band unconfirmed came through as %v (unconf=%v)", c.Need, c.Unconfirmed)
}
}
// A station whose ENTITY has nothing left to give can still be the reason the
// operator is on the band: a WPX prefix, a county, a square, a park that has
// never been worked. Reported from the air — auto-call sat through a
// never-worked prefix calling CQ and did nothing.
func TestOrthogonalMarkersAreWorthACall(t *testing.T) {
d := autocall.Decode{Call: "BH2SWB", Band: "10m", Mode: "FT8", IsNew: true}
worked := SpotStatus{Status: "worked"}
for _, tc := range []struct {
what string
st SpotStatus
want string
}{
{"prefix", SpotStatus{Status: "worked", NewPfx: true}, "prefix"},
{"county", SpotStatus{Status: "worked", NewCounty: true}, "county"},
{"state", SpotStatus{Status: "worked", NewState: true}, "state"},
{"square", SpotStatus{Status: "worked", NewGrid: true}, "square"},
{"park", SpotStatus{Status: "worked", NewPOTA: true}, "park"},
} {
c := candidateOf(d, tc.st, allChased)
if c.Need != autocall.NeedExtra || c.Extra != tc.want {
t.Errorf("%s: need=%v extra=%q, want extra %q", tc.what, c.Need, c.Extra, tc.want)
}
// And not when the operator does not chase that kind of thing: the
// switch that withdraws the badge withdraws the call with it.
if c := candidateOf(d, tc.st, chaseExtras{}); c.Need != autocall.NeedNone {
t.Errorf("%s: called for a marker the operator does not chase", tc.what)
}
}
// It is the LOWEST rung: a real need on the entity still says what it is.
if c := candidateOf(d, SpotStatus{Status: "new-band", NewPfx: true}, allChased); c.Need != autocall.NeedBand {
t.Errorf("need = %v — a new band that is also a new prefix is a new band", c.Need)
}
// Nothing anywhere is still nothing.
if c := candidateOf(d, worked, allChased); c.Need != autocall.NeedNone {
t.Errorf("need = %v on a station with nothing to gain", c.Need)
}
}
+122
View File
@@ -1,4 +1,126 @@
[
{
"version": "0.27.15",
"date": "",
"en": [
"[NEW] The WSJT-X / JTDX highlight colours are yours to choose (Settings → UDP), one per verdict — watch list, new DXCC, new band, worked. Only the background is set: the text colour is worked out from it, so a chosen colour cannot come back unreadable in the decoders window. The “grey out stations already worked” switch keeps its purpose — it decides WHETHER dupes are marked, not what colour they are — and is now called “Mark stations already worked”.",
"[NEW] Rotor dial: a circular scale and a beam instead of an arrow. The square ring made a marker at 45° sit further from the centre than one at north — a dial is read by angle, so the ring it is read against is now the same distance away all the way round. The antenna is drawn as a sector that fades outwards, which is the shape of the thing it stands for; where the mouse would send it appears in the same shape in orange, and its azimuth in place of the current heading while you aim. Green for where the antenna is, orange for where it would go, yellow for what was ordered — the second lobe of a bidirectional Ultrabeam and the dashed boom are unchanged. Design from EC1KD again.",
"WSJT-X highlighting: a watch-list station already worked on this band and mode is no longer painted as one to call. The list is a statement of intent, not of what is left to do, and its pink outranked everything — including the log — so a station already worked stayed pink for the session with no way to tell it from one still needed.",
"Motorised antenna: the transmitter is released as soon as the elements stop. Three delays were stacked between the antenna finishing and the operator being allowed to call — the antenna polled every two seconds, the transmit gag held for three after the command whatever the antenna said, and the screen refreshed every three. Both the Ultrabeam and the SteppIR are now polled four times a second WHILE IT MOVES (and left at two seconds when it is still, where nothing changes), the gag only bridges the command itself, and the widget follows at half a second. The SteppIR also reports a commanded move at once, as the Ultrabeam already did: it says nothing until its own poll comes round, so the shortened gag would otherwise have released the transmitter in the middle of a move.",
"Motorised antenna: the indicator turns amber the instant the move is ORDERED, from a button or from an automatic band change with tracking on, instead of waiting for the antenna to say it is moving. The transmit gag already started there; the screen did not, so the two disagreed by a second or more — and on a follow there was no warning at all until a poll landed.",
"Icom network audio starts at once instead of half a minute later. The message that authorises the stream is sent during the login, before the audio socket exists — so the rig was told to send audio to a port nothing was bound to, got a port-unreachable back, and only resumed when its own retry timer came round. It is sent once more as soon as the port is listening.",
"Icom over the network: when CI-V goes quiet while the experimental RX audio stream is still delivering, the log now says so and names the switch to try. The two share the rigs session, and the shape in the field is exactly that — hundreds of audio packets arriving, not one CI-V reply, the watchdog tearing the session down, and the whole thing starting again. The silence report also lists the last eight CI-V commands sent: a rig that answers at connect and then never again has usually been sent something it does not like, and a count of unanswered commands never said which one.",
"Icom over the network: a rig left in standby no longer sits in a dial-and-drop loop. The clock that bounds “the control link answers but no CI-V comes back” belongs to a session and was never cleared when a new one opened, so every fresh session started already past its grace — torn down at once, redialled twenty seconds later, and torn down again for as long as the radio was asleep. Silent since connect is now read as what it is: a rig in standby, with the session kept so it can be woken.",
"The Icom console appears whenever the configured radio is an Icom, not only once the rig is talking — the console is where the power-ON button lives, so it used to be missing at the one moment it was needed. The consoles configured backend also follows a radio switched from the status bar, instead of waiting for a trip through Settings and a Save that changed nothing.",
"Audio: the Listening device now says when it cannot be opened. A device unplugged, renamed by Windows or unable to run at 16 kHz failed silently while everything upstream reported success — the stream up, the packets arriving, the monitor started — which is the whole of “I turned the sound on and nothing comes out”. The log also says, once, whether the network RX audio is reaching the speakers or arriving with nobody listening.",
"ADIF export: a record is written on one line again. ADDRESS is a multi-line field by the standard and callbooks and other loggers fill it that way — “Kabul”, four blank lines, “Afghanistan” — and OpsLog wrote it out as it was, so a record ran down a dozen lines with the next apparently starting in the middle of the page. Line breaks inside a value are now joined with a comma, which is how an address reads on one line anyway. The files were always valid (ADIF counts bytes); they were unreadable.",
"Club Log uploads are no longer refused as “not configured”. The check added for services with no credentials demanded a Club Log API key, which nobody has ever set — OpsLog carries its own application key — so an operator whose live upload had worked for months was turned away when sending QSOs by hand. Each services requirements now live beside the uploader that enforces them, and the message names the fields that are actually missing.",
"FT map: the callsign, square and report show on hover again. The invisible circle that catches the clicks sits on top of the dot, so it takes the hover too — and the label was bound only to the dot underneath, which left the map silent from the moment the stations became clickable."
],
"fr": [
"[NEW] Les couleurs de mise en évidence WSJT-X / JTDX sont au choix (Réglages → UDP), une par verdict — watchlist, nouveau DXCC, nouvelle bande, contactée. Seul le fond se règle : la couleur du texte en est déduite, pour quune couleur choisie ne revienne jamais illisible dans la fenêtre du décodeur. Loption « griser les stations déjà contactées » garde sa raison d’être — elle décide SI les doublons sont marqués, pas de quelle couleur — et sappelle désormais « Marquer les stations déjà contactées ».",
"[NEW] Cadran rotor : échelle circulaire et faisceau au lieu dune flèche. Lanneau carré plaçait un repère à 45° plus loin du centre quun repère au nord — un cadran se lit par langle, donc lanneau qui sert de référence est désormais à la même distance tout autour. Lantenne est dessinée comme un secteur qui sestompe vers lextérieur, ce qui est la forme de ce quil représente ; là où la souris lenverrait apparaît dans la même forme en orange, et son azimut à la place du cap courant pendant quon vise. Vert pour où lantenne est, orange pour où elle irait, jaune pour ce qui a été demandé — le deuxième lobe dun Ultrabeam bidirectionnel et le boom en pointillés sont inchangés. Design dEC1KD, encore.",
"Mise en évidence WSJT-X : une station de la watchlist déjà contactée sur cette bande et ce mode nest plus peinte comme une station à appeler. La liste dit une intention, pas ce quil reste à faire, et son rose passait devant tout — y compris le carnet — si bien quune station déjà faite restait rose toute la session, sans moyen de la distinguer dune station encore à faire.",
"Antenne motorisée : l’émission est rendue dès que les éléments sarrêtent. Trois délais sajoutaient entre la fin du mouvement et le droit dappeler — lantenne interrogée toutes les deux secondes, le blocage d’émission maintenu trois secondes après la commande quoi quen dise lantenne, et l’écran rafraîchi toutes les trois. LUltrabeam comme la SteppIR sont désormais interrogées quatre fois par seconde PENDANT quelle bouge (et laissée à deux secondes à larrêt, où rien ne change), le blocage ne couvre plus que la commande elle-même, et le widget suit à la demi-seconde. La SteppIR signale aussi un mouvement dès quil est commandé, comme le faisait déjà lUltrabeam : elle ne dit rien avant sa propre lecture, et le blocage raccourci aurait sinon rendu l’émission en plein mouvement.",
"Antenne motorisée : lindicateur passe à lambre à linstant où le mouvement est COMMANDÉ, par un bouton comme par un changement de bande automatique quand le suivi est actif, au lieu dattendre que lantenne dise quelle bouge. Le blocage d’émission démarrait déjà là ; l’écran non, et les deux se contredisaient dune seconde ou plus — sur un suivi, il ny avait aucun signe avant larrivée dune lecture.",
"Laudio réseau Icom démarre tout de suite au lieu dune demi-minute plus tard. Le message qui autorise le flux part pendant la connexion, avant que la prise audio nexiste : le poste se voyait donc demander d’émettre vers un port où personne n’écoutait, recevait un « port injoignable » en retour, et ne reprenait quau tour suivant de son propre minuteur. Il est renvoyé dès que le port écoute.",
"Icom en réseau : quand le CI-V devient muet alors que le flux audio expérimental continue darriver, le journal le dit et nomme loption à essayer. Les deux partagent la session du poste, et cest exactement la forme observée en vrai — des centaines de paquets audio, pas une réponse CI-V, le chien de garde qui coupe la session, et tout qui recommence. Le rapport de silence liste aussi les huit dernières commandes CI-V envoyées : un poste qui répond à la connexion puis plus jamais sest en général vu envoyer quelque chose quil naime pas, et un compteur de commandes sans réponse na jamais dit laquelle.",
"Icom en réseau : un poste laissé en veille ne tourne plus en boucle connexion/déconnexion. Lhorloge qui borne « la liaison de contrôle répond mais aucun CI-V ne revient » appartient à une session et n’était jamais remise à zéro à louverture de la suivante : chaque nouvelle session démarrait déjà au-delà de son délai de grâce — coupée aussitôt, rappelée vingt secondes plus tard, recoupée, aussi longtemps que la radio dormait. « Silencieux depuis la connexion » se lit désormais pour ce que cest : un poste en veille, dont on garde la session pour pouvoir le réveiller.",
"La console Icom saffiche dès que la radio configurée est un Icom, et pas seulement quand le poste parle — cest là que se trouve le bouton dallumage, il manquait donc au seul moment où il servait. Le backend configuré suit aussi un changement de radio fait depuis la barre d’état, au lieu dattendre un passage dans les réglages et un « Enregistrer » qui ne changeait rien.",
"Audio : le périphérique d’écoute signale désormais quand il ne peut pas souvrir. Un périphérique débranché, renommé par Windows ou incapable de fonctionner en 16 kHz échouait en silence pendant que tout en amont annonçait le succès — flux ouvert, paquets reçus, moniteur démarré — ce qui est exactement le « jai remis le son et rien ne sort ». Le journal dit aussi, une fois, si laudio réseau atteint les haut-parleurs ou arrive sans que personne n’écoute.",
"Export ADIF : un enregistrement tient de nouveau sur une ligne. ADDRESS est un champ multiligne selon la norme, et les callbooks comme les autres logiciels le remplissent ainsi — « Kabul », quatre lignes vides, « Afghanistan » — quOpsLog recopiait tel quel : un enregistrement s’étalait sur une douzaine de lignes, le suivant semblant commencer au milieu de la page. Les retours à la ligne dans une valeur sont désormais réunis par une virgule, ce qui est de toute façon la façon de lire une adresse sur une ligne. Les fichiers étaient valides (lADIF compte les octets) ; ils étaient illisibles.",
"Les envois vers Club Log ne sont plus refusés comme « non configuré ». Le contrôle ajouté pour les services sans identifiants réclamait une clé API Club Log que personne na jamais saisie — OpsLog embarque la sienne — et un opérateur dont lenvoi automatique fonctionnait depuis des mois se voyait éconduit au moment denvoyer des QSO à la main. Les exigences de chaque service vivent désormais à côté du code qui les applique, et le message nomme les champs réellement manquants.",
"Carte FTx : lindicatif, le locator et le report réapparaissent au survol. Le cercle invisible qui capte les clics est au-dessus du point, donc il capte aussi le survol — et l’étiquette n’était liée quau point du dessous, ce qui rendait la carte muette dès que les stations sont devenues cliquables."
]
},
{
"version": "0.27.14",
"date": "",
"en": [
"[NEW] The mouse wheel steps the RST fields, in the entry strip and in the QSO editor. It counts the way an operator does — 57, 58, 59, 59+5, 59+10, 59+15, 59+20 — one S-unit up to nine and then five decibels at a time, and one decibel on a digital report. R and T do not move. The dropdown beside them lists the reports worth having to hand, not every legal one, so the wheel works on the value rather than walking the list.",
"[NEW] The world map opens centred on YOUR square, not on Greenwich. Centred on 0° it left an Australian looking at their own country in the bottom-right corner with every path running off both edges; centred on their own longitude the same map reads the way their antenna does — the Americas to the east, Europe and Africa to the west. The latitude leans towards your hemisphere without following you to the pole, and a view you have panned to yourself still wins.",
"The world map now waits for the stations square before painting. It used to draw the world at 0° and then move to your longitude, fetching a screenful of tiles and discarding it on every first run; it is built once, knowing where it is looking. A profile with no locator still gets the default view after a moment rather than a blank panel.",
"[NEW] The FT decodes map and the grid-square map remember where you left them — centre and zoom, portable with the data folder like the world maps own view. Panning a map is the operator saying which part of the world they are working, and it was being thrown away on every tab switch.",
"[NEW] FT map: the station dots answer the same two gestures as the decodes list — one click takes the callsign into the entry, two answer it. The hit area is wider than the dot, and a double click no longer zooms the map on its way through.",
"The auto-call readout moved out of the Auto button and beside it: the station being called is the biggest thing on the row, the calls and the missed periods each carry a label instead of reading as one number, and a station being waited for shows with an hourglass. The button had been changing width every period.",
"Auto-call: the rest between two series is counted in the stations own overs, not in minutes, and is ONE by default. Two minutes is four overs on FT8 — by then the DX has worked four other callers and half the time it has gone. Seven calls, one over listened through, and it goes again if the station is still there (Settings → DXHunter, “Rest (overs)”).",
"Auto-call sees a decode that arrives after the others. A decoder sends a period in a burst and stragglers follow — a deep decode a second behind the rest — and the straggler was judged on its own, with the thirty stations of its own period nowhere in sight. The period now stays open until the next one starts, and a late arrival is weighed against all of it.",
"Auto-call: a period the station was decoded in is never counted as a miss. A period is judged more than once — the decodes arrive in a burst and stragglers follow — and a later judgement holds a partial view of it, not evidence of absence: a station answering in that very period showed “1/3 missed” against it.",
"Auto-call never parks a watched callsign. After a few series of unanswered calls a station is set aside for the session — the right answer for one the LOG picked out, the wrong one for a station YOU named: a DXpedition running a pileup takes more than two series to get through to, which is exactly why it is on the list. The rest between series still applies.",
"PSK Reporter panel: with the whole-band scope, clicking a decode no longer resets the report count to zero. The window there belongs to the BAND — every FTx report on it, filtered by target only when the analysis is drawn — and it was being emptied on every target change, throwing away an hour of evidence at the exact moment it was worth something. The narrow scope still clears it, because there the window is one stations.",
"Changing mode with a callsign in the field now fixes the report. The “the operator chose this report” flag was holding across a change of mode, where it means nothing — “+00” is not a weak SSB report, it is not a report at all — and anything that fills the field from the rig (the S-meter readouts in the rig consoles) sets that flag too, so it could stay in the wrong notation for the whole QSO. A judgement that can be carried across is carried (57 → 579, 599 → 59); otherwise the modes preset answers.",
"Icom CI-V: address 00 can be set, and “Other (custom address)” stays chosen. Zero was treated as “not configured” and every save put the rig back to the IC-7610s 98 — the model list following it, since it is derived from the address rather than stored.",
"Cloudlog / Wavelog upload: a simplex contact is no longer uploaded as split. Every QSO carried a receive band and frequency equal to the transmit side, and Wavelog draws both — an ordinary FT8 contact read “17m/17m”. In ADIF an absent BAND_RX means “same as transmit”, so they are now written only when they differ. The record forwarded to another logger on the UDP link still carries them in full (Log4OM reads BAND_RX).",
"Right-click → Send to: an upload to a service with no credentials is refused, and says which ones are missing and where. It used to run on its own and report into the QSL Managers console, which is not open when the command came from the QSO list — so it looked exactly like an upload that worked. Cloudlog / Wavelog and HamQTH also name themselves properly in the toast.",
"Cluster: “S/F” in a spot comment is read as FT8, alongside “superfox”, “sfox” and “F/H”. They are all the same DXpedition transmit mode, and the comment was falling through to the band plan and coming out DATA."
],
"fr": [
"[NEW] La molette fait défiler les champs RST, dans la barre de saisie comme dans l’éditeur de QSO. Elle compte comme un opérateur — 57, 58, 59, 59+5, 59+10, 59+15, 59+20 — un point S jusqu’à neuf puis cinq décibels à la fois, et un décibel sur un report numérique. R et T ne bougent pas. La liste déroulante à côté contient les reports quon veut sous la main, pas tous les reports légaux : la molette agit donc sur la valeur plutôt que de parcourir la liste.",
"[NEW] La carte du monde souvre centrée sur VOTRE locator, plus sur Greenwich. Centrée sur 0°, elle laissait un Australien avec son pays dans le coin en bas à droite et tous les trajets qui sortaient des deux bords ; centrée sur sa longitude, la même carte se lit comme son antenne travaille — les Amériques à lest, lEurope et lAfrique à louest. La latitude penche vers votre hémisphère sans vous suivre jusquau pôle, et une vue que vous avez déplacée vous-même reste prioritaire.",
"La carte du monde attend désormais le locator de la station avant de peindre. Elle dessinait le monde à 0° puis se déplaçait sur votre longitude, chargeant un écran de tuiles jeté aussitôt à chaque premier lancement ; elle est construite une fois, en sachant où elle regarde. Un profil sans locator obtient toujours la vue par défaut après un instant, pas un panneau vide.",
"[NEW] La carte des décodages FTx et la carte des locators retiennent où vous les avez laissées — centre et zoom, portables avec le dossier de données comme la vue de la carte du monde. Déplacer une carte, cest dire quelle partie du monde on travaille, et c’était jeté à chaque changement donglet.",
"[NEW] Carte FTx : les points des stations répondent aux mêmes deux gestes que la liste des décodages — un clic met lindicatif dans la saisie, deux lappellent. La zone cliquable est plus large que le point, et un double clic ne zoome plus la carte au passage.",
"Laffichage de lauto-call sort du bouton Auto pour se placer à côté : la station appelée est l’élément le plus lisible de la ligne, les appels et les périodes ratées portent chacun leur étiquette au lieu de se lire comme un seul nombre, et une station attendue saffiche avec un sablier. Le bouton changeait de largeur à chaque période.",
"Auto-call : le repos entre deux séries se compte en tours de la station, plus en minutes, et vaut UN par défaut. Deux minutes, cest quatre tours en FT8 — le DX a travaillé quatre autres appelants entre-temps, et la moitié du temps il est parti. Sept appels, un tour écouté, et ça repart si la station est toujours là (Réglages → DXHunter, « Repos (tours) »).",
"Lauto-call voit un décodage qui arrive après les autres. Un décodeur envoie une période en rafale, puis les retardataires — un décodage « deep » une seconde plus tard — et le retardataire était jugé tout seul, sans les trente stations de sa propre période. La période reste maintenant ouverte jusquau début de la suivante, et un arrivant tardif est pesé face à lensemble.",
"Auto-call : une période où la station a été décodée nest plus comptée comme un raté. Une période est jugée plusieurs fois — les décodages arrivent en rafale puis les retardataires — et un jugement tardif nen donne quune vue partielle, pas la preuve dune absence : une station qui répondait dans cette période exacte se voyait compter « 1/3 raté ».",
"Lauto-call ne met jamais de côté un indicatif de la watchlist. Après quelques séries dappels sans réponse, une station est écartée pour la session — la bonne réponse pour une station choisie par le CARNET, la mauvaise pour une station que VOUS avez nommée : un DX en pile-up demande plus de deux séries pour passer, et cest précisément pour ça quil est sur la liste. Le repos entre séries sapplique toujours.",
"Panneau PSK Reporter : en portée « toute la bande », cliquer sur un décodage ne remet plus le nombre de reports à zéro. La fenêtre appartient là à la BANDE — tous les reports FTx qui y circulent, filtrés par cible seulement à laffichage — et elle était vidée à chaque changement de cible, jetant une heure dobservations au moment précis où elles servent. La portée étroite continue de la vider : là, la fenêtre est celle dune seule station.",
"Changer de mode avec un indicatif dans le champ corrige désormais le report. Le drapeau « lopérateur a choisi ce report » tenait au travers dun changement de mode, où il ne veut rien dire — « +00 » nest pas un report SSB faible, ce nest pas un report du tout — et tout ce qui remplit le champ depuis le poste (les lectures S-mètre des consoles) lève ce drapeau aussi : la notation pouvait rester fausse pour tout le QSO. Un jugement transposable lest (57 → 579, 599 → 59) ; sinon le préréglage du mode répond.",
"Icom CI-V : ladresse 00 peut être saisie, et « Other (custom address) » reste sélectionné. Le zéro était pris pour « non configuré » et chaque enregistrement remettait le poste sur le 98 de lIC-7610 — la liste des modèles suivant, puisquelle est déduite de ladresse et non enregistrée.",
"Upload Cloudlog / Wavelog : un contact simplex nest plus envoyé comme un split. Chaque QSO portait une bande et une fréquence de réception égales à l’émission, et Wavelog affiche les deux — un FT8 ordinaire se lisait « 17m/17m ». En ADIF, un BAND_RX absent signifie « identique à l’émission » : ils ne sont donc écrits que sils diffèrent. Lenregistrement transmis à un autre logiciel par UDP les porte toujours en entier (Log4OM lit BAND_RX).",
"Clic droit → Envoyer vers : un envoi vers un service non configuré est refusé, en disant ce qui manque et où. Il partait tout seul et rendait compte dans la console du gestionnaire QSL, qui nest pas ouverte quand la commande vient de la liste des QSO — ça ressemblait donc exactement à un envoi réussi. Cloudlog / Wavelog et HamQTH sannoncent aussi sous leur nom dans le message.",
"Cluster : « S/F » dans un commentaire de spot est lu comme du FT8, au même titre que « superfox », « sfox » et « F/H ». Cest le même mode d’émission DXpédition, et le commentaire retombait sur le plan de bande pour ressortir en DATA."
]
},
{
"version": "0.27.13",
"date": "",
"en": [
"[NEW] Rotor widget redrawn: a night world map behind a square azimuth scale, an orange pointer following the mouse so a click lands where it is aimed, a yellow marker on the azimuth ordered until the antenna gets there, and quick turns in columns of six. The Ultrabeam boom and its second lobe are still drawn, and Station Control keeps the plain dial — dial only, since anything under it is pushed off the bottom of the row. Design contributed by EC1KD — thank you.",
"[NEW] Settings → Rotator now chooses the dial: the new world-map compass or the classic one. Both are kept — one reads across the shack, the other is the compact dial that was there before — and the choice applies to the docked widget and to Station Control at once.",
"Rotor widget: the Stop button no longer flickers on a rotor standing still. Movement was inferred from a one-degree change, which is less than the jitter a controller reports at rest.",
"[NEW] A docked watch-list panel, showing only what is ON THE AIR and still needed — one line per band and mode — callsign, band, mode, what it is worth, how long ago — freshest first, click to tune, with the clusters own NEW DXCC / NEW BAND / NEW SLOT badge on each row. The Watchlist tab is a tab, and an operator working FT8 lives on the decodes one: a station you asked to be told about was appearing on a screen you were not looking at. Turn it on with the bell in the toolbar.",
"[NEW] FT decodes: a distance column, next to the square it is computed from and in your own unit (km or miles). Rounded to whole units — a four-character grid is a square tens of kilometres wide and nothing finer is honest.",
"[NEW] The PSK Reporter panel switches to the station auto-call is WAITING for (the hourglass), while nothing is being called. Its analysis takes a history query and a period or two of live reports to fill, so starting it when the DX finally comes free is starting it too late — the wait is exactly what it should be spent on.",
"[NEW] Chase new: a band selection of its own, under the option (160 m to 70 cm). The stations band list still applies underneath — this one says what is worth WATCHING tonight.",
"Chase new: the panel says what the feed is doing — up or down, how many reports it has taken, how many receiver squares it is subscribed to. An empty list said nothing about whether anything was arriving at all.",
"FT decodes: a receiver column appears when more than one decoder feeds the merged list, and the list empties for a receiver that changes band — half a screen of stations no longer reachable is worse than an empty one.",
"FT decodes: a pink WL badge marks a station on your watch list, and the period clock turns red while transmitting. It is the one thing on the screen that moves, so “am I on the air” is readable from across the room.",
"FT decodes: a message addressed to YOU is set in green, whole and bold, with a green edge on the row — read from the far side of the shack. The station you are calling keeps a light tint and its callsign picked out in red: most of what it sends goes to other people, and colouring those lines the same way said you were in a QSO you were not in.",
"Cluster: “superfox”, “super fox”, “fox/hound” and “F/H” in a spot comment are read as FT8. They are WSJT-Xs DXpedition transmit modes, not modes of their own, and the comment fell through to the bands default.",
"Auto-call: what it calls, and in what order. It answers only what the decodes list is SHOWING — the filters above it (CQ only, LoTW only, the category chips, continents, minimum report, search) now steer the transmitter as well as the eye, and the separate “LoTW users only” option is gone. A new prefix, county, state, square or park is worth a call too, at the foot of the ladder and only for the kinds you chase (Settings → DX Cluster). A watched callsign outranks everything not on the list, a real need beats an unconfirmed one at the same level, and a better station may take over from one that has not answered yet — never from a QSO in progress.",
"Auto-call: it calls THROUGH a pileup. It used to give up the moment the station it was calling answered somebody else — which is precisely how a DX with a queue behaves, and the only way to be the next one is to keep calling while it works the others. Still bounded by the call and miss counters, and a station in mid-exchange is still never CHOSEN as a new target.",
"Auto-call: safety and control. It is always OFF at launch and after a profile switch, never armed from a stored setting — it is the one feature that puts the station on the air by itself, and OpsLog starts with Windows. Halt is now a verdict: the station is set aside for the session and never called again until auto-call is switched off and on. It says what it is waiting for, showing a wanted station that is working somebody else next to the Auto button. And it can log every decision (Settings → DXHunter): one line per period saying what was on the air and why each station was refused.",
"Auto-call: a round of fixes from on-air use. It no longer cuts your own 73 short, calls four to six seconds late, starts a call and drops it a second later, ignores a station calling you, misreads MSHVs two-answers-in-one-line, refuses nearly everything on the air because it read the entitys “worked” as the stations, or opens with two misses already counted against a station it has only just picked.",
"Switching profile no longer leaves the previous logbooks verdicts on the screen. Coming back from a profile with an empty log, every decode and spot stayed badged NEW until a restart: the worked-index, the chase-new list and the cached verdicts are now all dropped when the logbook changes.",
"Chase new fixes: the header counts both what the filters show and what the panel holds (“3 of 12 heard”), a stored filter set that hides everything is ignored, and switching between “new” and “new + unconfirmed” re-reads the list instead of leaving old verdicts on screen.",
"PSK Reporter panel fixes: the history is asked for in both feed scopes and refreshed every five minutes, so a target picked shortly after start-up no longer shows an empty page; the suggested transmit offset always has an answer when there is data; and the texts say ten minutes, which is the window actually used.",
"Callbook lookup: a compound callsign with a page of its OWN keeps that pages location. HP/WE9G is filed on QRZ under exactly that form, with the Panama address and square the station is operating from, and OpsLog was throwing it away — the rule that drops a home address from a portable call was applying to pages that describe the operation itself. The records own country tells the two apart. Cached lookups heal on the next read; QSOs already logged without a grid keep it empty."
],
"fr": [
"[NEW] Widget rotor redessiné : carte du monde nocturne derrière une échelle dazimut carrée, aiguille orange qui suit la souris pour quun clic parte où on vise, repère jaune sur lazimut demandé jusqu’à larrivée de lantenne, et directions rapides en colonnes de six. Le boom Ultrabeam et son deuxième lobe sont toujours tracés, et Station Control garde le cadran seul — rien en dessous, ce qui y était se retrouvait coupé en bas de la rangée. Design proposé par EC1KD — merci à lui.",
"[NEW] Réglages → Rotator permet de choisir le cadran : la nouvelle boussole carte du monde ou le cadran classique. Les deux sont conservés — lun se lit de loin, lautre est le cadran compact davant — et le choix sapplique aussitôt au widget docké comme à Station Control.",
"Widget rotor : le bouton Stop ne clignote plus sur un rotor à larrêt. Le mouvement était déduit dun changement dun degré, soit moins que le tremblement de lecture dun contrôleur au repos.",
"[NEW] Un panneau watchlist docké, qui ne montre que ce qui est EN LAIR et manque encore — une ligne par bande et mode — indicatif, bande, mode, ce que ça vaut, il y a combien de temps — le plus frais en haut, clic pour sy caler, avec le badge NEW DXCC / NEW BAND / NEW SLOT du cluster sur chaque ligne. Longlet Watchlist est un onglet, et en FT8 on vit sur celui des décodes : une station quon avait demandé à surveiller apparaissait sur un écran quon ne regardait pas. À activer avec la cloche dans la barre doutils.",
"[NEW] FT decodes : une colonne distance, à côté du locator dont elle est calculée et dans votre unité (km ou miles). Arrondie à lunité — un locator à quatre caractères est un carré de plusieurs dizaines de kilomètres, rien de plus fin ne serait honnête.",
"[NEW] Le panneau PSK Reporter bascule sur la station que lauto-call ATTEND (le sablier), tant que rien nest appelé. Son analyse met une requête dhistorique et une période ou deux à se remplir : la lancer quand le DX se libère enfin, cest la lancer trop tard — lattente sert précisément à ça.",
"[NEW] Chase new : sélection de bandes propre au panneau, sous loption (160 m à 70 cm). La liste de bandes de la station sapplique toujours en dessous — celle-ci dit ce quon veut SURVEILLER ce soir.",
"Chase new : le panneau indique l’état du flux — connecté ou non, nombre de rapports reçus, nombre de carrés de réception souscrits. Une liste vide ne disait rien sur ce qui arrivait vraiment.",
"FT decodes : une colonne récepteur apparaît quand plusieurs décodeurs alimentent la liste fusionnée, et la liste se vide pour un récepteur qui change de bande — un demi-écran de stations devenues inaccessibles est pire quun écran vide.",
"FT decodes : un badge WL rose marque une station de votre watchlist, et lhorloge de période passe au rouge en émission. Cest le seul élément qui bouge à l’écran, donc « suis-je en émission » se lit de loin.",
"FT decodes : un message qui VOUS est adressé saffiche en vert, en entier et en gras, avec un liseré vert sur la ligne — lisible de lautre bout du shack. La station que vous appelez garde une teinte légère et son indicatif en rouge : lessentiel de ce quelle émet sadresse à dautres, et colorer ces lignes pareil laissait croire à un QSO en cours.",
"Cluster : « superfox », « super fox », « fox/hound » et « F/H » dans un commentaire de spot sont lus comme du FT8. Ce sont les modes d’émission DXpédition de WSJT-X, pas des modes en soi, et le commentaire retombait sur le mode par défaut de la bande.",
"Auto-call : ce quil appelle, et dans quel ordre. Il ne répond qu’à ce que la liste des décodes AFFICHE — les filtres du dessus (CQ seul, LoTW seul, les pastilles de catégorie, les continents, le rapport minimum, la recherche) pilotent désormais l’émission autant que l’œil, et loption distincte « utilisateurs LoTW uniquement » disparaît. Un nouveau préfixe, comté, état, locator ou parc vaut aussi un appel, au dernier barreau de l’échelle et seulement pour ce que vous chassez (Réglages → DX Cluster). Un indicatif en watchlist passe devant tout ce qui ny est pas, un vrai besoin devant un besoin non confirmé de même niveau, et une meilleure station peut prendre la place dune autre qui na pas encore répondu — jamais celle dun QSO en cours.",
"Auto-call : il appelle À TRAVERS un pile-up. Il abandonnait dès que la station appelée répondait à quelquun dautre — or cest exactement ce que fait un DX avec une file, et le seul moyen d’être le suivant est de continuer à appeler pendant quil travaille les autres. Toujours borné par les compteurs dappels et de ratés, et une station en plein échange nest toujours jamais CHOISIE comme nouvelle cible.",
"Auto-call : sécurité et contrôle. Il est toujours ARRÊTÉ au lancement et après un changement de profil, jamais armé depuis un réglage enregistré — cest la seule fonction qui met la station en émission toute seule, et OpsLog démarre avec Windows. Halt devient un verdict : la station est mise de côté pour la session et nest plus appelée jusqu’à ce que lauto-call soit désactivé puis réactivé. Il dit ce quil attend, en affichant à côté du bouton Auto la station voulue qui travaille quelquun dautre. Et il peut journaliser chaque décision (Réglages → DXHunter) : une ligne par période disant ce qui était sur lair et pourquoi chaque station a été refusée.",
"Auto-call : série de corrections issues du trafic. Il ne coupe plus votre 73, nappelle plus avec quatre à six secondes de retard, ne lance plus un appel pour le couper une seconde après, ne laisse plus sans réponse une station qui vous appelle, lit correctement les doubles réponses MSHV sur une même ligne, ne refuse plus presque tout ce qui passe parce quil prenait le « worked » de lentité pour celui de la station, et ne démarre plus avec deux ratés au compteur sur une station tout juste choisie.",
"Changer de profil ne laisse plus les verdicts du carnet précédent à l’écran. En revenant dun profil au log vide, tous les décodes et spots restaient marqués NEW jusquau redémarrage : lindex des contacts, la liste chase new et les verdicts en cache sont désormais vidés au changement de carnet.",
"Chase new, corrections : len-tête compte à la fois ce que les filtres montrent et ce que le panneau contient (« 3 sur 12 entendues »), un jeu de filtres enregistré qui cache tout est ignoré, et le passage entre « new » et « new + non confirmés » relit la liste au lieu de laisser danciens verdicts à l’écran.",
"Panneau PSK Reporter, corrections : lhistorique est demandé dans les deux portées du flux et rafraîchi toutes les cinq minutes, donc une cible choisie peu après le démarrage naffiche plus une page vide ; loffset d’émission suggéré donne toujours une réponse quand il y a des données ; et les textes annoncent dix minutes, la fenêtre réellement utilisée.",
"Recherche callbook : un indicatif composé qui a sa PROPRE fiche garde la position de cette fiche. HP/WE9G est déposé sur QRZ sous cette forme exacte, avec ladresse et le locator du Panama doù la station émet, et OpsLog les jetait — la règle qui écarte ladresse personnelle dun indicatif portable sappliquait aussi aux fiches qui décrivent lopération elle-même. Cest le pays de la fiche qui les distingue. Les fiches en cache se corrigent à la lecture suivante ; les QSO déjà enregistrés sans locator le restent."
]
},
{
"version": "0.27.12",
"date": "",
+321 -69
View File
@@ -54,7 +54,7 @@ import {
GetFlexState, FlexAmpOperate,
GetPSKReporterStatus, GetLiveOpenings, GetChaseNew,
QSLViaRepairStatus, RepairQSLVia, DismissQSLViaRepair,
GetAutoCallStatus, SetAutoCall, SetAutoCallOnly, TakeAutoCallTarget, ResetAutoCall,
GetAutoCallStatus, SetAutoCall, SetAutoCallOnly, TakeAutoCallTarget, HaltAutoCall, WatchlistEntries,
} from '../wailsjs/go/main/App';
import { Combobox } from '@/components/ui/combobox';
import { applyAwardRefs, parseAwardRefs as parseManualRefs, spotRefList , withIOTARef, withRDARef } from '@/lib/awardRefs';
@@ -119,10 +119,14 @@ import { DetailsPanel, type DetailsState } from '@/components/DetailsPanel';
import { SendSpotModal, type RecentSpotQSO } from '@/components/SendSpotModal';
import { WinkeyerPanel, type WKStatus, type WKMacro } from '@/components/WinkeyerPanel';
import { RotorCompass } from '@/components/RotorCompass';
import { RotorCompassClassic } from '@/components/RotorCompassClassic';
import { WatchlistWidget } from '@/components/WatchlistWidget';
import { rotorStyle, subscribeRotorStyle } from '@/lib/rotorStyle';
import { GridSquareMap } from '@/components/GridSquareMap';
import { loadClusterMacros, visibleClusterMacros } from '@/lib/clusterMacros';
import { DecodesPanel, type Decode as DecodeRow, type TxMsg as TxMsgRow } from '@/components/DecodesPanel';
import { PSKReporterPanel } from '@/components/PSKReporterPanel';
import { decoderName } from '@/lib/decoderName';
import { subscribeRotorHeading, pokeRotorHeading } from '@/lib/rotorHeading';
import { writeUiPref } from '@/lib/uiPref';
import { formatDateTimeUTC } from '@/lib/dateFormat';
@@ -146,6 +150,7 @@ import { cn } from '@/lib/utils';
import { pathBetween, pathBetweenLatLon, gridToLatLon, latLonToGrid } from '@/lib/maidenhead';
import { flagURL } from '@/lib/flags';
import { LogViewer } from '@/components/LogViewer';
import { convertRST, rstFitsMode, stepRST } from '@/lib/rst';
type QSO = QSOForm;
type ImportResult = adifModels.ImportResult;
@@ -300,8 +305,12 @@ function FreqWheelDisplay({ mhz, onNudge, className, placeholder = '—.——
// 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 }: {
function RadioChip({ catUp, catState, onOpenSettings, onRadioSwitched }: {
catUp: boolean; catState: any; onOpenSettings: () => void;
// Switching radio here IS a settings change — the chosen entry becomes the CAT
// settings — so whatever reads those has to be told. Two Icoms swapped for one
// another never change the live backend name, and nothing else would notice.
onRadioSwitched?: () => void;
}) {
const [radios, setRadios] = useState<any[]>([]);
const [open, setOpen] = useState(false);
@@ -366,7 +375,7 @@ function RadioChip({ catUp, catState, onOpenSettings }: {
onClick={() => {
setOpen(false);
if (r.active) return;
SetActiveRadio(r.id).then(load).catch(() => {});
SetActiveRadio(r.id).then(() => { load(); onRadioSwitched?.(); }).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')}
@@ -653,6 +662,11 @@ export default function App() {
useEffect(() => { rstListsRef.current = rstLists; }, [rstLists]);
const [rstSent, setRstSent] = useState('59');
const [rstRcvd, setRstRcvd] = useState('59');
// Read by applyModePreset, which runs from those same long-lived closures.
const rstSentRef = useRef(rstSent);
const rstRcvdRef = useRef(rstRcvd);
useEffect(() => { rstSentRef.current = rstSent; }, [rstSent]);
useEffect(() => { rstRcvdRef.current = rstRcvd; }, [rstRcvd]);
const [grid, setGrid] = useState('');
const [name, setName] = useState('');
const [qth, setQth] = useState('');
@@ -707,6 +721,15 @@ export default function App() {
// hide the rig ON/OFF buttons on USB, where the interface is unpowered when the
// rig is off so power-ON can't work).
const [catBackend, setCatBackend] = useState('');
// icomConfigured is "this station's radio IS an Icom", from the settings
// rather than from the link.
//
// The console used to appear only once the rig was talking. Switching to an
// Icom that was switched OFF therefore showed no console at all — and the
// console is where the ON button lives, so the one moment the button exists
// for was the one moment it could not be reached.
const icomConfigured = catBackend === 'icom' || catBackend === 'icom-net';
const icomShown = catState.backend === 'icom' || icomConfigured;
// Live space-weather (solar flux / sunspots / A / K) for the header strip.
// Loaded on mount, refreshed on the backend 'solar:update' event, plus a slow
// fallback poll. These same numbers are stamped onto each logged QSO.
@@ -2406,6 +2429,17 @@ export default function App() {
// the watchlist panel: a call can be added from the cluster or the
// DXpeditions tab, and the old inline message lived on a page nobody was
// looking at.
// The watch list as patterns, for the decodes badge. Loaded once and kept in
// step with the same event the notice below listens to — a call added from
// the cluster has to light up in the decodes list too.
const [watchPatterns, setWatchPatterns] = useState<string[]>([]);
const loadWatchPatterns = useCallback(() => {
WatchlistEntries()
.then((es: any[]) => setWatchPatterns((es ?? []).map((e: any) => String(e?.callsign ?? '')).filter(Boolean)))
.catch(() => {});
}, []);
useEffect(() => { loadWatchPatterns(); }, [loadWatchPatterns]);
useEffect(() => EventsOn('watchlist:changed', () => loadWatchPatterns()), [loadWatchPatterns]);
const [wlNotice, setWlNotice] = useState<{ call: string; added: boolean } | null>(null);
const wlNoticeTimer = useRef<number | undefined>(undefined);
useEffect(() => EventsOn('watchlist:changed', (e: any) => {
@@ -2597,6 +2631,33 @@ export default function App() {
// Staged like the cluster's, so a period arriving as one burst of fifty
// packets costs one status lookup and one render, not fifty of each.
const pendingDecodesRef = useRef<DecodeRow[]>([]);
// The band each receiver was last decoding on. A band change empties that
// receiver's list — see the flush below.
const decoderBandRef = useRef<Map<string, string>>(new Map());
// The RIG changing band empties the list too, without waiting for the
// decoder to catch up.
//
// Clicking a watchlist row or a spot tunes the radio; the decoder follows on
// its own clock and its first decode on the new band is up to a period away.
// Until then the operator reads a screen of stations from a band they have
// left — which is the moment the list is most misleading, because it looks
// current. Only the receivers that were on the band we came FROM are
// cleared: a second decoder parked on another band has not moved.
const rigBandRef = useRef<string>('');
useEffect(() => {
const band = (catState.band ?? '').toLowerCase();
const was = rigBandRef.current;
rigBandRef.current = band;
if (!band || !was || was === band) return;
const stale = new Set<string>();
decoderBandRef.current.forEach((b2, inst) => { if (b2 === was) stale.add(inst); });
if (stale.size === 0) return;
stale.forEach((inst) => decoderBandRef.current.delete(inst));
pendingDecodesRef.current = pendingDecodesRef.current.filter((d) => !stale.has(d.instance ?? ''));
setDecodes((arr) => arr.filter((d) => !stale.has(d.instance ?? '')));
setTxMsgs((arr) => arr.filter((m) => !stale.has(m.instance ?? '')));
}, [catState.band]);
const pendingDecodeTimer = useRef<number | undefined>(undefined);
// Rotor quick-turn buttons (Settings → Rotator). Same reload trigger as the
@@ -2733,6 +2794,9 @@ export default function App() {
// Portable UI toggles (mirrored to the DB via writeUiPref / syncPortablePrefs).
const [showRotor, setShowRotor] = useState(() => localStorage.getItem('opslog.showRotor') !== '0');
// Off by default: it is an alerting panel, and one that appears uninvited on
// an operator who does not keep a watch list is just a box saying "empty".
const [showWatchWidget, setShowWatchWidget] = useState(() => localStorage.getItem('opslog.showWatchWidget') === '1');
const [showAntGenius, setShowAntGenius] = useState(() => localStorage.getItem('opslog.showAntGenius') !== '0');
const [showTuner, setShowTuner] = useState(() => localStorage.getItem('opslog.showTuner') !== '0');
const [showScp, setShowScp] = useState(() => localStorage.getItem('opslog.showScp') !== '0');
@@ -2759,6 +2823,11 @@ export default function App() {
// withholding them IS the compact mode, so there is no second layout to keep
// in step with the first.
const [rotorCompact, setRotorCompact] = useState(() => localStorage.getItem('opslog.rotorCompact') === '1');
// Which dial (Settings → Rotator). Subscribed rather than re-read on close, so
// the choice shows the moment it is made — it is picked by looking at it.
const [rotorDial, setRotorDial] = useState(() => rotorStyle());
useEffect(() => subscribeRotorStyle(() => setRotorDial(rotorStyle())), []);
const Compass2 = rotorDial === 'classic' ? RotorCompassClassic : RotorCompass;
// Award code → scanned field (e.g. POTA→pota_ref, WWFF→wwff). Used to route
// picked award references to the QSO field/extras each award actually reads.
@@ -3031,15 +3100,43 @@ export default function App() {
const pokeUbStatus = useCallback(async () => {
try { const s: any = await GetUltrabeamStatus(); if (s) setUbStatus(s); } catch { /* transient */ }
}, []);
// A move was just ORDERED — from a button here or by the follow loop on a
// band change. Held for as long as it takes the antenna to answer, and no
// longer: the real status takes over the moment it arrives.
const [motorCmdAt, setMotorCmdAt] = useState(0);
const motorMoving = !!ubStatus.moving || (motorCmdAt > 0 && Date.now() - motorCmdAt < 2500);
// Three seconds while it sits still, half a second while it moves.
//
// The moving flag gags the transmitter, and this poll is the last of three
// delays between the elements stopping and the operator being allowed to call
// again — the antenna's own poll and the inhibit loop are the other two. At
// three seconds it was the largest of them: the antenna had finished, the
// radio was free, and the screen still said orange.
useEffect(() => {
let alive = true;
const tick = async () => {
try { const s: any = await GetUltrabeamStatus(); if (alive) setUbStatus(s); } catch {}
};
tick();
const id = window.setInterval(tick, 3000);
const id = window.setInterval(tick, motorMoving ? 400 : 3000);
return () => { alive = false; window.clearInterval(id); };
}, []);
}, [motorMoving]);
// The backend says it at the instant the order goes out — see
// noteMotorMoveCommanded. Read at once as well, so the antenna's own answer
// replaces the assumption as soon as there is one.
useEffect(() => {
const off = EventsOn('motorant:move', () => {
setMotorCmdAt(Date.now());
pokeUbStatus();
window.setTimeout(pokeUbStatus, 350);
// And once the window is over, so "assumed moving" stops being assumed
// even if nothing else re-renders.
window.setTimeout(() => setMotorCmdAt((v) => (Date.now() - v >= 2500 ? 0 : v)), 2600);
});
return () => { off?.(); };
}, [pokeUbStatus]);
// Poll the Antenna Genius switch for active antenna per port + the list.
// Re-read the enabled flag each tick so toggling it in Settings makes the
@@ -3209,6 +3306,15 @@ export default function App() {
setCatBackend(c.backend ?? '');
} catch {}
}, []);
// The configured backend follows every way the radio can change: the CAT
// panel's Save, a switch from the status bar's radio list, and the link
// itself reporting a different backend. It was read once at launch and after
// a Settings save only — so switching radio from the status bar left the
// console configured for the previous rig, and the Icom power buttons stayed
// hidden until the operator went into Settings and pressed Save for no
// reason.
useEffect(() => { loadCATCfg(); }, [catState.backend, loadCATCfg]);
const loadLists = useCallback(async () => {
try {
const l: ListsSettings = await GetListsSettings();
@@ -3290,15 +3396,31 @@ export default function App() {
return m;
}
function applyModePreset(m: string) {
if (rstUserEditedRef.current) return;
// AN EDIT IS ABOUT A SIGNAL, NOT ABOUT A NOTATION.
//
// The edited flag protects a report the operator chose — 57 rather than 59 —
// and it used to protect it across a change of mode as well, where it means
// nothing: "+00" is not a weak SSB report, it is not a report at all. An
// operator with a callsign in the field, switching from FT8 to SSB, was left
// with a decibel figure to log, and anything that fills the report from the
// rig (the S-meter readouts in the rig consoles) sets that flag too — so the
// field could be stuck in the wrong notation for the rest of the QSO.
//
// So the flag holds only while the report still belongs to the mode. When it
// does not, the judgement is carried across where it can be (57 → 579,
// 599 → 59) and the preset answers where it cannot.
const fits = rstFitsMode(rstSentRef.current, m) && rstFitsMode(rstRcvdRef.current, m);
if (rstUserEditedRef.current && fits) return;
// Prefer the user's configured preset RST; otherwise fall back to the mode
// category default (CW/RTTY/PSK → 599, phone → 59, digital → first option)
// so switching SSB→CW flips 59→599 even without a configured preset.
// Read through the refs, never the state: see their declaration.
const p = modePresetsRef.current.find((x) => x.name === m);
const fallback = rstOptions(m, rstListsRef.current)[0] || '';
setRstSent(p?.default_rst_sent || fallback);
setRstRcvd(p?.default_rst_rcvd || fallback);
const keep = (cur: string, preset: string) =>
(rstUserEditedRef.current && convertRST(cur, m)) || preset || fallback;
setRstSent(keep(rstSentRef.current, p?.default_rst_sent || ''));
setRstRcvd(keep(rstRcvdRef.current, p?.default_rst_rcvd || ''));
}
// Clicking a spot (cluster grid or any band map): tune the rig, set the mode,
// fill the call, pre-fill POTA, (re)start the recording. Shared so every spot
@@ -3718,9 +3840,42 @@ export default function App() {
});
}
} catch { /* status unresolved — the decode still shows, just unflagged */ }
// A BAND CHANGE empties that receiver's list.
//
// What is on 20 m says nothing about 40 m, and half a screen of stations
// that are no longer reachable is worse than an empty one: the period
// headings still march on, the rows still carry status badges, and the
// operator reads a band they have left. Per receiver — in a split view
// the other one has not moved — and only when the new band is known.
const moved = new Map<string, string>();
for (const d of batch) {
const inst = d.instance ?? '';
const band = (d.band ?? '').toLowerCase();
if (!band) continue;
const was = decoderBandRef.current.get(inst);
decoderBandRef.current.set(inst, band);
if (was && was !== band) moved.set(inst, band);
}
if (moved.size > 0) {
for (const [inst, band] of moved) {
LogUIError('decodes', `${decoderName(inst) || 'decoder'} moved to ${band.toUpperCase()} — its earlier decodes cleared`, '');
}
setTxMsgs((arr) => arr.filter((m) => !moved.has(m.instance ?? '')));
}
setDecodes((arr) => {
const cutoff = Date.now() - DECODE_KEEP_MS;
const next = [...arr, ...batch].filter((d) => Date.parse(d.at) >= cutoff);
// Rows from a receiver that has just changed band go with it — the
// batch itself is already on the new band.
const kept = moved.size === 0 ? arr : arr.filter((d) => !moved.has(d.instance ?? ''));
// The batch can straddle the change — a 300 ms flush can hold the last
// decodes of the old band and the first of the new. Only the new band
// survives for a receiver that moved.
const fresh = moved.size === 0 ? batch
: batch.filter((d) => {
const b2 = moved.get(d.instance ?? '');
return !b2 || (d.band ?? '').toLowerCase() === b2;
});
const next = [...kept, ...fresh].filter((d) => Date.parse(d.at) >= cutoff);
return next;
});
};
@@ -4476,11 +4631,16 @@ export default function App() {
const LABELS: Record<string, string> = {
qrz: 'QRZ.com', clublog: 'Club Log', lotw: 'LoTW',
hrdlog: 'HRDLog.net', eqsl: 'eQSL.cc', hamlog: 'HAMLOG.online',
hamqth: 'HamQTH', cloudlog: 'Cloudlog / Wavelog',
};
const label = LABELS[service] ?? service;
showToast(`Uploading ${ids.length} QSO${ids.length > 1 ? 's' : ''} to ${label}`);
try { await UploadQSOsManual(service, ids as any); }
catch (e: any) { setError(String(e?.message ?? e)); }
try {
// Awaited BEFORE the toast: the backend refuses a service with no
// credentials, and announcing an upload that was never started is how an
// operator concludes their QSOs are on a site they never signed up to.
await UploadQSOsManual(service, ids as any);
showToast(`Uploading ${ids.length} QSO${ids.length > 1 ? 's' : ''} to ${label}`);
} catch (e: any) { setError(String(e?.message ?? e)); }
}
// Right-click "Export filtered to ADIF (no limit)": exports every QSO that
// matches the current filter, bypassing the on-screen row threshold.
@@ -5392,12 +5552,19 @@ export default function App() {
);
const rstTxBlock = (
<div className="flex flex-col w-20" data-esm="rsttx"><Label className="mb-1 h-3.5">{t('field.rstTx')}</Label>
<Combobox value={rstSent} options={rstOptions(mode, rstLists)} commitOnType onChange={(v) => { setRstSent(v); rstUserEditedRef.current = true; }} />
{/* The wheel steps the report an S-unit on RST, a decibel on a digital
one. Wheeling is the same gesture as saying "he is a bit stronger than
that", and it beats retyping three characters between overs. */}
<Combobox value={rstSent} options={rstOptions(mode, rstLists)} commitOnType
onChange={(v) => { setRstSent(v); rstUserEditedRef.current = true; }}
onWheelStep={(d) => { setRstSent((v) => stepRST(v, d, mode)); rstUserEditedRef.current = true; }} />
</div>
);
const rstRxBlock = (
<div className="flex flex-col w-20" data-esm="rstrx"><Label className="mb-1 h-3.5">{t('field.rstRx')}</Label>
<Combobox value={rstRcvd} options={rstOptions(mode, rstLists)} commitOnType onChange={(v) => { setRstRcvd(v); rstUserEditedRef.current = true; }} />
<Combobox value={rstRcvd} options={rstOptions(mode, rstLists)} commitOnType
onChange={(v) => { setRstRcvd(v); rstUserEditedRef.current = true; }}
onWheelStep={(d) => { setRstRcvd((v) => stepRST(v, d, mode)); rstUserEditedRef.current = true; }} />
</div>
);
// DX country flag, shown large next to RST (moved here from the Country field).
@@ -6278,13 +6445,41 @@ export default function App() {
// Follow the station the digital application says it is calling. A decode
// clicked here sets the target directly (see onCall); this covers the QSO
// started from the other side — WSJT-X's own double-click, or auto-call.
//
// On the EDGE — when the decoder's DX call actually changes — and not by
// comparing it with the panel's current target: the auto-call effect below
// sets that target too, and two effects each restoring "their" value from the
// other's write is a loop, not a preference.
const pskDxRef = useRef('');
useEffect(() => {
const dx = (txState?.dx_call ?? '').toUpperCase().trim();
if (dx && dx !== pskTarget) {
setPskTarget(dx);
setPskTargetMode(txState?.mode ?? '');
}
}, [txState?.dx_call, txState?.mode, pskTarget]);
if (!dx || dx === pskDxRef.current) return;
pskDxRef.current = dx;
setPskTarget(dx);
setPskTargetMode(txState?.mode ?? '');
}, [txState?.dx_call, txState?.mode]);
// WAITING FOR A STATION IS ALREADY A REASON TO ANALYSE IT.
//
// Auto-call shows an hourglass for a station it wants and cannot call yet
// because that station is working somebody else. The analysis takes a moment
// to fill — the history query, then a period or two of live reports — so
// starting it at the instant the DX becomes free is starting it too late.
// The wait is dead time, and this is exactly what it is worth spending on.
//
// Only while nothing is actually being called: a real target is the panel's
// subject, and it arrives here through the decoder's DX call above.
const pskWaitRef = useRef('');
useEffect(() => {
const w = String(autoCallStatus?.waiting ?? '').toUpperCase().trim();
if (!w) { pskWaitRef.current = ''; return; }
if (autoCallStatus?.target) return;
if (w === pskWaitRef.current) return;
pskWaitRef.current = w;
setPskTarget(w);
setPskTargetMode(txState?.mode ?? mode ?? '');
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [autoCallStatus?.waiting, autoCallStatus?.target]);
const renderDecodesPanel = () => (
<div className="flex h-full min-h-0">
@@ -6314,6 +6509,37 @@ export default function App() {
</div>
);
// ONE CLICK TAKES THE STATION, TWO ANSWER IT — and the FT map means the same
// by them as the list does. They were written inline on the list, so the map
// had no way to offer the same gestures without a second copy of them.
function selectDecode(d: any) {
setPskTarget((d.call ?? '').toUpperCase());
setPskTargetMode(d.mode ?? '');
onCallsignInput(d.call, { force: true });
}
function callDecode(d: any) {
// The station being answered is also the one worth analysing: the PSK
// Reporter panel follows the click rather than asking for a second one.
setPskTarget((d.call ?? '').toUpperCase());
setPskTargetMode(d.mode ?? '');
// Auto-call adopts the station: the click chooses WHO, the watchdogs still
// decide how long it is called for.
TakeAutoCallTarget(d.call ?? '', d.band ?? '', d.mode ?? '').catch(() => {});
onCallsignInput(d.call, { force: true });
// With two slices on two bands, the Reply reaches the right INSTANCE but the
// radio still transmits on whichever slice holds the TX flag. Move it to the
// decode's band first, or an 80 m answer goes out on 20 m. A no-op on any
// backend without slices.
FlexTXOnBand(d.band ?? '').catch(() => { /* not a Flex, or no such slice */ });
AnswerDecode(
d.instance ?? '', d.ms ?? 0, d.snr, d.dt ?? 0,
// The RAW mode marker, not the resolved name: the receiving application
// matches the Reply against its decode list field for field, and JTDX
// drops one that says "FT8" where it decoded "~".
d.audio_hz ?? 0, d.mode_raw || d.mode || '', d.msg_raw ?? d.msg ?? '', !!d.low_conf,
).catch((e: any) => setError(String(e?.message ?? e)));
}
const renderDecodesList = () => (
<DecodesPanel
decodes={decodes}
@@ -6325,6 +6551,7 @@ export default function App() {
// compare with", never "the rig is on no band".
rigBand={catState.connected ? (catState.band || '') : ''}
myCall={station.callsign}
myGrid={station.my_grid}
// A DOUBLE click answers the station: it hands the decode back to
// WSJT-X/MSHV as a Reply, the same thing as double-clicking the line in
// their own window. A single click only selects it — see onSelect below,
@@ -6337,33 +6564,8 @@ export default function App() {
// One click: take the station, transmit nothing. The entry is filled and
// the panels follow it, exactly as clicking a cluster spot does — so a
// row can be inspected, looked up and read about without keying up.
onSelect={(d) => {
setPskTarget((d.call ?? '').toUpperCase());
setPskTargetMode(d.mode ?? '');
onCallsignInput(d.call, { force: true });
}}
onCall={(d) => {
// The station being answered is also the one worth analysing: the PSK
// Reporter panel follows the click rather than asking for a second one.
setPskTarget((d.call ?? '').toUpperCase());
setPskTargetMode(d.mode ?? '');
// Auto-call adopts the station: the click chooses WHO, the watchdogs
// still decide how long it is called for.
TakeAutoCallTarget(d.call ?? '', d.band ?? '', d.mode ?? '').catch(() => {});
onCallsignInput(d.call, { force: true });
// With two slices on two bands, the Reply reaches the right INSTANCE but
// the radio still transmits on whichever slice holds the TX flag. Move
// it to the decode's band first, or an 80 m answer goes out on 20 m.
// A no-op on any backend without slices.
FlexTXOnBand(d.band ?? '').catch(() => { /* not a Flex, or no such slice */ });
AnswerDecode(
d.instance ?? '', d.ms ?? 0, d.snr, d.dt ?? 0,
// The RAW mode marker, not the resolved name: the receiving
// application matches the Reply against its decode list field for
// field, and JTDX drops one that says "FT8" where it decoded "~".
d.audio_hz ?? 0, d.mode_raw || d.mode || '', d.msg_raw ?? d.msg ?? '', !!d.low_conf,
).catch((e: any) => setError(String(e?.message ?? e)));
}}
onSelect={selectDecode}
onCall={callDecode}
// Wipes the live view only — nothing here is stored, and the staging
// buffer goes too or the next flush would put back what was just cleared.
onClear={(instance) => {
@@ -6385,15 +6587,16 @@ export default function App() {
// An empty instance lets the backend fall back to whichever application
// last reported its status — the normal single-receiver case.
onHalt={(instance) => {
// Halt means stop, including whatever auto-call had started — and it
// clears the engine's state, so a target it had given up on is not
// still sitting there when the operator switches it back on.
ResetAutoCall().catch(() => {});
// Halt is a verdict on the station being called: it is set aside for
// the session rather than released, or the next period would call it
// straight back — which is exactly what the operator just stopped.
HaltAutoCall().catch(() => {});
HaltDecodeTx(instance, false).catch((e: any) => setError(String(e?.message ?? e)));
}}
autoCallOn={!!autoCallStatus?.enabled}
onToggleAutoCall={toggleAutoCall}
autoCall={autoCallStatus}
watchlist={watchPatterns}
autoCallOnly={autoCallStatus?.only ?? ''}
onSetAutoCallOnly={(list) => {
setAutoCallStatus((st: any) => ({ ...st, only: list.toUpperCase() }));
@@ -6677,9 +6880,9 @@ export default function App() {
{/* Motorized-antenna pattern (Normal / 180° reverse / Bidirectional), next to the azimuth. */}
{ubStatus.enabled && (
<div className="inline-flex items-center rounded-full border border-success-border bg-success-muted overflow-hidden text-[10px] font-semibold ml-1"
title={ubStatus.connected ? (ubStatus.moving ? 'Antenna: moving…' : 'Antenna pattern') : 'Antenna: connecting…'}>
title={ubStatus.connected ? (motorMoving ? 'Antenna: moving…' : 'Antenna pattern') : 'Antenna: connecting…'}>
<button type="button" className="pl-1.5 pr-0.5 flex items-center" onClick={() => { setSettingsSection('antenna'); setShowSettings(true); }} title="Antenna settings">
<span className={cn('size-2 rounded-full', ubStatus.connected ? (ubStatus.moving ? 'bg-warning' : 'bg-success') : 'bg-muted-foreground/40')} />
<span className={cn('size-2 rounded-full', ubStatus.connected ? (motorMoving ? 'bg-warning' : 'bg-success') : 'bg-muted-foreground/40')} />
</button>
{([{ d: 0, l: 'N', t: 'Normal' }, { d: 1, l: '180°', t: 'Reverse (180°)' }, { d: 2, l: 'Bi', t: 'Bidirectional' }]).map((o) => (
<button key={o.d} type="button" disabled={!ubStatus.connected} title={o.t}
@@ -6737,6 +6940,18 @@ export default function App() {
<Ear className="size-4" />
{cwOn && cwStatus.active && <span className="absolute -top-0.5 -right-0.5 size-2 rounded-full bg-success animate-pulse" />}
</button>
<button
type="button"
onClick={() => { const v = !showWatchWidget; setShowWatchWidget(v); writeUiPref('opslog.showWatchWidget', v ? '1' : '0'); }}
title={showWatchWidget ? t('wlw.hide') : t('wlw.show')}
className={cn(
'relative inline-flex items-center justify-center size-7 rounded-md border transition-colors',
showWatchWidget ? 'border-success-border bg-success-muted text-success-muted-foreground hover:bg-success-muted'
: 'border-border text-muted-foreground hover:bg-muted',
)}
>
<Bell className="size-4" />
</button>
<button
type="button"
onClick={() => { const v = !showRotor; setShowRotor(v); writeUiPref('opslog.showRotor', v ? '1' : '0'); }}
@@ -6764,8 +6979,8 @@ export default function App() {
{/* Amber while the elements travel: on a SteppIR that is also
when transmitting is a bad idea, so it is worth seeing from
the icon without opening the widget. */}
{ubStatus.moving && <span className="absolute -top-0.5 -right-0.5 size-2 rounded-full bg-warning animate-pulse" />}
{!ubStatus.moving && showMotorAnt && ubStatus.connected && <span className="absolute -top-0.5 -right-0.5 size-2 rounded-full bg-success" />}
{motorMoving && <span className="absolute -top-0.5 -right-0.5 size-2 rounded-full bg-warning animate-pulse" />}
{!motorMoving && showMotorAnt && ubStatus.connected && <span className="absolute -top-0.5 -right-0.5 size-2 rounded-full bg-success" />}
</button>
)}
{agEnabled && (
@@ -7219,12 +7434,30 @@ export default function App() {
{e.date && <span className="text-[11px] text-muted-foreground">{e.date}</span>}
</div>
<ul className="space-y-1.5 text-sm">
{(clLang === 'fr' ? e.fr : e.en).map((line, i) => (
<li key={i} className="flex gap-2">
<span className="text-primary mt-1.5 size-1.5 rounded-full bg-primary shrink-0" />
<span>{line}</span>
</li>
))}
{(clLang === 'fr' ? e.fr : e.en).map((line, i) => {
// "[NEW] " at the head of an entry marks a new FEATURE, as
// opposed to a fix to one. The marker is written in the
// changelog file itself and is the same in both languages,
// so one convention covers EN and FR; it is stripped here
// and drawn as a pill. A release is mostly fixes, and the
// two or three things that are actually new should not have
// to be found by reading all of it.
const isNew = line.startsWith('[NEW] ');
const text = isNew ? line.slice(6) : line;
return (
<li key={i} className="flex gap-2">
<span className={cn('mt-1.5 size-1.5 rounded-full shrink-0', isNew ? 'bg-success' : 'bg-primary')} />
<span>
{isNew && (
<span className="mr-1.5 align-[1px] rounded px-1 py-px text-[10px] font-bold uppercase tracking-wide bg-success text-success-foreground">
{t('whatsnew.newTag')}
</span>
)}
{text}
</span>
</li>
);
})}
</ul>
</div>
))}
@@ -7446,7 +7679,7 @@ export default function App() {
{/* Reserved free space to the right. The WinKeyer CW keyer and/or the
Digital Voice Keyer take this slot when enabled (Log4OM-style);
otherwise it shows the QRZ profile photo. */}
{!compact && (chatShown || wkEnabled || dvkEnabled || lookupResult?.image_url || (showRotor && (rotatorHeading.enabled || dxPath)) || (showMotorAnt && ubStatus.enabled) || (showAntGenius && agEnabled) || (showTuner && tgEnabled) || (showAmpWidget && ampSts.length > 0) || (showScp && scpEnabled) || (chaseNewOn && showChaseNew) || (showLiveStations && dbConn?.backend === 'mysql')) && (
{!compact && (chatShown || wkEnabled || dvkEnabled || lookupResult?.image_url || (showRotor && (rotatorHeading.enabled || dxPath)) || (showMotorAnt && ubStatus.enabled) || (showAntGenius && agEnabled) || (showTuner && tgEnabled) || (showAmpWidget && ampSts.length > 0) || (showScp && scpEnabled) || (chaseNewOn && showChaseNew) || showWatchWidget || (showLiveStations && dbConn?.backend === 'mysql')) && (
// relative + absolute inner (like the F1-F5 panel): a taller widget (e.g.
// the DVK with Auto CQ) can't grow the row — the row height stays set by
// the entry strip and each widget fills that height, scrolling inside.
@@ -7509,10 +7742,27 @@ export default function App() {
{/* Rotor compass: azimuth dial + needles + click-to-turn. Shows when a
rotator is configured or a DX bearing exists. Compact mode drops the
controls column, so the widget is just the dial and needs only its
width. */}
width. The classic dial sizes itself from the inside and expects a fixed
column; the current one asks for the width it needs. */}
{showWatchWidget && (
<div className="w-[290px] shrink-0 min-h-0" style={{ order: wOrder('watchlist') }}>
{/* Same handler as a cluster row, for the same reason as Chase
new: a row here IS a spot, and half the reflex the call
without the frequency, or the frequency without the mode is
what makes a shortcut not worth using. */}
<WatchlistWidget
spots={spots}
spotStatus={spotStatus as any}
onPick={(s) => handleSpotClick(s as any)}
onClose={() => { setShowWatchWidget(false); writeUiPref('opslog.showWatchWidget', '0'); }}
/>
</div>
)}
{showRotor && (rotatorHeading.enabled || dxPath) && (
<div className={cn('shrink-0 min-h-0', rotorCompact ? 'w-[196px]' : 'w-[320px]')} style={{ order: wOrder('rotor') }}>
<RotorCompass
<div className={cn('shrink-0 min-h-0',
rotorCompact ? 'w-[196px]' : rotorDial === 'classic' ? 'w-[320px]' : 'w-auto')}
style={{ order: wOrder('rotor') }}>
<Compass2
presets={rotorCompact ? undefined : rotorPresets}
onStop={rotorCompact ? undefined : () => { RotatorStop().then(pokeRotorHeading).catch((err) => setError(String(err?.message ?? err))); }}
bearing={dxPath?.bearingShort ?? null}
@@ -7533,7 +7783,7 @@ export default function App() {
{showMotorAnt && ubStatus.enabled && (
<div className="w-[230px] shrink-0 min-h-0" style={{ order: wOrder('motorant') }}>
<MotorAntennaWidget
ant={ubStatus}
ant={{ ...ubStatus, moving: motorMoving }}
refetch={pokeUbStatus}
t={t}
essentialsOnly
@@ -7820,7 +8070,7 @@ export default function App() {
</TabsTrigger>
)}
{catState.backend === 'flex' && <TabsTrigger value="flex">Flex Console</TabsTrigger>}
{catState.backend === 'icom' && <TabsTrigger value="icom">Icom Console</TabsTrigger>}
{icomShown && <TabsTrigger value="icom">Icom Console</TabsTrigger>}
{catState.backend === 'yaesu' && <TabsTrigger value="yaesu">Yaesu Console</TabsTrigger>}
{(catState.backend === 'elecraft' || catState.backend === 'kenwood') && <TabsTrigger value="elecraft">{t('k3.console')}</TabsTrigger>}
{catState.backend === 'tci' && <TabsTrigger value="tci">{t('tcip.console')}</TabsTrigger>}
@@ -8539,7 +8789,8 @@ export default function App() {
<TabsContent value="ftmap" className="mt-0 flex flex-col min-h-0 flex-1 data-[state=inactive]:hidden">
{activeTab === 'ftmap' && (
<div className="h-full w-full min-h-0 bg-card border border-border rounded-lg overflow-hidden">
<FTMapPanel decodes={decodes as any} myGrid={station.my_grid} />
<FTMapPanel decodes={decodes as any} myGrid={station.my_grid}
onSelect={selectDecode} onCall={callDecode} />
</div>
)}
</TabsContent>
@@ -8595,7 +8846,7 @@ export default function App() {
</TabsContent>
)}
{catState.backend === 'icom' && (
{icomShown && (
<TabsContent value="icom" className="flex-1 min-h-0 p-0">
<IcomPanel isNetwork={catBackend === 'icom-net'} onReportRST={(r) => { setRstSent(r); rstUserEditedRef.current = true; }} />
</TabsContent>
@@ -8766,6 +9017,7 @@ export default function App() {
catUp={catUp}
catState={catState}
onOpenSettings={() => { setSettingsSection('cat'); setShowSettings(true); }}
onRadioSwitched={loadCATCfg}
/>
<Chip
on={rotatorHeading.enabled && rotatorHeading.ok}
@@ -9011,7 +9263,7 @@ export default function App() {
onSaved={onSettingsSaved}
onMainPaneChanged={onSettingsPaneChanged}
flexAvailable={catState.backend === 'flex'}
icomAvailable={catState.backend === 'icom'}
icomAvailable={icomShown}
yaesuAvailable={catState.backend === 'yaesu'}
elecraftAvailable={catState.backend === 'elecraft' || catState.backend === 'kenwood'}
tciAvailable={catState.backend === 'tci'}
+2 -2
View File
@@ -304,13 +304,13 @@ export function AppearancePanel() {
// place here: it comes back where the operator left it rather than at the end.
export const WIDGET_KEYS = [
'livestations', 'chat', 'rotor', 'motorant', 'antgenius',
'amp', 'tuner', 'scp', 'chasenew', 'dvk', 'winkeyer', 'photo',
'amp', 'tuner', 'scp', 'chasenew', 'watchlist', 'dvk', 'winkeyer', 'photo',
] as const;
const WIDGET_LABELS: Record<string, string> = {
livestations: 'wo.livestations', chat: 'wo.chat', rotor: 'wo.rotor',
motorant: 'wo.motorant', antgenius: 'wo.antgenius', amp: 'wo.amp',
tuner: 'wo.tuner', scp: 'wo.scp', chasenew: 'wo.chasenew',
tuner: 'wo.tuner', scp: 'wo.scp', chasenew: 'wo.chasenew', watchlist: 'wo.watchlist',
dvk: 'wo.dvk', winkeyer: 'wo.winkeyer', photo: 'wo.photo',
};
+35 -5
View File
@@ -15,7 +15,7 @@ import { useI18n } from '@/lib/i18n';
import { chaseAllows } from '@/lib/spotDisplay';
import { markerColour } from '@/lib/spotMarkers';
import { cn } from '@/lib/utils';
import { GetChaseNewSpots } from '../../wailsjs/go/main/App';
import { GetChaseNewSpots, GetPSKReporterStatus } from '../../wailsjs/go/main/App';
export interface ChaseNewSpot {
call: string;
@@ -80,15 +80,25 @@ function categoryOf(s: ChaseNewSpot): Category | null {
const FILTER_KEY = 'opslog.chaseNewFilters';
function allowedCategories(): Category[] {
return CATEGORIES.filter((c) => chaseAllows(c.key)).map((c) => c.key);
}
function loadFilters(): Set<Category> {
const allowed = allowedCategories();
try {
const raw = localStorage.getItem(FILTER_KEY);
if (raw) {
const list = JSON.parse(raw) as Category[];
if (Array.isArray(list)) return new Set(list);
// A stored set holding NONE of the categories on offer hides the whole
// panel, for ever, with nothing to say why — and that is exactly what a
// preference written by an older build does once a category is renamed.
// Treated as "no preference": a panel that shows nothing at every launch
// is never what was meant, and the chips are one click away.
if (Array.isArray(list) && list.some((k) => allowed.includes(k))) return new Set(list);
}
} catch { /* a corrupt preference is not worth a broken panel */ }
return new Set(CATEGORIES.filter((c) => chaseAllows(c.key)).map((c) => c.key));
return new Set(allowed);
}
export function ChaseNewPanel({ onPick, onClose }: Props) {
@@ -96,6 +106,10 @@ export function ChaseNewPanel({ onPick, onClose }: Props) {
const [spots, setSpots] = useState<ChaseNewSpot[]>([]);
const [loaded, setLoaded] = useState(false);
const [on, setOn] = useState<Set<Category>>(loadFilters);
// The FEED, not the list: connected or not, how many reports it has taken,
// and what it is filtered on. Without it an empty panel says nothing about
// whether anything is arriving at all — which is the first question.
const [feed, setFeed] = useState<any>(null);
// Polled rather than pushed: the feed can deliver several a second under an
// opening, and an event per row would be a redraw per row for a list nobody
@@ -106,6 +120,8 @@ export function ChaseNewPanel({ onPick, onClose }: Props) {
try {
const r = ((await GetChaseNewSpots()) ?? []) as ChaseNewSpot[];
if (alive) { setSpots(r); setLoaded(true); }
const st = await GetPSKReporterStatus();
if (alive) setFeed(st);
} catch { /* the feed may not be up yet */ }
};
tick();
@@ -154,8 +170,13 @@ export function ChaseNewPanel({ onPick, onClose }: Props) {
))}
</div>
{/* Both numbers: what is on screen, and what was heard. They differ
exactly when a category is switched off, which is the one case an
operator reads this panel as broken. */}
<span className="shrink-0 text-[10px] text-muted-foreground">
{loaded ? t('chn.count', { n: shown.length }) : ''}
{loaded ? (shown.length === spots.length
? t('chn.count', { n: spots.length })
: t('chn.countOf', { n: shown.length, total: spots.length })) : ''}
</span>
{onClose && (
<button
@@ -218,7 +239,16 @@ export function ChaseNewPanel({ onPick, onClose }: Props) {
)}
</div>
<p className="border-t border-border px-2 py-1 text-[10px] text-muted-foreground">{t('chn.digitalOnly')}</p>
{/* The radius comes from the FEED, not from a sentence: it was written
into this line as "~300 km" and stayed 300 while the setting said
1000, which is the panel telling the operator their change did not
take when it had. */}
<p className="border-t border-border px-2 py-1 text-[10px] text-muted-foreground">
{t('chn.heardWithin', { km: feed?.near_km || 300 })}
{feed && (feed.running
? <span className="text-success"> · {t('chn.feedOn', { n: feed.received ?? 0, sq: feed.squares ?? 0 })}</span>
: <span className="text-warning"> · {feed.last_err ? t('chn.feedErr', { e: feed.last_err }) : t('chn.feedOff')}</span>)}
</p>
</div>
);
}
+169 -24
View File
@@ -17,8 +17,11 @@ import { AlertTriangle, Radio, Search, X, Signal, ArrowUpRight, Timer, Trash2, B
import { cn } from '@/lib/utils';
import { useI18n } from '@/lib/i18n';
import { chaseAllows } from '@/lib/spotDisplay';
import { pathBetween } from '@/lib/maidenhead';
import { distanceValue, distanceUnit, subscribeDistanceUnit } from '@/lib/units';
import { markerColour, type SpotMarkerKey } from '@/lib/spotMarkers';
import { writeUiPref } from '@/lib/uiPref';
import { SetAutoCallVisible } from '../../wailsjs/go/main/App';
import { decoderName } from '@/lib/decoderName';
export type Decode = {
@@ -104,6 +107,9 @@ interface Props {
// point the panels at it. Absent, a click falls back to onCall.
onSelect?: (d: Decode) => void;
myCall?: string;
// The station's own square: distance is measured from it, and without one the
// column stays empty rather than guessing.
myGrid?: string;
// Drop every decode and transmit message held for this panel. The list is a
// live view, not data — clearing it costs nothing but the seconds until the
// next period lands.
@@ -120,11 +126,14 @@ interface Props {
autoCallOn?: boolean;
onToggleAutoCall?: () => void;
// The engine's own account of what it is doing, straight from the backend.
autoCall?: { target: string; calls: number; max: number; misses: number; max_miss: number; stopped: boolean; reason: string };
autoCall?: { target: string; waiting: string; calls: number; max: number; misses: number; max_miss: number; stopped: boolean; reason: string };
// The chase list, here as well as in Preferences: naming the station you are
// waiting for is done WHILE watching the band, not in a settings tree.
autoCallOnly?: string;
onSetAutoCallOnly?: (list: string) => void;
// The watch list, as PATTERNS (VK9*, 3Y0J). A decode of one is worth saying
// so where the operator is reading the band, not only in the watchlist tab.
watchlist?: string[];
}
// The "new" categories, as toggle badges — the same idea and the same colours as
@@ -171,6 +180,21 @@ function catsOf(e: StatusEntry | undefined): Set<NewCat> {
return out;
}
// isWatched applies the watch list's own rule — a trailing "*" is a prefix,
// anything else is the whole callsign — so a decode is judged here exactly as
// the backend judges a spot. Two rules for one list is how a badge and an alert
// start disagreeing about the same station.
function isWatched(call: string, patterns: string[] | undefined): boolean {
if (!patterns || patterns.length === 0 || !call) return false;
const c = call.toUpperCase();
for (const raw of patterns) {
const p = (raw ?? '').toUpperCase().trim();
if (!p) continue;
if (p.endsWith('*') ? c.startsWith(p.slice(0, -1)) : c === p) return true;
}
return false;
}
const CAT_KEY = 'opslog.decodeCats';
const SPLIT_KEY = 'opslog.decodeSplit';
const FILTER_KEY = 'opslog.decodeFilters';
@@ -252,9 +276,14 @@ const CELL_LAST = 'flex items-center min-w-0 px-2 gap-1 overflow-hidden';
// One declaration per column, in display order: the header, the widths and the
// resize handles all read from this, so a column cannot be resized in the header
// and stay the old width in the body.
type ColKey = 'time' | 'snr' | 'dt' | 'freq' | 'band' | 'mode' | 'msg' | 'grid' | 'state' | 'country' | 'status';
type ColKey = 'time' | 'rx' | 'snr' | 'dt' | 'freq' | 'band' | 'mode' | 'msg' | 'grid' | 'dist' | 'state' | 'country' | 'status';
const COLS: { key: ColKey; tkey: string; def: number; min: number }[] = [
{ key: 'time', tkey: 'dec.colTime', def: 64, min: 44 },
// WHICH RECEIVER heard it. Shown only while more than one is feeding, and
// that is the case it exists for: two decoders on one band send the same
// stations twice, each with its own SNR and DT, and a merged list gave no way
// at all to tell a second receiver from a duplicate.
{ key: 'rx', tkey: 'dec.colRx', def: 74, min: 44 },
{ key: 'snr', tkey: 'dec.colSnr', def: 50, min: 36 },
{ key: 'dt', tkey: 'dec.colDt', def: 44, min: 32 },
{ key: 'freq', tkey: 'dec.colFreq', def: 56, min: 40 },
@@ -268,6 +297,11 @@ const COLS: { key: ColKey; tkey: string; def: number; min: number }[] = [
{ key: 'grid', tkey: 'dec.colGrid', def: 62, min: 46 },
// For the WAS chasers: the badge carries the two letters, the name spells
// them out — "SD" alone is a quiz for a European.
// Next to the square it is computed from. A four-character grid is a square
// tens of kilometres wide, so this is rounded to whole units and never
// pretends to more: it answers "is that station across the pond or across the
// valley", which is what decides whether the report is worth anything.
{ key: 'dist', tkey: 'dec.colDist', def: 70, min: 46 },
{ key: 'state', tkey: 'dec.colState', def: 120, min: 56 },
{ key: 'country', tkey: 'dec.colCountry', def: 140, min: 70 },
{ key: 'status', tkey: 'dec.colStatus', def: 186, min: 80 },
@@ -422,16 +456,31 @@ function periodLabel(ms: number, trSec: number): string {
// read "CQ CQ PE1NAO JO32" — the badge and the message's own first word saying
// the same thing twice. Highlighting the word already in the line keeps the
// scannability and drops the stutter.
function renderMsg(msg: string, me: string, calling: string) {
function renderMsg(msg: string, me: string, calling: string, toMe: boolean) {
if (!msg) return null;
// THE WHOLE LINE, when it is addressed to YOU.
//
// Token colouring is for reading the band — it picks your call out of a wall
// of other people's traffic. A message sent TO you is a different question:
// not "is my call in there somewhere" but "what did he just send me", read
// from the far side of the shack, so the whole line carries the colour.
//
// Only that case. The station you are calling also transmits to everybody
// else — "LA8WRA LA1RAU/P +00" is your target reporting to another caller —
// and setting those lines in the same strong colour said you were in a QSO
// you were not in. Its callsign is picked out by the token pass below, which
// is what "he is on the air, working somebody else" should look like.
if (toMe) {
return <span className="font-bold text-success">{msg}</span>;
}
// Split on whitespace and colour the tokens that matter, rather than the
// whole line: an operator scanning a slot is looking for their own call in
// the first position (someone answering) and for the station being called.
const parts = msg.split(/(s+)/);
const parts = msg.split(/(\s+)/);
return (
<>
{parts.map((tok, i) => {
if (/^s+$/.test(tok)) return tok;
if (/^\s+$/.test(tok)) return tok;
const bare = tok.replace(/[<>]/g, '').toUpperCase();
if (i === 0 && /^CQ$/i.test(tok)) return <span key={i} className="font-bold text-success">{tok.toUpperCase()}</span>;
if (me && bare === me) return <span key={i} className="font-bold text-success">{tok}</span>;
@@ -450,7 +499,7 @@ function renderMsg(msg: string, me: string, calling: string) {
//
// It is the one moving thing on the panel, and it answers the question an
// operator actually has between overs: how long until the next batch.
function PeriodClock({ trSec, mode }: { trSec: number; mode?: string }) {
function PeriodClock({ trSec, mode, tx }: { trSec: number; mode?: string; tx?: boolean }) {
const [now, setNow] = useState(() => Date.now());
useEffect(() => {
// 100 ms: smooth enough for a bar that fills in three and three quarter
@@ -466,19 +515,26 @@ function PeriodClock({ trSec, mode }: { trSec: number; mode?: string }) {
// The last fifth of a slot is when a decode is imminent and an operator
// deciding whether to answer has run out of time to think.
const closing = left <= trSec / 5;
// TRANSMITTING outranks both. The bar is the one thing on this screen that
// moves continuously, so it is what the eye is already on — and "am I on the
// air" is the state worth reading from across the room. Red, and it stays red
// for the whole over rather than turning amber near the end of it.
const tone = tx ? 'danger' : closing ? 'warning' : '';
return (
<span className="flex items-center gap-2 shrink-0" title={mode ? `${mode} · ${trSec}s` : `${trSec}s`}>
<Timer className={cn('size-4', closing ? 'text-warning' : 'text-muted-foreground')} />
<Timer className={cn('size-4',
tone === 'danger' ? 'text-danger' : tone === 'warning' ? 'text-warning' : 'text-muted-foreground')} />
<span className="relative h-1.5 w-24 rounded-full bg-muted overflow-hidden">
<span
className={cn('absolute inset-y-0 left-0 rounded-full transition-[width] duration-100 ease-linear',
closing ? 'bg-warning' : 'bg-primary')}
tone === 'danger' ? 'bg-danger' : tone === 'warning' ? 'bg-warning' : 'bg-primary')}
style={{ width: `${pct}%` }}
/>
</span>
<span className={cn('font-mono text-sm tabular-nums w-10 text-right',
closing ? 'text-warning font-semibold' : 'text-muted-foreground')}>
tone === 'danger' ? 'text-danger font-semibold'
: tone === 'warning' ? 'text-warning font-semibold' : 'text-muted-foreground')}>
{left.toFixed(1)}
</span>
<span className="text-xs text-muted-foreground">
@@ -552,7 +608,7 @@ function buildPeriods(filtered: Decode[], txMsgs: TxMsg[]) {
}));
}
export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, rigBand, onCall, onSelect, myCall, onClear, onHalt, autoCallOn, onToggleAutoCall, autoCall, autoCallOnly, onSetAutoCallOnly }: Props) {
export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, rigBand, onCall, onSelect, myCall, myGrid, onClear, onHalt, autoCallOn, onToggleAutoCall, autoCall, autoCallOnly, onSetAutoCallOnly, watchlist }: Props) {
const { t } = useI18n();
// Column widths, dragged in the header and shared by every row. Persisted
// through writeUiPref (not raw localStorage) so the layout travels with data/
@@ -567,8 +623,6 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
if (el && el.tagName === 'INPUT' && el.getAttribute('placeholder') === t('dec.chasePh')) return;
setOnlyText(autoCallOnly ?? '');
}, [autoCallOnly, t]);
const template = useMemo(() => COLS.map((c) => `${colw[c.key]}px`).join(' '), [colw]);
const tableW = useMemo(() => COLS.reduce((s, c) => s + colw[c.key], 0), [colw]);
const setColWidth = (key: ColKey, px: number) => {
const col = COLS.find((c) => c.key === key)!;
const w = Math.min(COL_MAX, Math.max(col.min, Math.round(px)));
@@ -645,6 +699,8 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
// opens with our callsign, sometimes bracketed when the sender compressed a
// non-standard call.
const me = (myCall ?? '').toUpperCase();
const [, bumpUnit] = useState(0);
useEffect(() => subscribeDistanceUnit(() => bumpUnit((n) => n + 1)), []);
const calling = (txState?.dx_call ?? '').toUpperCase();
const answersMe = (msg?: string): boolean => {
if (!me || !msg) return false;
@@ -681,6 +737,12 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [decodes, spotStatus]);
// The receiver column is dead weight with one decoder — which is nearly
// everybody — so it is not there at all until a second one starts feeding.
const cols = useMemo(() => COLS.filter((c) => c.key !== 'rx' || (instances.length > 1 && !splitByInstance)),
[instances.length, splitByInstance]);
const template = useMemo(() => cols.map((c) => `${colw[c.key]}px`).join(' '), [cols, colw]);
const tableW = useMemo(() => cols.reduce((s, c) => s + colw[c.key], 0), [cols, colw]);
// All seven, always, in their usual order.
//
// The chips used to be built from the continents ON the feed, which read as a
@@ -714,6 +776,22 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [decodes, spotStatus, cqOnly, lotwOnly, cats, bandSel, modeSel, contSel, minSnr, search]);
// What this panel is SHOWING, published to the auto-call engine.
//
// The filters are the operator's control over the transmitter as well as
// over the list: a station filtered off the screen is not called. The panel
// sends the callsigns rather than the filter settings, so there is one
// definition of "shown" and not two — the engine cannot disagree with what
// is in front of the operator.
useEffect(() => {
const calls = [...new Set(filtered.map((d) => (d.call ?? '').toUpperCase()).filter(Boolean))];
SetAutoCallVisible(calls, true).catch(() => {});
}, [filtered]);
// Closed, it publishes nothing: filters that are not on the screen cannot
// silence the engine behind the operator's back.
useEffect(() => () => { SetAutoCallVisible([], false).catch(() => {}); }, []);
// Group into periods, newest first, and drop the operator's transmissions into
// the slot they went out in.
@@ -770,7 +848,11 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
{/* The slot clock. Taken from the newest decode's mode, falling back to
what the transmit state reports, so it is right the moment anything
is heard and keeps running when the band goes quiet. */}
<PeriodClock trSec={liveTr} mode={liveMode} />
{/* Any receiver on the air colours it: with two decoders the shared
txState is whichever reported last, and "somebody here is
transmitting" is what the bar has to say. */}
<PeriodClock trSec={liveTr} mode={liveMode}
tx={!!txState?.transmitting || Object.values(txStates ?? {}).some((s) => s?.transmitting)} />
{bandDrift && (
<span
title={t('dec.bandDriftTip')}
@@ -927,13 +1009,47 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
>
<Bot className="size-3.5" />
{t('dec.autoCall')}
{autoCallOn && autoCall?.target && (
<span className="font-mono text-xs">
{autoCall.target} {autoCall.calls}/{autoCall.max}
{autoCall.misses > 0 ? ` ·${autoCall.misses}/${autoCall.max_miss}` : ''}
</button>
)}
{/* WHAT IT IS DOING, BESIDE THE SWITCH RATHER THAN ON IT.
A thing that keys the transmitter must never be a switch with no
readout — but the readout was crammed inside the button as
"Auto D2ACE 1/7 ·1/3", where the two counters read as one number and
the whole control changed width every period. Out here each figure
gets a label, and the station being called is the biggest thing on
the row. */}
{autoCallOn && autoCall?.target && (
<span className="h-8 inline-flex items-center gap-2 rounded-lg border border-success/50 bg-success/10 px-2"
title={t('dec.autoTargetTip', { call: autoCall.target })}>
<span className="font-mono text-sm font-bold text-success">{autoCall.target}</span>
<span className="inline-flex items-center gap-1 text-[11px] text-muted-foreground">
<span className="uppercase tracking-wide">{t('dec.autoCalls')}</span>
<span className="font-mono tabular-nums text-foreground">{autoCall.calls}/{autoCall.max}</span>
</span>
{/* Only once there is one to report: a zero that is always there is
a figure nobody reads, and it was the half of the pair that got
mistaken for the call count. */}
{autoCall.misses > 0 && (
<span className="inline-flex items-center gap-1 text-[11px] text-muted-foreground">
<span className="uppercase tracking-wide">{t('dec.autoMisses')}</span>
<span className={cn('font-mono tabular-nums',
autoCall.misses + 1 >= autoCall.max_miss ? 'text-warning' : 'text-foreground')}>
{autoCall.misses}/{autoCall.max_miss}
</span>
</span>
)}
</button>
</span>
)}
{/* Wanted, decoded, and in a QSO with somebody else. Holding fire looks
exactly like having nothing to do, and the operator had no way to
tell them apart. */}
{autoCallOn && !autoCall?.target && autoCall?.waiting && (
<span className="h-8 inline-flex items-center gap-1.5 rounded-lg border border-warning/50 bg-warning/10 px-2 animate-pulse"
title={t('dec.autoWaitTip', { call: autoCall.waiting })}>
<span className="text-sm"></span>
<span className="font-mono text-sm font-bold text-warning">{autoCall.waiting}</span>
<span className="text-[11px] uppercase tracking-wide text-muted-foreground">{t('dec.autoWaiting')}</span>
</span>
)}
{/* The chase list. Raw text while typing, committed on blur or Enter:
the stored value is upper-cased and trimmed, and binding the box to
@@ -1082,17 +1198,17 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
<div className="shrink-0 border-b border-border bg-background overflow-hidden">
<div className={cn(ROW, 'h-7 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground')}
style={{ gridTemplateColumns: template, width: tableW }}>
{COLS.map((c, i) => (
{cols.map((c, i) => (
<span key={c.key}
// Not CELL_LAST for the final column: its overflow-hidden would
// clip that column's own resize handle.
className={cn('relative flex items-center min-w-0 px-2',
i < COLS.length - 1 && 'border-r border-border/30',
i < cols.length - 1 && 'border-r border-border/30',
// The three numeric columns label their own right edge, where the
// figures are.
(c.key === 'snr' || c.key === 'dt' || c.key === 'freq') && 'justify-end')}
(c.key === 'snr' || c.key === 'dt' || c.key === 'freq' || c.key === 'dist') && 'justify-end')}
title={c.key === 'dt' ? t('dec.colDtTitle') : c.key === 'freq' ? t('dec.colFreqTitle') : undefined}>
<span className="truncate">{t(c.tkey)}</span>
<span className="truncate">{c.key === 'dist' ? `${t(c.tkey)} (${distanceUnit()})` : t(c.tkey)}</span>
<ColResizer
onResize={(dx) => setColWidth(c.key, colw[c.key] + dx)}
onReset={() => setColWidth(c.key, c.def)}
@@ -1172,7 +1288,10 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
title={t('dec.callTitle', { call: d.call })}
style={{ gridTemplateColumns: template, width: tableW }}
className={cn(ROW, 'text-left border-b border-border/20 transition-colors',
replying ? 'bg-success/20 hover:bg-success/25'
replying ? 'bg-success/25 hover:bg-success/30 border-l-2 border-l-success'
// The station being called: a tint saying "he is on the
// air", not the QSO treatment above — most of what he
// sends is to other people.
: worked ? 'bg-danger/15 hover:bg-danger/20'
: mine ? 'bg-info/10'
: 'hover:bg-muted/50')}
@@ -1185,6 +1304,15 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
{hhmmssCompact(d.at)}
</span>
{/* Which receiver heard it — present only while more than one
is feeding a merged list. */}
{cols.some((c) => c.key === 'rx') && (
<span className={cn(CELL, 'text-[11px] text-muted-foreground truncate')}
title={d.instance ?? ''}>
{decoderName(d.instance)}
</span>
)}
<span className={cn(CELL, 'justify-end font-mono text-[13px] font-semibold tabular-nums', snrTone(d.snr))}>
{d.snr > 0 ? `+${d.snr}` : d.snr}
</span>
@@ -1218,7 +1346,7 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
{/* The message carries the callsign already — which is why
there is no column repeating it. */}
<span className={cn(CELL, 'font-mono text-[13px]')}>
<span className="truncate">{renderMsg(d.msg ?? '', me, calling)}</span>
<span className="truncate">{renderMsg(d.msg ?? '', me, calling, replying)}</span>
</span>
{/* The decode's own grid first, the remembered one as the
@@ -1231,6 +1359,14 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
<span className="truncate">{d.grid || e?.grid || ''}</span>
</span>
<span className={cn(CELL, 'justify-end font-mono text-[11px] tabular-nums text-muted-foreground/80')}>
{(() => {
const g = d.grid || e?.grid || '';
const path = myGrid && g ? pathBetween(myGrid, g) : null;
return path ? distanceValue(path.distanceShort).toLocaleString() : '';
})()}
</span>
<span className={cn(CELL, 'gap-1.5')}>
{e?.state && (
<>
@@ -1256,6 +1392,15 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, r
{t('dec.wkd')}
</span>
)}
{/* Plainest first: the LoTW letter, the worked note, then
the coloured badges — the watch list leading them, being
the operator's own answer rather than the log's. */}
{isWatched(d.call, watchlist) && (
<span className="rounded px-1 py-px text-[10px] font-bold uppercase tracking-wide shrink-0 text-white"
style={{ background: '#f472b6' }} title={t('dec.wlTip')}>
{t('dec.wl')}
</span>
)}
{entities.map((b) => (
<span key={b.label}
title={e?.unconf_status ? t('dec.unconfTip') : undefined}
+63 -5
View File
@@ -5,6 +5,7 @@ import { gridToLatLon, greatCirclePoints, splitAtAntimeridian } from '@/lib/maid
import { BASEMAPS, type BasemapKey } from '@/components/MainMap';
import { cn } from '@/lib/utils';
import { useI18n } from '@/lib/i18n';
import { loadMapView, saveMapView, MAP_VIEW_FT } from '@/lib/mapView';
// FT Map — the live decode feed as geography: every station decoded in the
// last half hour, an arc from the operator's own square to theirs, coloured by
@@ -18,12 +19,16 @@ import { useI18n } from '@/lib/i18n';
// capped, and redraws happen when the DECODE LIST changes — every 15 s in FT8,
// not per frame.
// The map is handed the SAME decode objects the list works from — it only reads
// a few of the fields. The rest travel with them so a click here can answer the
// station exactly as a double-click in the list does.
export type FTMapDecode = {
call: string;
grid?: string;
band?: string;
snr: number;
at: string;
[k: string]: unknown;
};
// The band palette every PSK Reporter user already knows, near enough.
@@ -38,7 +43,26 @@ const bandColour = (b?: string) => BAND_COLOURS[(b ?? '').toLowerCase()] || '#9c
const MAX_ARCS = 300;
const MAX_AGE_MS = 30 * 60_000;
export function FTMapPanel({ decodes, myGrid }: { decodes: FTMapDecode[]; myGrid: string }) {
export function FTMapPanel({ decodes, myGrid, onSelect, onCall }: {
decodes: FTMapDecode[];
myGrid: string;
// One click takes the station, two answer it — the list's own gestures.
onSelect?: (d: FTMapDecode) => void;
onCall?: (d: FTMapDecode) => void;
}) {
// Held in refs so the redraw below does not have to list them as dependencies
// and rebuild every arc whenever the parent re-renders.
const selectRef = useRef(onSelect);
const callRef = useRef(onCall);
useEffect(() => { selectRef.current = onSelect; callRef.current = onCall; }, [onSelect, onCall]);
// Distinguishing the two gestures is ours to do: Leaflet fires click before
// dblclick and leaves the telling apart to the handler.
const clickTimer = useRef<number | undefined>(undefined);
useEffect(() => () => window.clearTimeout(clickTimer.current), []);
// Where this map was left. Panning and zooming it is the operator saying which
// part of the world they are working; throwing that away on every tab switch
// made it something to set up again rather than something to glance at.
const saved = useRef(loadMapView(MAP_VIEW_FT));
const { t } = useI18n();
const divRef = useRef<HTMLDivElement>(null);
const mapRef = useRef<L.Map | null>(null);
@@ -58,7 +82,15 @@ export function FTMapPanel({ decodes, myGrid }: { decodes: FTMapDecode[]; myGrid
// No maxBounds: with the world smaller than the window the clamp
// dragged every zoom into a corner. noWrap tiles alone keep one world.
worldCopyJump: false, preferCanvas: true,
center: [25, 0], zoom: 2, minZoom: 2,
center: saved.current ? [saved.current.lat, saved.current.lon] : [25, 0],
zoom: saved.current ? saved.current.zoom : 2,
minZoom: 2,
});
// Every move, not just the deliberate ones: a zoom is as much a choice as a
// pan, and there is no moment afterwards at which to ask.
m.on('moveend', () => {
const c = m.getCenter();
saveMapView(MAP_VIEW_FT, c.lat, c.lng, m.getZoom());
});
mapRef.current = m;
layerRef.current = L.layerGroup().addTo(m);
@@ -132,10 +164,36 @@ export function FTMapPanel({ decodes, myGrid }: { decodes: FTMapDecode[]; myGrid
L.polyline(pts as L.LatLngExpression[][], {
color: colour, weight: 1.3, opacity: 0.65 * fade, smoothFactor: 0,
}).addTo(layer);
L.circleMarker([to.lat, to.lon], {
const label = `${d.call} · ${d.grid} · ${d.snr > 0 ? '+' : ''}${d.snr} dB`;
const mk = L.circleMarker([to.lat, to.lon], {
// A three-pixel dot is a fine mark and a poor target, so the visible
// radius stays and an invisible one three times the size takes the
// clicks.
radius: 3, color: colour, weight: 1, fillColor: colour, fillOpacity: 0.9 * fade,
}).bindTooltip(`${d.call} · ${d.grid} · ${d.snr > 0 ? '+' : ''}${d.snr} dB`, { direction: 'top' })
.addTo(layer);
}).bindTooltip(label, { direction: 'top' }).addTo(layer);
// The tooltip goes on the HIT circle too, and it is the one that matters:
// being on top, it takes the hover as well as the click, and binding it
// only to the dot underneath left the map silent from the moment the dots
// became clickable — the callsign and report an operator reads by pointing
// at a station had simply gone.
const hit = L.circleMarker([to.lat, to.lon], {
radius: 9, opacity: 0, fillOpacity: 0, interactive: true,
}).bindTooltip(label, { direction: 'top' }).addTo(layer);
for (const target of [mk, hit]) {
target.on('click', (e) => {
// Not to the map: a click on a station is not a click on the water.
L.DomEvent.stopPropagation(e as unknown as Event);
window.clearTimeout(clickTimer.current);
clickTimer.current = window.setTimeout(() => selectRef.current?.(d), 250);
});
target.on('dblclick', (e) => {
// stop(), not stopPropagation(): the map zooms on a double click, and
// answering a station is not a request to zoom in on it.
L.DomEvent.stop(e as unknown as Event);
window.clearTimeout(clickTimer.current);
callRef.current?.(d);
});
}
}
}, [decodes, myGrid]);
+12 -3
View File
@@ -8,6 +8,7 @@ import { useI18n } from '@/lib/i18n';
import { cn } from '@/lib/utils';
import { BASEMAPS, addBasemap, loadBasemap, type BasemapKey } from '@/components/MainMap';
import { writeUiPref } from '@/lib/uiPref';
import { loadMapView, saveMapView, MAP_VIEW_GRIDS } from '@/lib/mapView';
// GridSquareMap — every Maidenhead square in the log, drawn on a world map.
//
@@ -131,8 +132,16 @@ export function GridSquareMap({ myGrid, className }: { myGrid?: string; classNam
}).setView([20, 0], 2);
// The whole world, once, whatever the window is shaped like — computed by
// Leaflet from the container rather than guessed with a zoom number.
m.fitWorld({ animate: false });
// Leaflet from the container rather than guessed with a zoom number. Unless
// the operator has already chosen a view: theirs is the answer, and fitting
// the world over it would undo the choice on every tab switch.
const saved = loadMapView(MAP_VIEW_GRIDS);
if (saved) m.setView([saved.lat, saved.lon], saved.zoom);
else m.fitWorld({ animate: false });
m.on('moveend', () => {
const c = m.getCenter();
saveMapView(MAP_VIEW_GRIDS, c.lat, c.lng, m.getZoom());
});
mapRef.current = m;
layerRef.current = L.layerGroup().addTo(m);
// Leaflet measures its container ONCE, when the map is created, and never
@@ -144,7 +153,7 @@ export function GridSquareMap({ myGrid, className }: { myGrid?: string; classNam
// fitWorld above ran against a container that may still have had no size —
// the tab is mounted hidden. Fit ONCE more the first time it really has one,
// and never again: after that the view belongs to the operator.
let fitted = false;
let fitted = !!saved; // a remembered view is already the right size
const ro = new ResizeObserver(() => {
m.invalidateSize({ animate: false });
const el = hostRef.current;
+49 -12
View File
@@ -5,15 +5,13 @@ import { nightPolygon } from '../lib/greyline';
import { gridToLatLon, gridSquareBounds, greatCirclePoints, pathBetween, destinationPoint } from '@/lib/maidenhead';
import { writeUiPref } from '@/lib/uiPref';
import { formatDistance } from '@/lib/units';
import { loadMapView, saveMapView, MAP_VIEW_WORLD } from '@/lib/mapView';
// Persisted free-pan view of the world map (when auto-zoom is off).
function loadMapView(): { lat: number; lon: number; zoom: number } | null {
try { const v = JSON.parse(localStorage.getItem('opslog.mapView') || 'null'); return v && typeof v.zoom === 'number' ? v : null; }
catch { return null; }
}
function saveMapView(m: L.Map) {
const loadWorldView = () => loadMapView(MAP_VIEW_WORLD);
function saveWorldView(m: L.Map) {
const c = m.getCenter();
writeUiPref('opslog.mapView', JSON.stringify({ lat: c.lat, lon: c.lng, zoom: m.getZoom() }));
saveMapView(MAP_VIEW_WORLD, c.lat, c.lng, m.getZoom());
}
// The Main tab is built from two independent map panes that the operator can
@@ -28,6 +26,26 @@ function saveMapView(m: L.Map) {
// unwrapLon makes a lat/lon ring continuous in longitude (each point within
// 180° of the previous) so a polygon crossing the antimeridian doesn't snap
// across the whole map. Coords may exceed ±180; Leaflet (worldCopyJump) is fine.
// homeView is where a world map should open for THIS station.
//
// Centred on 0° a world map puts Europe in the middle and leaves an Australian
// looking at their own country in the bottom-right corner, with the paths to
// everywhere they work running off both edges. Centred on their own longitude
// the same map reads the way their antenna does: the Americas to the east,
// Europe and Africa to the west. Leaflet repeats the world horizontally
// (worldCopyJump), so this is a choice of viewpoint and costs nothing — the
// tiles either side are the same world, and the great-circle code already draws
// across the seam (see unwrapLon).
//
// The latitude is damped, not followed: a station at 69° north centred on itself
// would spend half the map on the Arctic. It leans towards the operator's
// hemisphere and stops well short of the pole.
function homeView(grid: string): [number, number] {
const home = gridToLatLon(grid);
if (!home) return [20, 0];
return [Math.max(-35, Math.min(45, home.lat * 0.6 + 8)), home.lon];
}
function unwrapLon(ring: [number, number][]): [number, number][] {
const out: [number, number][] = [];
let prev = NaN;
@@ -178,31 +196,50 @@ export function WorldMap({ fromGrid, toGrid, fromLabel, toLabel, beamAzimuths, b
const autoZoomRef = useRef(autoZoom);
useEffect(() => { autoZoomRef.current = autoZoom; }, [autoZoom]);
// WAIT FOR THE SQUARE BEFORE PAINTING.
//
// The station's own locator arrives from the profile a moment after this
// component mounts. Building the map immediately meant painting the world at
// 0°, then moving it to the operator's longitude — a screenful of tiles
// fetched from Esri and thrown away on every first run. The map is built once,
// when it knows where it is looking.
//
// Not for ever, though: an operator with no locator set (or a profile still
// loading after two seconds) gets the default view rather than a blank panel.
const [mapReady, setMapReady] = useState(() => !!gridToLatLon(fromGrid) || !!loadWorldView());
useEffect(() => {
if (mapReady) return;
if (gridToLatLon(fromGrid)) { setMapReady(true); return; }
const t = window.setTimeout(() => setMapReady(true), 2000);
return () => window.clearTimeout(t);
}, [fromGrid, mapReady]);
// One-time map creation.
useEffect(() => {
if (worldRef.current && !worldMap.current) {
if (worldRef.current && !worldMap.current && mapReady) {
// preferCanvas: the beam lobe is a dense FAN of translucent radials — up to
// ~120 thick strokes with a bidirectional Ultrabeam. As SVG that is ~120
// composited paths re-rasterised on every pan, zoom and redraw, which is
// enough to blow WebView2's raster budget and leave the window painting in
// patches. On canvas it is a single layer.
const m = L.map(worldRef.current, { zoomControl: true, attributionControl: true, worldCopyJump: true, preferCanvas: true })
.setView([20, 0], 1);
.setView(homeView(fromGrid), 1);
addBasemap(m, basemap, baseLayer, labelsLayer);
worldOverlay.current = L.layerGroup().addTo(m);
worldMap.current = m;
const sv = loadMapView();
const sv = loadWorldView();
if (!autoZoomRef.current && sv) m.setView([sv.lat, sv.lon], sv.zoom);
m.on('moveend', () => { if (!autoZoomRef.current) saveMapView(m); });
m.on('moveend', () => { if (!autoZoomRef.current) saveWorldView(m); });
}
const t = window.setTimeout(() => { worldMap.current?.invalidateSize(); }, 80);
// Resizing the pane is the ONLY thing that needs invalidateSize. Calling it on
// every overlay redraw (as before) forced a full repaint of the map each time
// the rotor moved a degree.
const ro = new ResizeObserver(() => worldMap.current?.invalidateSize());
if (worldRef.current) ro.observe(worldRef.current);
return () => { window.clearTimeout(t); ro.disconnect(); };
}, []);
}, [mapReady]);
// Swap the basemap (and its optional place-name overlay) when the operator
// picks a different one. Vector overlays (path/beam) live in Leaflet's
@@ -427,7 +464,7 @@ export function WorldMap({ fromGrid, toGrid, fromLabel, toLabel, beamAzimuths, b
setAutoZoom(v);
writeUiPref('opslog.mapAutoZoomDX', v ? '1' : '0');
const m = worldMap.current;
if (!v && m) saveMapView(m);
if (!v && m) saveWorldView(m);
}}
title={autoZoom ? 'Auto-zoom to DX is ON — click for free pan/zoom (remembered)' : 'Free pan/zoom — click to auto-zoom to the DX'}
className={`absolute top-1 right-1 z-[500] rounded-md px-2 py-1 text-[11px] font-medium shadow border backdrop-blur transition-colors ${
+7 -3
View File
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useRef, useState } from 'react';
import { Trash2, Search, Loader2, CalendarDays } from 'lucide-react';
import { LookupCallsign, LookupCallsignFresh, DXCCForCountry, GetAwardDefs, ComputeQSOAwardRefs, GetListsSettings, OpenExternalURL, SetOpsLogQSLReceived } from '../../wailsjs/go/main/App';
import { rstOptions, type RSTLists } from '@/lib/rst';
import { rstOptions, stepRST, type RSTLists } from '@/lib/rst';
import { AwardRefSelector } from '@/components/AwardRefSelector';
import { AdifExtrasEditor } from '@/components/AdifExtrasEditor';
import { applyAwardRefs } from '@/lib/awardRefs';
@@ -598,9 +598,13 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
value={draft.callsign ?? ''} onChange={(e) => set('callsign', e.target.value)} />
</div>
<div className="flex flex-col w-20"><Label>S</Label>
<Combobox value={draft.rst_sent ?? ''} options={rstOptions(draft.mode ?? '', rstLists)} commitOnType onChange={(v) => set('rst_sent', v)} /></div>
<Combobox value={draft.rst_sent ?? ''} options={rstOptions(draft.mode ?? '', rstLists)} commitOnType
onChange={(v) => set('rst_sent', v)}
onWheelStep={(d) => set('rst_sent', stepRST(draft.rst_sent ?? '', d, draft.mode ?? ''))} /></div>
<div className="flex flex-col w-20"><Label>R</Label>
<Combobox value={draft.rst_rcvd ?? ''} options={rstOptions(draft.mode ?? '', rstLists)} commitOnType onChange={(v) => set('rst_rcvd', v)} /></div>
<Combobox value={draft.rst_rcvd ?? ''} options={rstOptions(draft.mode ?? '', rstLists)} commitOnType
onChange={(v) => set('rst_rcvd', v)}
onWheelStep={(d) => set('rst_rcvd', stepRST(draft.rst_rcvd ?? '', d, draft.mode ?? ''))} /></div>
<Button type="button" variant="outline" className="h-10" onClick={fetchLookup} disabled={looking}
title={t('qedit.fetchTitle')}>
{looking ? <Loader2 className="size-4 animate-spin" /> : <Search className="size-4" />} {t('qedit.fetch')}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,381 @@
// RotorCompassClassic — the original rotor dial, kept as an option.
//
// Settings → Rotator chooses between this and the current compass. It was
// replaced rather than removed because the two answer the same question in
// different ways: this one is a small light-map dial with the quick turns in a
// column beside it, and an operator used to it should not have to relearn a
// panel to keep working.
//
// An azimuthal-equidistant rotor display (à la 4O3A RotorGenius).
//
// A world map centred on the operator's QTH (north up) fills the dial, ringed by
// a green azimuth bezel. A green needle shows the antenna heading (two needles
// when an Ultrabeam is bidirectional, the opposite one when reversed); a small
// red marker on the bezel shows the short-path bearing to the DX. Click the dial
// to turn the antenna there.
import { useEffect, useMemo, useRef, useState } from 'react';
import { geoAzimuthalEquidistant, geoPath, geoGraticule10 } from 'd3-geo';
import { feature } from 'topojson-client';
import landTopo from 'world-atlas/land-110m.json';
import { Compass, X, Play, Square } from 'lucide-react';
import { cn } from '@/lib/utils';
import { useI18n } from '@/lib/i18n';
// Decode the coastline outline once (≈110 m simplified land polygons).
const LAND = feature(landTopo as any, (landTopo as any).objects.land);
const GRATICULE = geoGraticule10();
interface Props {
bearing?: number | null; // short-path azimuth to DX (deg)
headings: number[]; // radiating heading(s) — rotor + Ultrabeam pattern
boomHeading?: number | null; // mechanical boom (rotor) azimuth, shown grey when it differs
pattern?: 'normal' | 'reverse' | 'bi' | null; // Ultrabeam pattern (for the badge)
centerLat?: number | null; // operator latitude (projection centre)
centerLon?: number | null; // operator longitude
rotorEnabled?: boolean;
rotors?: string[]; // logical rotor names; >1 → show a selector
activeRotor?: number; // index of the selected rotor (0-based)
onSelectRotor?: (i: number) => void; // switch the active rotor
onGoto?: (az: number) => void; // click-to-turn
onClose?: () => void;
// Quick-turn buttons and the azimuth box, shown only where the caller wants
// them: Station Control draws its own GoTo/Stop around this compass, and two
// sets of the same controls side by side would be nothing but confusing.
presets?: { label: string; azimuth: number }[];
onStop?: () => void;
}
const SIZE = 168;
const C = SIZE / 2;
const R = C - 6; // outer bezel radius
const MAP_R = R - 6; // map/clip radius (inside the bezel)
function pt(az: number, radius: number): [number, number] {
const a = ((az - 90) * Math.PI) / 180;
return [C + radius * Math.cos(a), C + radius * Math.sin(a)];
}
export function RotorCompassClassic({ bearing, headings, boomHeading, pattern, centerLat, centerLon, rotorEnabled, rotors, activeRotor, onSelectRotor, onGoto, onClose, presets, onStop }: Props) {
const { t } = useI18n();
// Raw text, not a number: binding the input to a normalised value makes
// Backspace fight the operator on the way from "230" to "23". It is parsed
// when it is sent, and only then.
const [azText, setAzText] = useState('');
const showControls = !!(presets || onStop);
// Which preset was just pressed, so it can light up for a moment.
//
// A rotor takes seconds to start moving and the needle barely twitches at
// first, so without this the only answer to "did that register?" is to press
// it again — which is how an antenna ends up ordered somewhere twice. The
// acknowledgement has to come from the button itself, at once.
const [flashIdx, setFlashIdx] = useState<number | null>(null);
const flashTimer = useRef<number | undefined>(undefined);
useEffect(() => () => window.clearTimeout(flashTimer.current), []);
const pressPreset = (i: number, az: number) => {
if (!onGoto) return;
setFlashIdx(i);
window.clearTimeout(flashTimer.current);
flashTimer.current = window.setTimeout(() => setFlashIdx(null), 450);
onGoto(az);
};
// Stop needs the same acknowledgement, for the same reason and one more: it
// is pressed when something is already wrong, and a button that stays inert
// gets hit again and again. Its own flag, so stopping does not blank a preset
// that is still lit.
const [stopFlash, setStopFlash] = useState(false);
const stopTimer = useRef<number | undefined>(undefined);
useEffect(() => () => window.clearTimeout(stopTimer.current), []);
const pressStop = () => {
if (!onStop) return;
setStopFlash(true);
window.clearTimeout(stopTimer.current);
stopTimer.current = window.setTimeout(() => setStopFlash(false), 450);
onStop();
};
// 0-359 and nothing else. 360 is refused rather than folded to 0 — it is
// almost always a typo for 36 or 306, and a rotor swinging through north on a
// slip of the finger is worth one rejected keypress.
const sendAz = () => {
const s = azText.trim();
if (s === '' || !onGoto) return;
const n = Number(s);
if (!Number.isFinite(n) || !Number.isInteger(n) || n < 0 || n > 359) return;
onGoto(n);
setAzText('');
};
const cardinals = useMemo(
() => [ { d: 0, l: 'N' }, { d: 45, l: 'NE' }, { d: 90, l: 'E' }, { d: 135, l: 'SE' },
{ d: 180, l: 'S' }, { d: 225, l: 'SW' }, { d: 270, l: 'W' }, { d: 315, l: 'NW' } ],
[],
);
// Project the world centred on the QTH (north up; antipode at the bezel).
const { land, grat } = useMemo(() => {
if (centerLat == null || centerLon == null) return { land: '', grat: '' };
const proj = geoAzimuthalEquidistant()
.rotate([-centerLon, -centerLat])
.clipAngle(179.9)
.scale(MAP_R / Math.PI)
.translate([C, C]);
const path = geoPath(proj as any);
return { land: path(LAND as any) || '', grat: path(GRATICULE as any) || '' };
}, [centerLat, centerLon]);
function handleClick(e: React.MouseEvent<SVGSVGElement>) {
if (!onGoto) return;
const rect = e.currentTarget.getBoundingClientRect();
const x = ((e.clientX - rect.left) / rect.width) * SIZE - C;
const y = ((e.clientY - rect.top) / rect.height) * SIZE - C;
let az = (Math.atan2(y, x) * 180) / Math.PI + 90;
az = ((az % 360) + 360) % 360;
onGoto(Math.round(az));
}
const headLabel = headings.length ? headings[0] : null;
// Short and long path to the DX, in figures.
//
// The bezel already carries the short path as a red marker, but a marker is a
// direction, not a number — the same pair sits in the status bar at 10px and
// operators reported not being able to read it. It lives here because it
// belongs to the compass: every place that draws one gets the readout, instead
// of each caller inventing its own. Clickable when the caller can turn, like
// the status bar's. Built as a value because it is placed in one of two
// columns depending on whether the controls are shown.
const pathReadout = (
<div className="flex gap-1.5 mt-2 font-mono w-full">
{([['SP', bearing ?? null], ['LP', bearing == null ? null : (bearing + 180) % 360]] as const).map(([lbl, az]) => (
<button key={lbl} type="button" disabled={az == null || !onGoto}
onClick={() => { if (az != null && onGoto) onGoto(Math.round(az)); }}
title={az == null ? '' : `${lbl} ${Math.round(az)}°`}
className={
'flex-1 rounded-md border py-1 text-xs font-semibold tabular-nums transition-colors active:scale-95 ' +
(az == null
? 'border-border text-muted-foreground/50 cursor-not-allowed'
: onGoto
? 'border-info-border text-info-muted-foreground hover:bg-info-muted cursor-pointer'
: 'border-border text-muted-foreground cursor-default')
}>
{lbl} {az == null ? '—' : `${Math.round(az)}°`}
</button>
))}
</div>
);
return (
<section className="flex flex-col h-full min-h-0 rounded-lg border border-border bg-card overflow-hidden">
{/* Header — matches the WinKeyer / Voice keyer panels. */}
<div className="flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border shrink-0">
<Compass className="size-4 text-primary shrink-0" />
<span className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">Rotor</span>
<span className={cn('size-2 rounded-full', rotorEnabled ? 'bg-success' : 'bg-muted-foreground/40')}
title={rotorEnabled ? 'Rotator connected' : 'Rotator disabled'} />
<div className="flex-1" />
{pattern && (
<span
className={cn('px-1 py-px rounded text-[9px] font-bold tracking-wide',
pattern === 'reverse' ? 'bg-warning-muted text-warning-muted-foreground'
: pattern === 'bi' ? 'bg-info-muted text-info-muted-foreground'
: 'bg-success-muted text-success-muted-foreground')}
title={pattern === 'reverse' ? 'Ultrabeam reversed — radiates opposite the boom'
: pattern === 'bi' ? 'Ultrabeam bidirectional — radiates both ways'
: 'Ultrabeam normal'}>
{pattern === 'reverse' ? 'REV' : pattern === 'bi' ? 'BI' : 'NORM'}
</span>
)}
<span className="font-mono text-sm font-bold text-success tabular-nums">
{headLabel != null ? `${Math.round(headLabel).toString().padStart(3, '0')}°` : '—'}
</span>
{onClose && (
<button className="text-muted-foreground hover:text-foreground" title="Hide rotor" onClick={onClose}>
<X className="size-3.5" />
</button>
)}
</div>
{/* Multiple rotors — pick which one the dial shows and turns. */}
{rotors && rotors.length > 1 && (
<div className="flex flex-wrap gap-1 px-2 pt-1.5">
{rotors.map((nm, i) => {
const active = (activeRotor ?? 0) === i;
const label = nm?.trim() || `Rotor ${i + 1}`;
return (
<button
key={i}
onClick={() => onSelectRotor?.(i)}
className={cn(
'flex-1 min-w-[48px] px-1.5 py-0.5 rounded text-[10px] font-semibold truncate transition-colors',
active
? 'bg-success text-success-foreground'
: 'bg-muted text-muted-foreground hover:bg-muted/70',
)}
title={label}
>
{label}
</button>
);
})}
</div>
)}
{/* Dial on the left, controls on the right. The controls column is sized to
fit WITHIN the dial's height: the widget sits in a row whose height is
set by the entry strip, so it may grow sideways but never downwards. */}
<div className="flex items-start gap-2 p-2 min-h-0">
{/* flex-col: the readout goes BELOW the dial. This wrapper was a row, so a
sibling of the <svg> landed beside it. */}
<div className="flex flex-col items-center justify-center min-h-0 shrink-0">
<svg
viewBox={`0 0 ${SIZE} ${SIZE}`}
className={onGoto ? 'cursor-pointer select-none' : 'select-none'}
style={{ width: SIZE, height: SIZE }}
onClick={handleClick}
>
<defs>
<clipPath id="rotorDial"><circle cx={C} cy={C} r={MAP_R} /></clipPath>
</defs>
{/* water + world map, clipped to the dial */}
<circle cx={C} cy={C} r={MAP_R} fill="#d3e7f1" />
<g clipPath="url(#rotorDial)">
{grat && <path d={grat} fill="none" stroke="#9cc0d6" strokeWidth={0.4} opacity={0.7} />}
{land && <path d={land} fill="#dfe2cf" stroke="#9aa589" strokeWidth={0.4} />}
</g>
{/* green azimuth bezel */}
<circle cx={C} cy={C} r={R} fill="none" stroke="#16a34a" strokeWidth={5} />
{/* ticks every 10°, longer at 30° */}
{Array.from({ length: 36 }, (_, i) => i * 10).map((d) => {
const major = d % 30 === 0;
const [x1, y1] = pt(d, MAP_R);
const [x2, y2] = pt(d, MAP_R - (major ? 7 : 4));
return <line key={d} x1={x1} y1={y1} x2={x2} y2={y2} stroke="#475569" strokeWidth={major ? 1 : 0.6} opacity={0.7} />;
})}
{/* cardinal labels + degree numbers at 45° */}
{cardinals.map(({ d, l }) => {
const [x, y] = pt(d, MAP_R - 13);
return <text key={l} x={x} y={y} textAnchor="middle" dominantBaseline="central" className="fill-slate-700" style={{ fontSize: l.length > 1 ? 7 : 9, fontWeight: 700 }}>{l}</text>;
})}
{/* DX short-path bearing → small red marker on the bezel */}
{bearing != null && (() => { const [x, y] = pt(bearing, MAP_R); return (
<circle cx={x} cy={y} r={3} fill="#dc2626" stroke="#fff" strokeWidth={1} />
); })()}
{/* mechanical boom (rotor) heading — grey dashed needle, shown when the
Ultrabeam radiates somewhere other than the boom (reverse/bi) so the
operator sees where the antenna physically points vs where it boom-sits */}
{boomHeading != null && pattern && pattern !== 'normal' && (() => {
const [x, y] = pt(boomHeading, MAP_R - 2);
return (
<g>
<title>Boom (rotor) {Math.round(boomHeading)}°</title>
<line x1={C} y1={C} x2={x} y2={y} stroke="#64748b" strokeWidth={2} strokeDasharray="3 3" strokeLinecap="round" />
<circle cx={x} cy={y} r={3} fill="#64748b" stroke="#fff" strokeWidth={1} />
</g>
);
})()}
{/* radiating heading needle(s) — green; two when bidirectional */}
{headings.map((h, i) => { const [x, y] = pt(h, MAP_R - 2); return (
<g key={i}>
<line x1={C} y1={C} x2={x} y2={y} stroke="#15803d" strokeWidth={3} strokeLinecap="round" opacity={i === 0 ? 1 : 0.55} />
<polygon points={`${x},${y} ${pt(h - 5, MAP_R - 12).join(',')} ${pt(h + 5, MAP_R - 12).join(',')}`} fill="#15803d" opacity={i === 0 ? 1 : 0.55} />
</g>
); })}
<circle cx={C} cy={C} r={3.5} fill="#15803d" stroke="#fff" strokeWidth={1} />
</svg>
{/* With the controls column present the readout goes at the FOOT OF IT
instead: the dial sets the widget's height, the controls are shorter
than the dial, and that leftover space is exactly the right size for
the pair. Under the dial it would push the whole widget taller. */}
{!showControls && pathReadout}
</div>
{/* Quick turns + free azimuth + Stop. */}
{showControls && (
<div className="flex flex-col gap-1.5 flex-1 min-w-0">
{/* Two columns so six regions fit beside the dial rather than under
it. An operator with fewer keeps the same compact block. */}
{!!presets?.length && (
<div className="grid grid-cols-2 gap-1">
{presets.map((p, i) => (
<button
key={`${p.label}-${i}`}
type="button"
disabled={!onGoto}
onClick={() => pressPreset(i, p.azimuth)}
title={`${p.label}${p.azimuth}°`}
className={cn(
'rounded-md border py-1 text-xs font-semibold truncate transition-all duration-150 active:scale-95',
flashIdx === i
// Lit, and showing the azimuth it just sent: the label alone
// would only say the press landed, not what was ordered.
? 'border-success bg-success text-success-foreground scale-95'
: 'border-border bg-muted/40',
onGoto && flashIdx !== i ? 'hover:bg-muted' : '',
!onGoto ? 'opacity-50 cursor-not-allowed' : '',
)}
>
{flashIdx === i ? `${p.azimuth}°` : p.label}
</button>
))}
</div>
)}
{/* Free azimuth: Enter sends, so the whole thing is type-three-digits
-and-go without reaching for the mouse. */}
<div className="flex gap-1">
<input
type="text"
inputMode="numeric"
value={azText}
onChange={(e) => setAzText(e.target.value.replace(/[^0-9]/g, '').slice(0, 3))}
onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault(); sendAz(); } }}
placeholder={t('rotor.azPh')}
title={t('rotor.azTitle')}
disabled={!onGoto}
className="min-w-0 flex-1 rounded-md border border-border bg-background px-2 py-1 text-xs font-mono tabular-nums text-center disabled:opacity-50"
/>
<button
type="button"
onClick={sendAz}
disabled={!onGoto || azText.trim() === ''}
title={t('rotor.go')}
className="flex items-center gap-1 rounded-md border border-success/60 bg-success-muted px-2 py-1 text-xs font-bold text-success-muted-foreground transition-transform hover:bg-success/25 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed"
>
<Play className="size-3" /> {t('rotor.go')}
</button>
</div>
{onStop && (
<button
type="button"
onClick={pressStop}
title={t('rotor.stop')}
className={cn(
'flex items-center justify-center gap-1.5 rounded-md border py-1 text-xs font-bold transition-all duration-150 active:scale-95',
stopFlash
// Solid, not a tint: STOP reads the same in both languages, so
// the fill is the whole acknowledgement.
? 'border-destructive bg-destructive text-destructive-foreground scale-95'
: 'border-destructive/60 bg-destructive/15 text-destructive hover:bg-destructive/25',
)}
>
<Square className="size-3 fill-current" /> {t('rotor.stop')}
</button>
)}
{/* mt-auto: the readout sits at the FOOT of the column, level with the
bottom of the dial, instead of floating under the Stop button. */}
<div className="mt-auto">{pathReadout}</div>
</div>
)}
</div>
</section>
);
}
+99 -10
View File
@@ -60,7 +60,7 @@ import {
GetFolderSync, SaveFolderSync, PickFolderSyncFolder, GetFolderSyncStatus, SyncFolderNow,
GetRelayAuto, SaveRelayAuto, GetStationDevices,
GetAwardDefs, GetTrackedAwards, SaveTrackedAwards,
GetBandOpenSettings, SaveBandOpenSettings, GetGridScopeSettings, SaveGridScopeSettings, GetPSKReporterStatus, GetChaseNewGrids, SetChaseNewGrids, GetChaseNew, SetChaseNew, GetPSKTargetSettings, SavePSKTargetSettings, GetAutoCallSettings, SaveAutoCallSettings, GetWatchlistContestCalls, SetWatchlistContestCalls, GetWatchlistContestPattern, SetWatchlistContestPattern, GetGridCacheStatus, GetLinkedAmps, SetLinkedAmps, GetSpotTTLMinutes, SetSpotTTLMinutes, GetSpotMax, SetSpotMax,
GetBandOpenSettings, SaveBandOpenSettings, GetGridScopeSettings, SaveGridScopeSettings, GetPSKReporterStatus, GetChaseNewGrids, SetChaseNewGrids, GetChaseNew, SetChaseNew, GetPSKTargetSettings, SavePSKTargetSettings, GetAutoCallSettings, SaveAutoCallSettings, GetChaseNewBands, SetChaseNewBands, GetWatchlistContestCalls, SetWatchlistContestCalls, GetWatchlistContestPattern, SetWatchlistContestPattern, GetGridCacheStatus, GetLinkedAmps, SetLinkedAmps, GetSpotTTLMinutes, SetSpotTTLMinutes, GetSpotMax, SetSpotMax,
} from '../../wailsjs/go/main/App';
import type { profile as profileModels } from '../../wailsjs/go/models';
import type { LookupSettingsForm, StationSettingsForm, ListsSettingsForm, ModePresetForm } from '@/types';
@@ -83,6 +83,7 @@ import {
import { cn } from '@/lib/utils';
import { writeUiPref } from '@/lib/uiPref';
import { setUseMiles } from '@/lib/units';
import { rotorStyle, setRotorStyle, type RotorStyle } from '@/lib/rotorStyle';
import { iaruRegion, setIaruRegion, type IaruRegion } from '@/lib/bandplan';
import { getDateFormat, setDateFormat, type DateFormat } from '@/lib/dateFormat';
import { useI18n, FlagGB, FlagFR, type Lang } from '@/lib/i18n';
@@ -405,16 +406,21 @@ interface TreeProps {
flexAvailable?: boolean;
}
function Tree({ selected, onSelect, flexAvailable }: TreeProps) {
// The sidebar. Memoised and its tree built once per (language, radio): it is
// sixty-odd items that depend on nothing an operator types, and it was rebuilt
// and re-rendered on every keystroke in every field of every panel — the whole
// dialog holds its state in one component, so one character redraws all of it.
const Tree = memo(function Tree({ selected, onSelect, flexAvailable }: TreeProps) {
const { t } = useI18n();
const nodes = useMemo(() => buildTree(!!flexAvailable, t), [flexAvailable, t]);
return (
<nav className="text-sm">
{buildTree(!!flexAvailable, t).map((node, i) => (
{nodes.map((node, i) => (
<TreeNodeView key={i} node={node} depth={0} selected={selected} onSelect={onSelect} />
))}
</nav>
);
}
});
function TreeNodeView({
node, depth, selected, onSelect,
@@ -472,6 +478,11 @@ function TreeNodeView({
// identity is STABLE across SettingsModal re-renders; defining them inside the
// component would give each render a fresh function, remounting the Radix
// Select and slamming the open dropdown shut on any ambient re-render.
// The bands the Chase new filter offers, in band-plan order. Mirrors
// ChaseNewBands in pskchase.go, which is what actually filters the feed —
// a band added there and not here is simply one nobody can switch off.
const CHASE_BANDS = ['160m', '80m', '60m', '40m', '30m', '20m', '17m', '15m', '12m', '10m', '6m', '4m', '2m', '70cm'];
const THEME_SWATCH: Record<Exclude<ThemeChoice, 'auto'>, { bg: string; card: string; accent: string }> = {
'light-warm': { bg: '#e8dfc9', card: '#faf6ea', accent: '#b8410c' },
'light-cool': { bg: '#f4f6f8', card: '#ffffff', accent: '#2563eb' },
@@ -1610,6 +1621,11 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
const [listenPref, setListenPref] = useState(true);
const [activeRadio, setActiveRadioId] = useState('');
const [radioBusy, setRadioBusy] = useState(false);
// "Other (custom address)" has to STAY chosen. The dropdown is derived from
// the address, so picking Other while the address still matched a listed rig
// put the list straight back on that rig — the operator saw it jump back to
// IC-7610 the moment they chose Other.
const [icomCustom, setIcomCustom] = 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: '',
@@ -1755,6 +1771,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
// the full widget is what the operator has today, and a setting that changes
// a panel the moment you upgrade is a setting that gets blamed for it.
const [rotorCompact, setRotorCompact] = useState(() => localStorage.getItem('opslog.rotorCompact') === '1');
const [rotorDial, setRotorDial] = useState<RotorStyle>(() => rotorStyle());
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');
@@ -2089,11 +2106,18 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
const [chaseSotaOn, setChaseSotaOn] = useState(() => localStorage.getItem('opslog.chaseSota') !== '0');
const [chaseNew, setChaseNew] = useState(false);
const [pskTgt, setPskTgt] = useState<any>({ enabled: false, scope: 'target' });
const [ac, setAc] = useState<any>({ enabled: false, only: '', attempts: 7, watched_attempts: 15, misses: 3, max_rounds: 3, rest_min: 2 });
const [ac, setAc] = useState<any>({ enabled: false, only: '', attempts: 7, watched_attempts: 15, misses: 3, max_rounds: 3, rest_periods: 1, on_screen_only: true });
// The named contest callsigns. Raw text in state, written on blur: it is a
// multi-line list, and normalising it on every keystroke would fight the
// Return key — the one key this box is built around.
const [contestCalls, setContestCalls] = useState('');
// Which bands the Chase new panel shows. The station's own band list still
// applies underneath — this one is "what am I watching tonight".
const [chaseBands, setChaseBands] = useState<string[]>([]);
const saveChaseBands = (next: string[]) => {
setChaseBands(next);
void SetChaseNewBands(next);
};
const [contestPattern, setContestPattern] = useState('');
const saveAC = async (next: any) => {
setAc(next);
@@ -2132,6 +2156,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
try { setChaseNew(await GetChaseNew()); } catch { /* defaults stand */ }
try { setPskTgt(await GetPSKTargetSettings()); } catch { /* defaults stand */ }
try { setAc(await GetAutoCallSettings()); } catch { /* defaults stand */ }
try { setChaseBands((await GetChaseNewBands()) ?? []); } catch { /* defaults stand */ }
try { setContestCalls(await GetWatchlistContestCalls()); } catch { /* defaults stand */ }
try { setContestPattern(await GetWatchlistContestPattern()); } catch { /* defaults stand */ }
try { setLinkedAmps((await GetLinkedAmps()) ?? []); } catch { /* defaults stand */ }
@@ -3608,8 +3633,12 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
<div className="space-y-1">
<Label>{t('cat.icomModel')}</Label>
<Select
value={ICOM_MODELS.find((m) => m.addr === (catCfg.icom_addr ?? 0x98))?.name ?? '_custom'}
onValueChange={(v) => { const m = ICOM_MODELS.find((x) => x.name === v); if (m) setCatCfg((s) => ({ ...s, icom_addr: m.addr })); }}>
value={icomCustom ? '_custom' : (ICOM_MODELS.find((m) => m.addr === (catCfg.icom_addr ?? 0x98))?.name ?? '_custom')}
onValueChange={(v) => {
const m = ICOM_MODELS.find((x) => x.name === v);
setIcomCustom(!m);
if (m) setCatCfg((s) => ({ ...s, icom_addr: m.addr }));
}}>
<SelectTrigger><SelectValue /></SelectTrigger>
<SelectContent>
{ICOM_MODELS.map((m) => <SelectItem key={m.name} value={m.name}>{m.name}</SelectItem>)}
@@ -3635,8 +3664,12 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
<div className="space-y-1">
<Label>{t('cat.icomModel')}</Label>
<Select
value={ICOM_MODELS.find((m) => m.addr === (catCfg.icom_addr ?? 0x98))?.name ?? '_custom'}
onValueChange={(v) => { const m = ICOM_MODELS.find((x) => x.name === v); if (m) setCatCfg((s) => ({ ...s, icom_addr: m.addr })); }}>
value={icomCustom ? '_custom' : (ICOM_MODELS.find((m) => m.addr === (catCfg.icom_addr ?? 0x98))?.name ?? '_custom')}
onValueChange={(v) => {
const m = ICOM_MODELS.find((x) => x.name === v);
setIcomCustom(!m);
if (m) setCatCfg((s) => ({ ...s, icom_addr: m.addr }));
}}>
<SelectTrigger><SelectValue /></SelectTrigger>
<SelectContent>
{ICOM_MODELS.map((m) => <SelectItem key={m.name} value={m.name}>{m.name}</SelectItem>)}
@@ -4855,6 +4888,20 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
dial to take a column, not a panel. */}
<div className="border-t border-border/60 pt-3 space-y-2">
<div className="text-sm font-semibold">{t('rot.widget')}</div>
{/* Which dial. Both are kept: the new one reads at a glance across
the shack, the old one is the compact dial operators learned
first, and neither is wrong. */}
<div className="flex items-center gap-2 text-sm">
<span className="text-muted-foreground">{t('rot.dial')}</span>
<select
value={rotorDial}
onChange={(e) => { const v = e.target.value as RotorStyle; setRotorDial(v); setRotorStyle(v); }}
className="h-8 rounded-md border border-border bg-background px-2 text-sm"
>
<option value="modern">{t('rot.dialModern')}</option>
<option value="classic">{t('rot.dialClassic')}</option>
</select>
</div>
<label className="flex items-center gap-2 text-sm">
<Checkbox checked={rotorCompact}
onCheckedChange={(c) => { const v = !!c; setRotorCompact(v); writeUiPref('opslog.rotorCompact', v ? '1' : '0'); }} />
@@ -5402,6 +5449,34 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
<span className="text-xs text-muted-foreground">{t('chn.nearKmHint')}</span>
</div>
)}
{/* Which bands the panel lists. Not the station's band list that
one says what this station can work at all and still applies
underneath. This says what is worth watching tonight, which is
a different question and changes far more often. */}
{chaseNew && (
<div className="pl-6 space-y-1">
<span className="text-xs text-muted-foreground">{t('chn.bands')}</span>
<div className="flex flex-wrap items-center gap-1">
{CHASE_BANDS.map((b) => {
const on = chaseBands.includes(b);
return (
<button key={b} type="button"
onClick={() => saveChaseBands(on ? chaseBands.filter((x) => x !== b) : [...chaseBands, b])}
className={cn('h-6 px-2 rounded-full border text-[11px] font-medium transition-colors',
on ? 'border-primary bg-primary text-primary-foreground'
: 'border-border text-muted-foreground hover:bg-muted')}>
{b}
</button>
);
})}
<button type="button" onClick={() => saveChaseBands([...CHASE_BANDS])}
className="h-6 px-2 rounded-full border border-border text-[11px] text-muted-foreground hover:bg-muted">
{t('chn.bandsAll')}
</button>
</div>
<p className="text-xs text-muted-foreground">{t('chn.bandsHint')}</p>
</div>
)}
</div>
{/* PSK Reporter analysis of the station being called. Same service as
@@ -5491,7 +5566,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
['watched_attempts', t('ac.watchedAttempts'), 1, 60],
['misses', t('ac.misses'), 1, 10],
['max_rounds', t('ac.rounds'), 1, 10],
['rest_min', t('ac.rest'), 1, 60],
['rest_periods', t('ac.rest'), 1, 20],
] as [string, string, number, number][]).map(([k, label, min, max]) => (
<span key={k} className="inline-flex items-center gap-1.5">
<span className="text-xs text-muted-foreground">{label}</span>
@@ -5505,6 +5580,20 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
</span>
))}
</div>
{/* A rule about what the transmitter may call, stated once. The
decodes panel has a LoTW chip too, but that one is a way of
READING the band it is flicked on and off while looking
around, and the panel can be closed. */}
<label className="flex items-center gap-2 text-xs cursor-pointer">
<Checkbox checked={ac.on_screen_only !== false}
onCheckedChange={(c) => saveAC({ ...ac, on_screen_only: !!c })} />
<span>{t('ac.onScreen')} <span className="text-muted-foreground">{t('ac.onScreenHint')}</span></span>
</label>
<label className="flex items-center gap-2 text-xs cursor-pointer">
<Checkbox checked={!!ac.trace}
onCheckedChange={(c) => saveAC({ ...ac, trace: !!c })} />
<span>{t('ac.trace')} <span className="text-muted-foreground">{t('ac.traceHint')}</span></span>
</label>
</div>
)}
</div>
@@ -11,6 +11,8 @@ import { useI18n } from '@/lib/i18n';
import { writeUiPref } from '@/lib/uiPref';
import { subscribeRotorHeading, pokeRotorHeading } from '@/lib/rotorHeading';
import { RotorCompass } from '@/components/RotorCompass';
import { RotorCompassClassic } from '@/components/RotorCompassClassic';
import { rotorStyle, subscribeRotorStyle } from '@/lib/rotorStyle';
import { AmpCard } from '@/components/AmpCard';
import { TunerCard } from '@/components/TunerCard';
import type { TGStatus } from '@/components/TunerGeniusPanel';
@@ -128,6 +130,11 @@ function RotatorWidget({ hd, refetch, centerLat, centerLon, bearing, t }: Rotato
}) {
const [goto, setGoto] = useState('');
const [err, setErr] = useState('');
// Both compasses in the app follow the same preference (Settings → Rotator):
// one operator's choice of dial, not one per panel.
const [dial, setDial] = useState(() => rotorStyle());
useEffect(() => subscribeRotorStyle(() => setDial(rotorStyle())), []);
const Dial = dial === 'classic' ? RotorCompassClassic : RotorCompass;
const turn = (az: number) => {
const a = ((Math.round(az) % 360) + 360) % 360;
@@ -145,9 +152,12 @@ function RotatorWidget({ hd, refetch, centerLat, centerLon, bearing, t }: Rotato
title={hd.ok ? t('station.online') : t('station.rotatorNoRead')} />
</div>
<div className="p-3 flex gap-4 items-start">
{/* The SP/LP readout lives INSIDE RotorCompass, so every compass in the
app carries it rather than each caller drawing its own. */}
<RotorCompass
{/* The compact compass is the dial alone — short and long path are the
two coloured dots on it. The figures are in the status bar. */}
{/* The dial-only form is square and fills the box it is given, so its
size is set here rather than baked into the component. */}
<div className={dial === 'classic' ? 'shrink-0' : 'w-[210px] shrink-0'}>
<Dial
bearing={bearing ?? null}
headings={hd.ok ? [hd.azimuth] : []}
centerLat={centerLat ?? null}
@@ -158,6 +168,7 @@ function RotatorWidget({ hd, refetch, centerLat, centerLon, bearing, t }: Rotato
onSelectRotor={(i) => { SetActiveRotor(i).then(refetch).catch((e) => setErr(String(e?.message ?? e))); }}
onGoto={(az) => turn(az)}
/>
</div>
<div className="flex-1 min-w-0 space-y-2">
<div className="font-mono">
<span className="text-2xl font-bold tabular-nums">{hd.ok ? `${hd.azimuth}°` : '—'}</span>
@@ -3,6 +3,7 @@ import { Plus, Trash2, Edit2, RefreshCcw, ArrowDownToLine, ArrowUpFromLine } fro
import {
ListUDPIntegrations, SaveUDPIntegration, DeleteUDPIntegration, ReloadUDPIntegrations,
GetWsjtHighlight, SetWsjtHighlight, GetWsjtHighlightWorked, SetWsjtHighlightWorked, GetWsjtFollowMode, SetWsjtFollowMode,
GetWsjtHighlightColours, SetWsjtHighlightColours,
} from '../../wailsjs/go/main/App';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -161,9 +162,13 @@ type Props = { onError: (msg: string) => void };
export function UDPIntegrationsPanel({ onError }: Props) {
const [highlightOn, setHighlightOn] = useState(false);
const [hlWorked, setHlWorked] = useState(false);
// The palette, as chosen. Background per verdict; the text colour is the
// backends business (see colourFor).
const [colours, setColours] = useState({ watchlist: '#F472B6', new_dxcc: '#16823C', new_band: '#E27A18', worked: '#4B5563' });
const [followMode, setFollowMode] = useState(true);
useEffect(() => {
GetWsjtHighlight().then((v) => setHighlightOn(!!v)).catch(() => {});
GetWsjtHighlightColours().then((c: any) => { if (c) setColours(c); }).catch(() => {});
GetWsjtHighlightWorked().then((v) => setHlWorked(!!v)).catch(() => {});
GetWsjtHighlightWorked().then((v) => setHlWorked(!!v)).catch(() => {});
GetWsjtFollowMode().then((v) => setFollowMode(!!v)).catch(() => {});
@@ -249,16 +254,52 @@ export function UDPIntegrationsPanel({ onError }: Props) {
<span className="block text-[11px] text-muted-foreground">{t('udpp.highlightHint')}</span>
</span>
</label>
{/* The palette, nested under the switch for the same reason as the box
below it. One colour per verdict, and the background only: the text
colour is worked out from it, so a chosen colour cannot come back
unreadable in the decoder's window. */}
{highlightOn && (
<div className="pl-6 max-w-2xl space-y-1.5">
<div className="text-[11px] text-muted-foreground">{t('udpp.hlColours')}</div>
<div className="flex flex-wrap gap-3">
{([
['watchlist', t('udpp.hlWatchlist')],
['new_dxcc', t('udpp.hlNewDxcc')],
['new_band', t('udpp.hlNewBand')],
['worked', t('udpp.hlWorkedC')],
] as const).map(([k, label]) => (
<label key={k} className="inline-flex items-center gap-1.5 text-xs">
<input
type="color"
value={(colours as any)[k] || '#000000'}
onChange={(e) => {
const next = { ...colours, [k]: e.target.value.toUpperCase() };
setColours(next);
void SetWsjtHighlightColours(next as any);
}}
className="h-6 w-8 rounded border border-border bg-background p-0.5 cursor-pointer"
/>
{label}
</label>
))}
<button type="button" className="text-xs text-muted-foreground underline hover:text-foreground"
onClick={() => {
const def = { watchlist: '#F472B6', new_dxcc: '#16823C', new_band: '#E27A18', worked: '#4B5563' };
setColours(def as any);
void SetWsjtHighlightColours(def as any);
}}>
{t('udpp.hlReset')}
</button>
</div>
</div>
)}
{/* Nested under the switch above: the same feature, and meaningless
while that one is off. */}
{highlightOn && (
<label className="flex items-start gap-2 text-sm cursor-pointer max-w-2xl pl-6">
<Checkbox checked={hlWorked}
onCheckedChange={(c) => { setHlWorked(!!c); void SetWsjtHighlightWorked(!!c); }} />
<span>
{t('udpp.hlWorked')}
<span className="block text-[11px] text-muted-foreground">{t('udpp.hlWorkedHint')}</span>
</span>
<span>{t('udpp.hlWorked')}</span>
</label>
)}
<label className="flex items-start gap-2 text-sm cursor-pointer max-w-2xl">
+9 -94
View File
@@ -25,13 +25,7 @@ import {
import { EventsOn } from '../../wailsjs/runtime/runtime';
import type { ClusterSpot, SpotStatusEntry } from '@/components/ClusterGrid';
import { inferSpotMode, spotStatusKey } from '@/lib/spot';
interface WLEntry {
callsign: string; lastSeenStr: string; addedAt: string; spotCount: number;
isContest: boolean; notify: boolean;
isExpedition: boolean; clubLogQSOs24h: number; clubLogTotalQSOs: number;
clubLogHasOQRS: boolean; clubLogLiveStream: boolean;
}
import { useWatchlistSpots, matchesEntry, newBadge, type WLEntry } from '@/lib/watchlistSpots';
interface Props {
spots: ClusterSpot[];
@@ -40,21 +34,6 @@ interface Props {
onSpotClick?: (s: ClusterSpot) => void;
}
// A spot is ON AIR for the badge while its last sighting is this fresh.
const ON_AIR_MS = 10 * 60 * 1000;
// Exact unless the entry carries a trailing * — the same rule the backend's
// Match applies to the live stream, mirrored so the tab and the alerts can
// never disagree about what an entry covers.
function matchesEntry(call: string, pattern: string): boolean {
const c = call.toUpperCase();
if (pattern.endsWith('*')) {
const p = pattern.slice(0, -1);
return p !== '' && c.startsWith(p);
}
return c === pattern;
}
export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: Props) {
const { t } = useI18n();
const [entries, setEntries] = useState<WLEntry[]>([]);
@@ -95,8 +74,6 @@ export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: P
noticeTimer.current = window.setTimeout(() => { setError(''); setNotice(''); }, 4000) as unknown as number;
};
// worked answer per "call|band|modeclass|contest" key.
const [worked, setWorked] = useState<Record<string, boolean>>({});
const refresh = useCallback(async () => {
try { setEntries(((await WatchlistEntries()) ?? []) as any as WLEntry[]); }
@@ -117,63 +94,11 @@ export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: P
// Live spots per entry — prefix-matched, newest first, deduped per band+mode
// (one line per slot; the freshest spot represents it).
const spotsFor = useMemo(() => {
const map = new Map<string, ClusterSpot[]>();
for (const e of entries) map.set(e.callsign, []);
for (const s of spots) {
for (const e of entries) {
if (matchesEntry(s.dx_call ?? '', e.callsign)) { map.get(e.callsign)!.push(s); break; }
}
}
for (const [k, list] of map) {
const seen = new Set<string>();
map.set(k, list.filter((s) => {
const key = `${(s.band ?? '')}|${inferSpotMode(s.comment ?? '', s.freq_hz)}|${s.dx_call}`;
if (seen.has(key)) return false;
seen.add(key);
return true;
}));
}
return map;
}, [spots, entries]);
// The worked answers, refreshed when the visible slots change. Debounced: a
// spot burst must cost one round trip, not one per spot.
const queryTimer = useRef<number | undefined>(undefined);
useEffect(() => {
if (queryTimer.current) window.clearTimeout(queryTimer.current);
queryTimer.current = window.setTimeout(async () => {
const queries: { call: string; band: string; mode: string; contest: boolean }[] = [];
const keys: string[] = [];
for (const e of entries) {
for (const s of spotsFor.get(e.callsign) ?? []) {
const mode = inferSpotMode(s.comment ?? '', s.freq_hz) || '';
queries.push({ call: s.dx_call, band: s.band ?? '', mode, contest: e.isContest });
keys.push(`${s.dx_call}|${s.band ?? ''}|${mode}|${e.isContest ? 1 : 0}`);
}
}
if (queries.length === 0) { setWorked({}); return; }
try {
const res: boolean[] = (await WatchlistWorkedSlots(queries as any)) ?? [];
// MERGED, not replaced: replacing made every already-answered key
// momentarily unknown on each refresh, which re-hid settled lines.
setWorked((prev) => {
const next = { ...prev };
keys.forEach((k, i) => { next[k] = !!res[i]; });
return next;
});
} catch { /* the badges just stay conservative */ }
}, 150) as unknown as number;
return () => { if (queryTimer.current) window.clearTimeout(queryTimer.current); };
}, [spotsFor, entries]);
const wkey = (e: WLEntry, s: ClusterSpot) =>
`${s.dx_call}|${s.band ?? ''}|${inferSpotMode(s.comment ?? '', s.freq_hz) || ''}|${e.isContest ? 1 : 0}`;
const workedFor = (e: WLEntry, s: ClusterSpot): boolean => worked[wkey(e, s)] ?? false;
// A spot whose verdict has not come back yet is NOT drawn. Showing it as
// Needed and withdrawing it half a second later made the list twitch on
// every burst — and nobody needs a spot 400 ms early, they need it settled.
const settled = (e: WLEntry, s: ClusterSpot): boolean => wkey(e, s) in worked;
// Which entries are on the air, and which of their slots are still needed.
// One definition, shared with the docked watch-list widget — the answer
// involves a debounced query per visible slot, and two copies of it would be
// two bursts of the same question and two ideas of what "needed" means.
const { spotsFor, workedFor, settled, onAir, worked } = useWatchlistSpots(entries, spots);
const add = async () => {
const c = addCall.trim().toUpperCase();
@@ -195,11 +120,7 @@ export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: P
catch (e: any) { flash(String(e?.message ?? e), true); }
};
const isOnAir = (e: WLEntry): boolean =>
(spotsFor.get(e.callsign) ?? []).some((s) => {
const ts = Date.parse(String((s as any).received_at ?? ''));
return ts > 0 && Date.now() - ts < ON_AIR_MS;
});
const isOnAir = onAir;
const shown = entries.filter((e) => {
if (family === 'normal' && e.isContest) return false;
@@ -225,14 +146,8 @@ export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: P
// The cluster's own badge for a spot, read from the shared status index.
const dxccBadge = (s: ClusterSpot): { label: string; color: string } | null => {
const st = spotStatus[spotStatusKey(s.dx_call, s.band ?? '', s.comment ?? '', s.freq_hz)];
switch (st?.status) {
case 'new': return { label: t('wl.newDxcc'), color: 'var(--danger)' };
case 'new-band-mode': return { label: t('clg2.newBandMode'), color: 'var(--danger)' };
case 'new-band': return { label: t('clg2.newBand'), color: 'var(--warning)' };
case 'new-mode': return { label: t('clg2.newMode'), color: 'var(--caution)' };
case 'new-slot': return { label: t('clg2.newSlot'), color: '#5AC8FA' };
default: return null;
}
const b = newBadge(st?.status);
return b ? { label: t(b.key), color: b.colour } : null;
};
// Three decimals, and no trailing zeros beyond them: 7.056 rather than
+147
View File
@@ -0,0 +1,147 @@
// WatchlistWidget — the watch list reduced to what is worth acting on RIGHT
// NOW: entries that are on the air and still needed.
//
// The Watchlist tab is a tab, and an operator working FT8 lives on the decodes
// one. A station they asked to be told about would appear on a screen they are
// not looking at — so the same answer is docked in the widget strip, which sits
// above the tabs and is therefore always in view. Only active AND needed: a
// list of everything watched is the tab's job, and it would not fit here.
import { useEffect, useMemo, useState } from 'react';
import { Bell, X } from 'lucide-react';
import { useI18n } from '@/lib/i18n';
import { cn } from '@/lib/utils';
import { inferSpotMode, spotStatusKey } from '@/lib/spot';
import { useWatchlistSpots, newBadge, type WLEntry } from '@/lib/watchlistSpots';
import type { ClusterSpot, SpotStatusEntry } from '@/components/ClusterGrid';
import { WatchlistEntries } from '../../wailsjs/go/main/App';
import { EventsOn } from '../../wailsjs/runtime/runtime';
interface Props {
spots: ClusterSpot[];
// The cluster's own verdicts. WHAT a station is worth is the reason to leave
// what you are doing for it — "on the air and not worked" says nothing about
// whether it is a new entity or a fifth band on one worked in 1998.
spotStatus: Record<string, SpotStatusEntry>;
// A row is a spot: clicking it does what clicking one in the cluster does.
onPick?: (s: ClusterSpot) => void;
onClose?: () => void;
}
function age(s: ClusterSpot): string {
const ts = Date.parse(String((s as any).received_at ?? ''));
if (!(ts > 0)) return '';
const m = Math.floor((Date.now() - ts) / 60000);
if (m < 1) return 'now';
return `${m}m`;
}
export function WatchlistWidget({ spots, spotStatus, onPick, onClose }: Props) {
const { t } = useI18n();
const [entries, setEntries] = useState<WLEntry[]>([]);
const load = () => { WatchlistEntries().then((e: any) => setEntries((e ?? []) as WLEntry[])).catch(() => {}); };
useEffect(() => {
load();
// The list changes from four places (the tab, the cluster's star, the
// contest auto-add, an import), and a widget that only reads it at mount
// would quietly watch the wrong set for the rest of the session.
const off = EventsOn('watchlist:changed', load);
return () => { off?.(); };
}, []);
const { spotsFor, workedFor, settled } = useWatchlistSpots(entries, spots);
// Ticking, because every row carries an age and the freshest thing here is
// the reason to look at it at all.
const [, tick] = useState(0);
useEffect(() => {
const id = window.setInterval(() => tick((n) => n + 1), 30000);
return () => window.clearInterval(id);
}, []);
// One row per (entry, needed slot): the same station on two bands is two
// chances to work it, and collapsing them would hide the one that is open.
const rows = useMemo(() => {
const out: { e: WLEntry; s: ClusterSpot }[] = [];
for (const e of entries) {
for (const s of spotsFor.get(e.callsign) ?? []) {
if (!settled(e, s) || workedFor(e, s)) continue;
out.push({ e, s });
}
}
// Freshest first: a spot from twenty minutes ago is history, and this
// panel is short.
return out.sort((a, b) =>
Date.parse(String((b.s as any).received_at ?? '')) - Date.parse(String((a.s as any).received_at ?? '')));
}, [entries, spotsFor, workedFor, settled]);
return (
<section className="flex flex-col h-full min-h-0 rounded-lg border border-border bg-card overflow-hidden">
<div className="flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border shrink-0">
<Bell className="size-4 text-primary shrink-0" />
<span className="text-xs font-semibold uppercase tracking-wider text-muted-foreground">
{t('wlw.title')}
</span>
<span className={cn('rounded px-1.5 py-px text-[10px] font-bold',
rows.length > 0 ? 'bg-warning text-warning-foreground' : 'bg-muted text-muted-foreground')}>
{rows.length}
</span>
<div className="flex-1" />
{onClose && (
<button type="button" onClick={onClose} title={t('wlw.hide')}
className="text-muted-foreground hover:text-foreground transition-colors">
<X className="size-3.5" />
</button>
)}
</div>
<div className="flex-1 min-h-0 overflow-y-auto">
{rows.length === 0 ? (
// Empty is the normal state, and it means something precise — say it,
// rather than leaving a blank box that reads as broken.
<div className="px-3 py-3 text-xs text-muted-foreground">
{entries.length === 0 ? t('wlw.emptyList') : t('wlw.emptyNone')}
</div>
) : rows.map(({ e, s }, i) => {
const mode = inferSpotMode(s.comment ?? '', s.freq_hz) || '';
const badge = newBadge(spotStatus[spotStatusKey(s.dx_call, s.band ?? '', s.comment ?? '', s.freq_hz)]?.status);
return (
<button
key={`${e.callsign}-${s.dx_call}-${s.band}-${mode}-${i}`}
type="button"
onClick={() => onPick?.(s)}
title={e.callsign === s.dx_call
? t('wlw.pick', { call: s.dx_call })
: `${t('wlw.pick', { call: s.dx_call })} — ${e.callsign}`}
className="w-full text-left px-2 py-1 border-b border-border/20 hover:bg-muted/50 transition-colors flex items-center gap-1.5"
>
{/* One line, in reading order: who, where, what it is worth, how
long ago. The callsign is the only part allowed to give way —
everything else is short and fixed, and a row that wraps is a
row an operator has to parse instead of scan. */}
<span className="font-mono text-[13px] font-bold text-warning truncate">{s.dx_call}</span>
{s.band && (
<span className="rounded px-1 py-px text-[10px] font-bold uppercase bg-info-muted text-info-muted-foreground shrink-0">
{s.band}
</span>
)}
{mode && <span className="font-mono text-[10px] text-muted-foreground shrink-0">{mode}</span>}
<div className="flex-1" />
{/* Why it is worth interrupting a QSO for — or not. */}
{badge && (
<span className="rounded px-1 py-px text-[10px] font-bold uppercase tracking-wide border shrink-0"
style={{ color: badge.colour, borderColor: `color-mix(in srgb, ${badge.colour} 45%, transparent)`,
background: `color-mix(in srgb, ${badge.colour} 12%, transparent)` }}>
{t(badge.key)}
</span>
)}
<span className="font-mono text-[10px] text-muted-foreground/70 tabular-nums shrink-0 w-7 text-right">
{age(s)}
</span>
</button>
);
})}
</div>
</section>
);
}
+20 -1
View File
@@ -9,7 +9,7 @@ import { cn } from '@/lib/utils';
// can't hold a typo'd value that isn't in the list.
export function Combobox({
value, onChange, options, placeholder, className, allowFreeText = false, commitOnType = false,
showToggle = false,
showToggle = false, onWheelStep,
}: {
value: string;
onChange: (v: string) => void;
@@ -21,6 +21,10 @@ export function Combobox({
// fields read live by other actions — e.g. RST, so a CW macro sent without
// leaving the field uses the value just typed.
commitOnType?: boolean;
// Wheel over the field steps the value. The control cannot know what a step
// means — a decibel here, an S-unit there — so it reports the direction and
// the owner decides.
onWheelStep?: (dir: 1 | -1) => void;
// Draw a chevron that opens the full list on click.
//
// Without it this control is indistinguishable from a plain text box: it opens
@@ -42,6 +46,21 @@ export function Combobox({
// leave the list floating over the wrong row.
const [menuPos, setMenuPos] = useState({ top: 0, left: 0, width: 0 });
// A NATIVE, non-passive listener: React attaches onWheel passively, where
// preventDefault does nothing at all and the panel scrolls away under the
// field being adjusted.
useEffect(() => {
const el = ref.current;
if (!el || !onWheelStep) return;
const onWheel = (e: WheelEvent) => {
if (e.deltaY === 0) return;
e.preventDefault();
onWheelStep(e.deltaY < 0 ? 1 : -1); // up is a better report
};
el.addEventListener('wheel', onWheel, { passive: false });
return () => el.removeEventListener('wheel', onWheel);
}, [onWheelStep]);
useEffect(() => {
function onDoc(e: MouseEvent) {
if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);
File diff suppressed because one or more lines are too long
+31
View File
@@ -0,0 +1,31 @@
// Remembered map views — where each map was left, per map.
//
// Panning and zooming a map is an operator saying "this is the part of the world
// I work". Throwing that away on every tab switch made the maps something to
// set up again each time rather than something to glance at, and the world map
// was the only one that remembered anything.
//
// One key per map, and portable (see lib/uiPref) like the world map's own: a
// copied data folder brings the views with it.
import { writeUiPref } from '@/lib/uiPref';
export type MapView = { lat: number; lon: number; zoom: number };
// The keys in use. Named here rather than typed at each call site so a rename
// cannot silently orphan somebody's saved view.
export const MAP_VIEW_WORLD = 'opslog.mapView';
export const MAP_VIEW_FT = 'opslog.ftMapView';
export const MAP_VIEW_GRIDS = 'opslog.gridMapView';
export function loadMapView(key: string): MapView | null {
try {
const v = JSON.parse(localStorage.getItem(key) || 'null');
return v && typeof v.zoom === 'number' && typeof v.lat === 'number' && typeof v.lon === 'number' ? v : null;
} catch {
return null; // corrupt or unreadable → open where the map would by default
}
}
export function saveMapView(key: string, lat: number, lon: number, zoom: number): void {
writeUiPref(key, JSON.stringify({ lat, lon, zoom }));
}
+39
View File
@@ -0,0 +1,39 @@
// Which rotor dial to draw.
//
// Two compasses ship: the current one (night map, square scale, mouse pointer,
// target marker) and the original small light-map dial. Neither is more correct
// than the other — one operator reads the big map at a glance, another wants the
// compact dial that was there before — so it is a preference, not a migration.
//
// A UI preference rather than a settings-database key: it decides what a widget
// looks like, nothing is transmitted from it, and it belongs to the screen it is
// read on. It is portable all the same (see lib/uiPref), so a copied folder
// keeps the dial its owner chose.
import { writeUiPref } from '@/lib/uiPref';
export const KEY_ROTOR_STYLE = 'opslog.rotorStyle';
export type RotorStyle = 'modern' | 'classic';
export function rotorStyle(): RotorStyle {
try {
return localStorage.getItem(KEY_ROTOR_STYLE) === 'classic' ? 'classic' : 'modern';
} catch {
return 'modern';
}
}
// Same shape as the distance unit: the compasses are rendered from two call
// sites, and a preference changed in Settings has to reach both without either
// of them polling for it.
const listeners = new Set<() => void>();
export function setRotorStyle(style: RotorStyle): void {
writeUiPref(KEY_ROTOR_STYLE, style);
listeners.forEach((l) => l());
}
export function subscribeRotorStyle(fn: () => void): () => void {
listeners.add(fn);
return () => { listeners.delete(fn); };
}
+82
View File
@@ -36,3 +36,85 @@ export function rstOptions(mode: string, lists: RSTLists): string[] {
if (l && l.length) return l;
return cat === 'phone' ? ['59', '58', '57'] : cat === 'cw' ? ['599', '589', '579'] : ['+00', '-10', '-20'];
}
// stepRST moves a report one step up or down, the way an operator would say it.
//
// The dropdown beside these fields is a list of the values worth having to hand,
// not of every legal report: nobody keeps 41 dB figures in it. So the wheel
// works on the VALUE, not on the list — a digital report moves by a decibel and
// an RST by one S-unit, which is what the hand on the wheel is asking for.
//
// dir is +1 for wheel up (a better report) and -1 for down.
export function stepRST(value: string, dir: number, mode: string): string {
const v = (value || '').trim();
if (v === '') return v;
if (rstCategory(mode) === 'digital') {
// A dB report: "-12", "+05", "0". Kept in its own shape — signed and two
// digits — because that is how every decoder writes it and how the operator
// reads it back off the screen.
const n = parseInt(v, 10);
if (!Number.isFinite(n)) return v;
// The range WSJT-X itself reports in, with room either side. Beyond it the
// number stops meaning anything.
const next = Math.max(-30, Math.min(35, n + dir));
return (next < 0 ? '-' : '+') + String(Math.abs(next)).padStart(2, '0');
}
// RST/RS, and the S9+ ladder above it. What an operator counts through is
//
// … 57 58 59 59+5 59+10 59+15 59+20 …
//
// — one S-unit up to nine, then five decibels at a time, because that is how
// a strong signal is reported and how the S-meter is read (see sMeterRST).
// Stepping the S digit and leaving the "+20" where it was would have gone
// from 59+20 to 58+20, which nobody has ever said on the air.
//
// R and T do not move: they are judgements about readability and tone, and a
// wheel has no business changing them.
const m = /^(\d)(\d)(\d?)(?:\+(\d+))?$/.exec(v);
if (!m) return v;
const head = m[1];
const tone = m[3];
let sUnit = parseInt(m[2], 10);
let over = m[4] === undefined ? 0 : parseInt(m[4], 10);
if (over > 0) {
// Above S9: five at a time, and back down through +5 to a plain 59.
over = Math.max(0, Math.min(60, over + dir * 5));
} else if (sUnit >= 9 && dir > 0) {
over = 5; // 59 → 59+5
} else {
sUnit = Math.max(1, Math.min(9, sUnit + dir));
}
return head + String(sUnit) + tone + (over > 0 ? '+' + over : '');
}
// rstFitsMode says whether a report belongs to the family a mode reports in.
//
// The three families are written differently and are not interchangeable: a
// signed decibel figure ("+00"), a three-figure RST ("599"), a two-figure RS
// ("59", with an optional "+20" above S9). "+00" on SSB is not a weak report,
// it is not a report at all.
export function rstFitsMode(value: string, mode: string): boolean {
const v = (value || '').trim();
if (v === '') return false;
switch (rstCategory(mode)) {
case 'digital': return /^[+-]\d{1,2}$/.test(v);
case 'cw': return /^\d{3}(\+\d+)?$/.test(v);
default: return /^\d{2}(\+\d+)?$/.test(v);
}
}
// convertRST carries a report across the CW/phone divide, keeping the operator's
// own judgement of the signal: 57 becomes 579, 599 becomes 59.
//
// Only between those two — a decibel figure says nothing about readability and
// an RST says nothing in decibels, so there the preset is the honest answer.
// Returns '' when it cannot be done.
export function convertRST(value: string, toMode: string): string {
const v = (value || '').trim();
const to = rstCategory(toMode);
if (to === 'digital') return '';
const m = /^(\d)(\d)(\d?)((?:\+\d+)?)$/.exec(v);
if (!m) return '';
if (to === 'cw') return m[1] + m[2] + '9' + m[4]; // RS → RST, tone 9
return m[1] + m[2] + m[4]; // RST → RS, tone dropped
}
+9
View File
@@ -15,6 +15,15 @@ export function cleanSpotter(s: string): string {
// alone instead of guessing wrong.
export function inferSpotMode(comment: string, freqHz: number): string {
const c = (comment || '').toUpperCase();
// SuperFox and Fox/Hound are FT8 — they are WSJT-X's DXpedition transmit modes,
// not modes of their own, and they turn up in a comment written every way an
// operator can shorten them: "super fox", SFOX, S/F, F/H.
//
// A spot commented "super fox" fell through to the band plan and came out
// DATA, and that verdict is not cosmetic: the
// band+mode status is computed from this answer, so a ZD8 on 21.071 read as a
// new DATA slot rather than the new FT8 one it is.
if (/\bSUPER\s*FOX\b|\bSFOX\b|\bS\/F\b|\bFOX\s*\/?\s*HOUND\b|\bF\/H\b/.test(c)) return 'FT8';
if (/\bFT8\b/.test(c)) return 'FT8';
if (/\bFT4\b/.test(c)) return 'FT4';
if (/\bJS8\b/.test(c)) return 'JS8';
+7
View File
@@ -29,6 +29,9 @@ const PORTABLE_KEYS = [
'opslog.bandMapBands', // bands shown side-by-side in the Band Map tab
'opslog.mapAutoZoomDX', // Main map: auto-zoom to the DX (vs free pan/zoom)
'opslog.mapView', // Main map: remembered free-pan view (lat/lon/zoom)
// The same, for the FT decodes map and the grid-square map: a view an
// operator set up is theirs, and it should follow the folder like the rest.
'opslog.ftMapView', 'opslog.gridMapView',
'opslog.lookupOnBlur', // run the callsign lookup on blur instead of while typing
'opslog.groupDigitalSlots', // matrix + cluster: all digital modes count as ONE (DXCC-style) instead of per-mode slots
'opslog.clusterShowFilters', // cluster filter sidebar shown (tab + Main pane)
@@ -44,6 +47,10 @@ const PORTABLE_KEYS = [
'opslog.iaruRegion', // IARU region (1/2/3) — band edges and segments on the band maps
'opslog.chasePota', // show POTA references and the NEW POTA marker on spots
'opslog.chaseSota', // show SOTA references on spots
// The other chase switches. In the DB as well as locally because AUTO-CALL
// reads them: what the operator does not hunt is not something to transmit
// for, and the backend cannot see localStorage.
'opslog.chasePfx', 'opslog.chaseCounty', 'opslog.chaseState', 'opslog.chaseGrids',
'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:[..]}
+133
View File
@@ -0,0 +1,133 @@
// What the watch list is HEARING, and what of it is still needed.
//
// Two places ask the same question — the Watchlist tab and the docked widget —
// and the answer involves a debounced round trip to the logbook per visible
// slot. Written twice it would be two definitions of "needed" drifting apart,
// and two bursts of the same query on every spot; written here it is one.
import { useEffect, useMemo, useRef, useState } from 'react';
import type { ClusterSpot } from '@/components/ClusterGrid';
import { inferSpotMode } from '@/lib/spot';
import { WatchlistWorkedSlots } from '../../wailsjs/go/main/App';
export interface WLEntry {
callsign: string; lastSeenStr: string; addedAt: string; spotCount: number;
isContest: boolean; notify: boolean;
isExpedition: boolean; clubLogQSOs24h: number; clubLogTotalQSOs: number;
clubLogHasOQRS: boolean; clubLogLiveStream: boolean;
}
// A spot is ON AIR while its last sighting is this fresh.
export const ON_AIR_MS = 10 * 60 * 1000;
// Exact unless the entry carries a trailing * — the same rule the backend's
// Match applies to the live stream, mirrored so the list and the alerts can
// never disagree about what an entry covers.
export function matchesEntry(call: string, pattern: string): boolean {
const c = call.toUpperCase();
if (pattern.endsWith('*')) {
const p = pattern.slice(0, -1);
return p !== '' && c.startsWith(p);
}
return c === pattern;
}
// What the cluster's verdict is worth saying, and in what colour.
//
// The order of severity is the one the band map and Chase new use: a new entity
// first, then the band and mode inside it. Shared because the tab and the docked
// widget must not label the same spot differently — an operator reads one of
// them to decide whether to leave what they are doing.
export const NEW_BADGES: Record<string, { key: string; colour: string }> = {
'new': { key: 'wl.newDxcc', colour: 'var(--danger)' },
'new-band-mode': { key: 'clg2.newBandMode', colour: 'var(--danger)' },
'new-band': { key: 'clg2.newBand', colour: 'var(--warning)' },
'new-mode': { key: 'clg2.newMode', colour: 'var(--caution)' },
'new-slot': { key: 'clg2.newSlot', colour: '#5AC8FA' },
};
export function newBadge(status?: string): { key: string; colour: string } | null {
return (status && NEW_BADGES[status]) || null;
}
export interface WatchlistSpots {
// The raw verdicts, exposed for dependency arrays: it changes only when an
// answer arrives, where the closures below are new on every render.
worked: Record<string, boolean>;
// The spots each entry covers, deduplicated by band+mode.
spotsFor: Map<string, ClusterSpot[]>;
// Worked on this exact slot (and, for a contest entry, today).
workedFor: (e: WLEntry, s: ClusterSpot) => boolean;
// Whether the logbook has actually answered for this pair yet. A spot whose
// verdict has not come back is NOT drawn: showing it as needed and
// withdrawing it half a second later made the list twitch on every burst,
// and nobody needs a spot 400 ms early — they need it settled.
settled: (e: WLEntry, s: ClusterSpot) => boolean;
onAir: (e: WLEntry) => boolean;
}
export function useWatchlistSpots(entries: WLEntry[], spots: ClusterSpot[]): WatchlistSpots {
const [worked, setWorked] = useState<Record<string, boolean>>({});
const spotsFor = useMemo(() => {
const map = new Map<string, ClusterSpot[]>();
for (const e of entries) map.set(e.callsign, []);
for (const s of spots) {
for (const e of entries) {
if (matchesEntry(s.dx_call ?? '', e.callsign)) { map.get(e.callsign)!.push(s); break; }
}
}
for (const [k, list] of map) {
const seen = new Set<string>();
map.set(k, list.filter((s) => {
const key = `${(s.band ?? '')}|${inferSpotMode(s.comment ?? '', s.freq_hz)}|${s.dx_call}`;
if (seen.has(key)) return false;
seen.add(key);
return true;
}));
}
return map;
}, [spots, entries]);
// Debounced: a spot burst must cost one round trip, not one per spot.
const queryTimer = useRef<number | undefined>(undefined);
useEffect(() => {
if (queryTimer.current) window.clearTimeout(queryTimer.current);
queryTimer.current = window.setTimeout(async () => {
const queries: { call: string; band: string; mode: string; contest: boolean }[] = [];
const keys: string[] = [];
for (const e of entries) {
for (const s of spotsFor.get(e.callsign) ?? []) {
const mode = inferSpotMode(s.comment ?? '', s.freq_hz) || '';
queries.push({ call: s.dx_call, band: s.band ?? '', mode, contest: e.isContest });
keys.push(`${s.dx_call}|${s.band ?? ''}|${mode}|${e.isContest ? 1 : 0}`);
}
}
if (queries.length === 0) { setWorked({}); return; }
try {
const res: boolean[] = (await WatchlistWorkedSlots(queries as any)) ?? [];
// MERGED, not replaced: replacing made every already-answered key
// momentarily unknown on each refresh, which re-hid settled lines.
setWorked((prev) => {
const next = { ...prev };
keys.forEach((k, i) => { next[k] = !!res[i]; });
return next;
});
} catch { /* the badges just stay conservative */ }
}, 150) as unknown as number;
return () => { if (queryTimer.current) window.clearTimeout(queryTimer.current); };
}, [spotsFor, entries]);
const wkey = (e: WLEntry, s: ClusterSpot) =>
`${s.dx_call}|${s.band ?? ''}|${inferSpotMode(s.comment ?? '', s.freq_hz) || ''}|${e.isContest ? 1 : 0}`;
return {
worked,
spotsFor,
workedFor: (e, s) => worked[wkey(e, s)] ?? false,
settled: (e, s) => wkey(e, s) in worked,
onAir: (e) => (spotsFor.get(e.callsign) ?? []).some((s) => {
const ts = Date.parse(String((s as any).received_at ?? ''));
return ts > 0 && Date.now() - ts < ON_AIR_MS;
}),
};
}
+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.27.12';
export const APP_VERSION = '0.27.15';
// Author / credits, shown in Help -> About.
export const APP_AUTHOR = 'F4BPO';
+12
View File
@@ -454,6 +454,8 @@ export function GetChangelog():Promise<Array<main.ChangelogEntry>>;
export function GetChaseNew():Promise<boolean>;
export function GetChaseNewBands():Promise<Array<string>>;
export function GetChaseNewGrids():Promise<boolean>;
export function GetChaseNewSpots():Promise<Array<main.ChaseNewSpot>>;
@@ -646,6 +648,8 @@ export function GetWsjtFollowMode():Promise<boolean>;
export function GetWsjtHighlight():Promise<boolean>;
export function GetWsjtHighlightColours():Promise<main.WsjtHighlightColours>;
export function GetWsjtHighlightWorked():Promise<boolean>;
export function GetYaesuBandAntennas():Promise<Record<string, number>>;
@@ -654,6 +658,8 @@ export function GetYaesuState():Promise<cat.YaesuTXState>;
export function GridSquares(arg1:string):Promise<Array<qso.GridSquare>>;
export function HaltAutoCall():Promise<void>;
export function HaltDecodeTx(arg1:string,arg2:boolean):Promise<void>;
export function HasBuiltinReferences(arg1:string):Promise<boolean>;
@@ -1158,6 +1164,8 @@ export function SetAutoCall(arg1:boolean):Promise<void>;
export function SetAutoCallOnly(arg1:string):Promise<void>;
export function SetAutoCallVisible(arg1:Array<string>,arg2:boolean):Promise<void>;
export function SetCATFrequency(arg1:number):Promise<void>;
export function SetCATMode(arg1:string):Promise<void>;
@@ -1168,6 +1176,8 @@ export function SetCWDecoderPitch(arg1:number):Promise<void>;
export function SetChaseNew(arg1:boolean):Promise<void>;
export function SetChaseNewBands(arg1:Array<string>):Promise<void>;
export function SetChaseNewGrids(arg1:boolean):Promise<void>;
export function SetClublogCtyEnabled(arg1:boolean):Promise<void>;
@@ -1300,6 +1310,8 @@ export function SetWsjtFollowMode(arg1:boolean):Promise<void>;
export function SetWsjtHighlight(arg1:boolean):Promise<void>;
export function SetWsjtHighlightColours(arg1:main.WsjtHighlightColours):Promise<void>;
export function SetWsjtHighlightWorked(arg1:boolean):Promise<void>;
export function SetYaesuAFGain(arg1:number):Promise<void>;
+24
View File
@@ -842,6 +842,10 @@ export function GetChaseNew() {
return window['go']['main']['App']['GetChaseNew']();
}
export function GetChaseNewBands() {
return window['go']['main']['App']['GetChaseNewBands']();
}
export function GetChaseNewGrids() {
return window['go']['main']['App']['GetChaseNewGrids']();
}
@@ -1226,6 +1230,10 @@ export function GetWsjtHighlight() {
return window['go']['main']['App']['GetWsjtHighlight']();
}
export function GetWsjtHighlightColours() {
return window['go']['main']['App']['GetWsjtHighlightColours']();
}
export function GetWsjtHighlightWorked() {
return window['go']['main']['App']['GetWsjtHighlightWorked']();
}
@@ -1242,6 +1250,10 @@ export function GridSquares(arg1) {
return window['go']['main']['App']['GridSquares'](arg1);
}
export function HaltAutoCall() {
return window['go']['main']['App']['HaltAutoCall']();
}
export function HaltDecodeTx(arg1, arg2) {
return window['go']['main']['App']['HaltDecodeTx'](arg1, arg2);
}
@@ -2250,6 +2262,10 @@ export function SetAutoCallOnly(arg1) {
return window['go']['main']['App']['SetAutoCallOnly'](arg1);
}
export function SetAutoCallVisible(arg1, arg2) {
return window['go']['main']['App']['SetAutoCallVisible'](arg1, arg2);
}
export function SetCATFrequency(arg1) {
return window['go']['main']['App']['SetCATFrequency'](arg1);
}
@@ -2270,6 +2286,10 @@ export function SetChaseNew(arg1) {
return window['go']['main']['App']['SetChaseNew'](arg1);
}
export function SetChaseNewBands(arg1) {
return window['go']['main']['App']['SetChaseNewBands'](arg1);
}
export function SetChaseNewGrids(arg1) {
return window['go']['main']['App']['SetChaseNewGrids'](arg1);
}
@@ -2534,6 +2554,10 @@ export function SetWsjtHighlight(arg1) {
return window['go']['main']['App']['SetWsjtHighlight'](arg1);
}
export function SetWsjtHighlightColours(arg1) {
return window['go']['main']['App']['SetWsjtHighlightColours'](arg1);
}
export function SetWsjtHighlightWorked(arg1) {
return window['go']['main']['App']['SetWsjtHighlightWorked'](arg1);
}
+32 -2
View File
@@ -1961,7 +1961,9 @@ export namespace main {
watched_attempts: number;
misses: number;
max_rounds: number;
rest_min: number;
rest_periods: number;
on_screen_only: boolean;
trace: boolean;
static createFrom(source: any = {}) {
return new AutoCallSettings(source);
@@ -1975,18 +1977,22 @@ export namespace main {
this.watched_attempts = source["watched_attempts"];
this.misses = source["misses"];
this.max_rounds = source["max_rounds"];
this.rest_min = source["rest_min"];
this.rest_periods = source["rest_periods"];
this.on_screen_only = source["on_screen_only"];
this.trace = source["trace"];
}
}
export class AutoCallStatus {
enabled: boolean;
only: string;
target: string;
waiting: string;
calls: number;
max: number;
misses: number;
max_miss: number;
stopped: boolean;
greylisted: number;
reason: string;
static createFrom(source: any = {}) {
@@ -1998,11 +2004,13 @@ export namespace main {
this.enabled = source["enabled"];
this.only = source["only"];
this.target = source["target"];
this.waiting = source["waiting"];
this.calls = source["calls"];
this.max = source["max"];
this.misses = source["misses"];
this.max_miss = source["max_miss"];
this.stopped = source["stopped"];
this.greylisted = source["greylisted"];
this.reason = source["reason"];
}
}
@@ -4584,6 +4592,24 @@ export namespace main {
return a;
}
}
export class WsjtHighlightColours {
watchlist: string;
new_dxcc: string;
new_band: string;
worked: string;
static createFrom(source: any = {}) {
return new WsjtHighlightColours(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.watchlist = source["watchlist"];
this.new_dxcc = source["new_dxcc"];
this.new_band = source["new_band"];
this.worked = source["worked"];
}
}
}
@@ -4962,6 +4988,8 @@ export namespace pskr {
last_err?: string;
broker: string;
bands: string[];
near_km: number;
squares: number;
static createFrom(source: any = {}) {
return new Status(source);
@@ -4975,6 +5003,8 @@ export namespace pskr {
this.last_err = source["last_err"];
this.broker = source["broker"];
this.bands = source["bands"];
this.near_km = source["near_km"];
this.squares = source["squares"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
+69 -5
View File
@@ -120,12 +120,36 @@ func (e *Exporter) writeDoc(ctx context.Context, w io.Writer, iter iterator) (in
func SingleRecordADIF(q qso.QSO) string {
var b strings.Builder
bw := bufio.NewWriter(&b)
// Uploads target other services — keep it standard (no app-specific tags).
// Uploads target other services — keep it standard (no app-specific tags),
// and say nothing about the receive side when there is nothing to say: in
// ADIF an absent BAND_RX/FREQ_RX means "same as transmit", and a logger
// given both draws both. Wavelog reads a simplex FT8 contact uploaded with
// BAND_RX filled in as split and shows it as "17m/17m".
writeRecord(bw, q, false, nil)
bw.Flush()
return b.String()
}
// ForwardRecordADIF is the record sent to ANOTHER LOGGER on the UDP link.
//
// The receive side is written even when it repeats the transmit side, which is
// the opposite of the upload rule above and is deliberate: Log4OM reads BAND_RX
// and found nothing there for contacts logged by a path that left it blank. A
// logger on the same desk is being handed a copy of our record, not published
// to a service that will draw conclusions from every tag present.
func ForwardRecordADIF(q qso.QSO) string {
var b strings.Builder
bw := bufio.NewWriter(&b)
writeRecord(bw, q, false, nil, keepRX)
bw.Flush()
return b.String()
}
// keepRX marks a record whose receive side must be written out in full.
type rxMode int
const keepRX rxMode = 1
// FullRecordADIF serialises one QSO LOSSLESSLY — including the APP_* extras —
// so it can be written out and read back with nothing dropped. Used by the
// offline queue: a QSO parked in the safety file must come back identical
@@ -161,7 +185,18 @@ func BatchRecordsADIF(records []string) string {
// Empty fields are omitted. MODE/SUBMODE are massaged so a "promoted"
// mode (e.g. FT4 stored without a parent) is exported as the canonical
// pair MODE=MFSK SUBMODE=FT4 — round-trips cleanly with strict loggers.
func writeRecord(bw *bufio.Writer, q qso.QSO, includeApp bool, allow map[string]bool) {
func writeRecord(bw *bufio.Writer, q qso.QSO, includeApp bool, allow map[string]bool, rx ...rxMode) {
// The receive side, unless it merely repeats the transmit side. See
// SingleRecordADIF and ForwardRecordADIF.
bandRX, freqRX := q.BandRX, q.FreqRXHz
if len(rx) == 0 || rx[0] != keepRX {
if strings.EqualFold(strings.TrimSpace(bandRX), strings.TrimSpace(q.Band)) {
bandRX = ""
}
if freqRX != nil && q.FreqHz != nil && *freqRX == *q.FreqHz {
freqRX = nil
}
}
// allow == nil → write every promoted field (standard/full behaviour).
// Otherwise a promoted tag is written only when it's in the chosen set.
// w/wi/wf wrap the raw writers with that gate so the ~150 field lines below
@@ -194,7 +229,7 @@ func writeRecord(bw *bufio.Writer, q qso.QSO, includeApp bool, allow map[string]
w("TIME_OFF", q.QSODateOff.UTC().Format("150405"))
}
w("BAND", q.Band)
w("BAND_RX", q.BandRX)
w("BAND_RX", bandRX)
mode, submode := modeForExport(q.Mode, q.Submode)
w("MODE", mode)
@@ -203,8 +238,8 @@ func writeRecord(bw *bufio.Writer, q qso.QSO, includeApp bool, allow map[string]
if q.FreqHz != nil && *q.FreqHz > 0 {
w("FREQ", strconv.FormatFloat(float64(*q.FreqHz)/1_000_000, 'f', 6, 64))
}
if q.FreqRXHz != nil && *q.FreqRXHz > 0 {
w("FREQ_RX", strconv.FormatFloat(float64(*q.FreqRXHz)/1_000_000, 'f', 6, 64))
if freqRX != nil && *freqRX > 0 {
w("FREQ_RX", strconv.FormatFloat(float64(*freqRX)/1_000_000, 'f', 6, 64))
}
w("RST_SENT", q.RSTSent)
@@ -372,12 +407,41 @@ func writeRecord(bw *bufio.Writer, q qso.QSO, includeApp bool, allow map[string]
// length is the byte count (ADIF spec), which matches len(v) in Go since v is
// already a UTF-8 byte string.
func writeField(bw *bufio.Writer, tag, v string) {
v = oneLine(v)
if v == "" {
return
}
fmt.Fprintf(bw, "<%s:%d>%s ", tag, len(v), v)
}
// oneLine flattens a value onto a single line.
//
// ADIF counts bytes, so a value carrying line breaks is still read correctly —
// and it turns the file into something nobody can read. ADDRESS is a multi-line
// field by the standard, and callbooks and other loggers fill it that way: a
// value of "Kabul" followed by four blank lines and "Afghanistan" came out of
// OpsLog as one record spread down a dozen lines, with the next record
// apparently starting in the middle of the page.
//
// The breaks are dropped rather than escaped: the parts are trimmed and joined
// with a comma, which is how an address reads on one line anyway, and empty
// fragments go. The length prefix is computed after this, so the record stays
// exact.
func oneLine(v string) string {
if !strings.ContainsAny(v, "\r\n\t") {
return v
}
parts := strings.FieldsFunc(v, func(r rune) bool { return r == '\r' || r == '\n' })
out := make([]string, 0, len(parts))
for _, part := range parts {
part = strings.TrimSpace(strings.ReplaceAll(part, "\t", " "))
if part != "" {
out = append(out, part)
}
}
return strings.Join(out, ", ")
}
func writeIntPtr(bw *bufio.Writer, tag string, p *int) {
if p == nil {
return
+46
View File
@@ -0,0 +1,46 @@
package adif
import (
"bufio"
"strings"
"testing"
"hamlog/internal/qso"
)
// An exported record has to fit on its own line. ADDRESS is a multi-line field
// by the standard and callbooks fill it that way, so an OpsLog export was one
// record spread down a dozen lines with the next apparently starting in the
// middle of the page.
func TestAMultiLineValueIsWrittenOnOneLine(t *testing.T) {
var b strings.Builder
bw := bufio.NewWriter(&b)
writeField(bw, "ADDRESS", "Kabul\r\n\r\n\r\n\r\nAfghanistan\r\n")
bw.Flush()
got := b.String()
if strings.ContainsAny(got, "\r\n") {
t.Fatalf("the record still breaks across lines: %q", got)
}
if want := "<ADDRESS:18>Kabul, Afghanistan "; got != want {
t.Errorf("got %q, want %q", got, want)
}
}
// And the whole record, the way an operator reads the file.
func TestARecordIsOneLine(t *testing.T) {
hz := int64(28555000)
rec := SingleRecordADIF(qso.QSO{
Callsign: "T6T", Band: "10m", Mode: "SSB", FreqHz: &hz,
Address: "Kabul\n\n\nAfghanistan", Name: "Shuravi\t(Vyacheslav)",
})
if n := strings.Count(strings.TrimRight(rec, "\r\n"), "\n"); n != 0 {
t.Errorf("the record spans %d extra lines:\n%s", n, rec)
}
if !strings.Contains(rec, "Kabul, Afghanistan") {
t.Errorf("the address lost its parts:\n%s", rec)
}
if !strings.Contains(rec, "Shuravi (Vyacheslav)") {
t.Errorf("a tab was left in the value:\n%s", rec)
}
}
+32 -3
View File
@@ -15,6 +15,12 @@ type Manager struct {
mu sync.Mutex
recStop chan struct{}
recDone chan recResult
// Said once each: "the audio is reaching the speakers" and "it is arriving
// with nobody listening". Both are answers to the same evening — sound
// switched on, nothing out of the speakers — and neither is worth a line per
// packet at fifty packets a second.
gotAudioOnce sync.Once
noSinkOnce sync.Once
// monGainPct scales what the RX monitor plays, 100 = as captured.
//
// The "From radio" slider used to reach only the QSO recorder, so an
@@ -224,6 +230,10 @@ func (m *Manager) StartMonitor(inputDev, outputDev string) error {
return m.startMonitor(inputDev, outputDev, true)
}
// Logf receives this package's diagnostic lines. Set to applog.Printf by the
// app; a no-op in tests and for anything that vendors the package alone.
var Logf = func(string, ...any) {}
// StartMonitorSink starts ONLY the render side (no USB capture) so an external
// producer — the network 50003 stream — can feed decoded RX PCM via
// PushMonitorAudio. Same output path as StartMonitor, minus the capture goroutine.
@@ -255,8 +265,17 @@ func (m *Manager) startMonitor(inputDev, outputDev string, capture bool) error {
}()
}
// Consumer: render the ring to the output device at the internal 16 kHz mono.
//
// The error was thrown away, and that is the whole of "I turned the sound on
// and nothing comes out": a Listening device that has been unplugged, renamed
// by Windows or cannot open at 16 kHz fails here, silently, while everything
// upstream reports success — the stream is up, the packets arrive, the
// monitor says it started. Said out loud, the operator knows to look at the
// device rather than at the radio.
go func() {
_ = renderStream(outputDev, sampleRate, channels, bitsPerSample, stop, ring)
if err := renderStream(outputDev, sampleRate, channels, bitsPerSample, stop, ring); err != nil {
Logf("audio: the Listening device could not be opened (%q): %v", outputDev, err)
}
}()
m.notify()
return nil
@@ -321,9 +340,19 @@ func (m *Manager) PushMonitorAudio(pcm []byte) {
m.mu.Lock()
ring := m.monRing
m.mu.Unlock()
if ring != nil {
ring.Push(pcm)
if ring == nil {
// Nothing is listening: the stream is feeding the recorder and the voice
// keyer only. Said ONCE, because the alternative — silence in the log for
// silence in the speakers — is what makes this take an evening to find.
m.noSinkOnce.Do(func() {
Logf("audio: network RX audio is arriving but no monitor is running — the speakers are off (Listening)")
})
return
}
m.gotAudioOnce.Do(func() {
Logf("audio: network RX audio reaching the Listening device (%d-byte chunks)", len(pcm))
})
ring.Push(pcm)
}
// ---- TX audio passthrough (Phase 3: live mic → rig over USB) --------------
+618 -95
View File
@@ -47,6 +47,7 @@ package autocall
import (
"fmt"
"regexp"
"sort"
"strings"
"time"
"unicode"
@@ -57,10 +58,20 @@ type Need int
const (
NeedNone Need = iota
NeedSlot // entity worked on this band and in this mode, never together
NeedMode // entity never worked in this mode
NeedBand // entity never worked on this band
NeedDXCC // entity never worked at all
// NeedExtra: the ENTITY has nothing left to give on this band and mode, but
// the station carries something else that has never been worked — a WPX
// prefix, a square, a US county or state, a park. Those are what the cluster
// calls the orthogonal markers, and an operator who ticked them in the chase
// settings is hunting them: leaving them at nothing-needed meant auto-call
// watched a never-worked prefix call CQ and did nothing.
//
// The lowest rung, deliberately. It is worth calling when nothing better is
// on the air, and never worth leaving a new band for.
NeedExtra
NeedSlot // entity worked on this band and in this mode, never together
NeedMode // entity never worked in this mode
NeedBand // entity never worked on this band
NeedDXCC // entity never worked at all
)
func (n Need) String() string {
@@ -73,6 +84,8 @@ func (n Need) String() string {
return "mode"
case NeedSlot:
return "slot"
case NeedExtra:
return "extra"
}
return "-"
}
@@ -109,6 +122,17 @@ type Candidate struct {
Decode
Need Need
Watched bool
// Extra names what NeedExtra is about — "prefix", "county", "square" — so the
// decision line says why the station was worth a call. Empty otherwise.
Extra string
// Unconfirmed says the need above exists ONLY because a contact was never
// confirmed — the operator hunts "new + unconfirmed", the band is in the log
// and the QSL is not. A real need outranks it; see rank.
Unconfirmed bool
// Hidden is true when the decodes panel's own filters are keeping this
// station off the screen. The operator's filters are the control: what is
// not shown is not called — see Settings.OnScreenOnly.
Hidden bool
// Worked is "already in the log on this band AND mode". Nothing is gained
// by calling it again — and while chasing confirmations it is the trap that
// makes the same station be called all evening, because an unconfirmed QSO
@@ -145,20 +169,39 @@ type Settings struct {
// Misses is how many of the station's OWN transmit periods may pass with no
// decode of it before it is given up on.
Misses int
// Rest is how long a released callsign waits before it can be picked again,
// and MaxRounds how many such series it gets before being parked for the
// session.
Rest time.Duration
MaxRounds int
// RestPeriods is how many of the station's OWN OVERS a released callsign sits
// out before it can be picked again, and MaxRounds how many such series it
// gets before being parked for the session.
//
// Counted in overs, not in minutes, because that is the unit the thing is
// happening in: an operator who has called a DX seven times without an answer
// listens through one of its transmissions and calls again if it is still
// there. Two minutes is four overs on FT8 — the DX has worked four other
// callers by then, and half the time it has gone.
RestPeriods int
MaxRounds int
// MaxHold is the wall-clock backstop on one target.
MaxHold time.Duration
// OnScreenOnly restricts the calling to what the decodes panel is actually
// showing.
//
// The filters an operator sets while reading the band — CQ only, LoTW only,
// the new-category chips, continents, a minimum report, the search box — now
// bind the transmitter too: a station filtered off the screen is not called.
// It replaces a separate "LoTW users only" setting, which said one thing
// while the chip above the list said another.
//
// The panel publishes what it is showing; when it is publishing nothing —
// the tab was never opened this session — there is nothing to restrict and
// the ladder decides alone.
OnScreenOnly bool
}
// Defaults are what the operator gets before touching anything.
func Defaults() Settings {
return Settings{
Attempts: 7, WatchedAttempts: 15, Misses: 3,
Rest: 2 * time.Minute, MaxRounds: 3, MaxHold: 4 * time.Minute,
RestPeriods: 1, MaxRounds: 3, MaxHold: 4 * time.Minute,
}
}
@@ -173,8 +216,8 @@ func (s Settings) withDefaults() Settings {
if s.Misses <= 0 {
s.Misses = d.Misses
}
if s.Rest <= 0 {
s.Rest = d.Rest
if s.RestPeriods <= 0 {
s.RestPeriods = d.RestPeriods
}
if s.MaxRounds <= 0 {
s.MaxRounds = d.MaxRounds
@@ -201,6 +244,19 @@ type Action struct {
Kind ActionKind
Decode Decode
Reason string
// Soft asks the decoder to finish the over it is sending and only then stop
// transmitting, rather than cutting the carrier where it stands.
//
// It matters for exactly one brake. The attempts cap trips WHILE the seventh
// call is going out — that is what counts it — so a hard halt cuts that
// transmission a second in, which on the air is a half-sent call and on the
// screen is an auto-call that "starts and stops". Nothing is saved by
// stopping it: the frame is already half gone.
//
// Every other brake fires on a station that is not being transmitted to (it
// has vanished, or the clock ran out between overs), and there a hard halt
// is right: it is the one that also clears the decoder's own auto-sequence.
Soft bool
}
// Engine holds the state between periods. Not safe for concurrent use; the
@@ -214,6 +270,19 @@ type Engine struct {
// targetInst is the receiver the target was picked on, so the brakes are
// counted against ITS periods and its transmissions.
targetInst string
// now is the time of the last period seen. Every deadline in here is measured
// against it rather than against the wall clock: the periods ARE the clock —
// they arrive stamped — and mixing the two gave a rest that expired against
// one reading and a hold that ran against another.
now time.Time
// waiting is the station the engine WOULD call and cannot, because it is in
// a QSO with somebody else. Kept so the toolbar can say so: an auto-call
// deliberately holding its fire looks exactly like one with nothing to do,
// and from the outside there was no way to tell them apart.
waiting string
// answered says the target has replied to us at least once — the exchange is
// under way and nothing may take its place.
answered bool
// heldSince is when this station BECAME the target, and is never refreshed
// while it stays one. It was, and that quietly disabled the clock backstop:
// a station decoded every period for ever kept pushing its own deadline
@@ -221,6 +290,12 @@ type Engine struct {
heldSince time.Time
attempts int
misses int
// seenKey is the period in which the target was last DECODED. A period is
// judged more than once — the decodes arrive in bursts and stragglers follow —
// and a later judgement holds a partial view of it, not evidence of absence:
// the station answered in that very period and the counter still read one
// miss out of three.
seenKey string
lastMiss string // period already counted, so one period counts once
txSlot int // which of the two slots the target transmits in; -1 unknown
stopped bool // an explicit "Only" target gave up: needs a restart
@@ -230,6 +305,20 @@ type Engine struct {
// how many series it has already had this session.
rested map[string]time.Time
rounds map[string]int
// trace, when set, receives one line per period: what was on the air, why
// each station was refused, and what was decided. Off unless the operator
// asks for it — a line per period is a line every fifteen seconds, all
// night.
trace func(string, ...any)
// greyed is every station the OPERATOR stopped a call to.
//
// Halt is a verdict, not a pause: the operator watched the engine call this
// station and said no. Answering that by releasing the target and picking
// the same station again the next period — which is what clearing the state
// did — is the machine overruling them, and it is what Halt exists to
// prevent. It holds until auto-call is switched off and on again, which is
// the one gesture that plainly means "start over".
greyed map[string]bool
// done is every station the exchange was completed with this session.
//
// The log is the authority on what is worked, and it is SLOW: the QSO is
@@ -242,7 +331,8 @@ type Engine struct {
func New(s Settings) *Engine {
return &Engine{set: s.withDefaults(), txSlot: -1,
rested: map[string]time.Time{}, rounds: map[string]int{}, done: map[string]bool{}}
rested: map[string]time.Time{}, rounds: map[string]int{}, done: map[string]bool{},
greyed: map[string]bool{}}
}
// SetSettings swaps the settings in place. A target already being called is
@@ -261,7 +351,9 @@ func (e *Engine) Target() string {
// Status is what the panel shows: who, how far into the brakes, and whether
// the engine has given up and is waiting for the operator.
type Status struct {
Target string `json:"target"`
Target string `json:"target"`
// Waiting: wanted, decoded, and in a QSO with somebody else.
Waiting string `json:"waiting"`
Attempts int `json:"attempts"`
Max int `json:"max"`
Misses int `json:"misses"`
@@ -271,7 +363,8 @@ type Status struct {
}
func (e *Engine) Status() Status {
st := Status{Misses: e.misses, MaxMiss: e.set.Misses, Stopped: e.stopped, StoppedOn: e.stoppedOn}
st := Status{Misses: e.misses, MaxMiss: e.set.Misses, Stopped: e.stopped, StoppedOn: e.stoppedOn,
Waiting: e.waiting}
if e.target != nil {
st.Target = e.target.Call
st.Attempts = e.attempts
@@ -287,9 +380,38 @@ func (e *Engine) Reset() {
e.targetInst = ""
e.lastMiss, e.stopped, e.stoppedOn = "", false, ""
e.rested, e.rounds = map[string]time.Time{}, map[string]int{}
e.done = map[string]bool{}
e.done, e.greyed = map[string]bool{}, map[string]bool{}
}
// Halt is the operator stopping the call in progress.
//
// The station is set aside for the session — see greyed — and the target is
// released. Returns the callsign so the caller can say what happened; empty
// when nothing was being called, where Halt is just a halt.
func (e *Engine) Halt() string {
if e.target == nil {
return ""
}
call := strings.ToUpper(e.target.Call)
e.greyed[call] = true
e.release(call, true)
// Not counted as a series: the brakes are about a station that will not
// answer, and this one was never given the chance. It will not be called
// again anyway.
e.rounds[call]--
if e.rounds[call] < 0 {
e.rounds[call] = 0
}
delete(e.rested, call)
return call
}
// SetTrace turns the per-period trace on (a non-nil function) or off (nil).
func (e *Engine) SetTrace(fn func(string, ...any)) { e.trace = fn }
// Greylisted reports how many stations the operator has stopped this session.
func (e *Engine) Greylisted() int { return len(e.greyed) }
// Take hands the operator's own click to the engine: the station they picked
// becomes the target, with the counters restarted. Everything after it — the
// brakes, the hand-off at the end of the QSO — then applies as usual.
@@ -309,23 +431,47 @@ func (e *Engine) maxAttempts(c Candidate) int {
return e.set.Attempts
}
// rank is the ladder, as one number. Watched lifts a station by one rung, and
// a watched station with nothing needed sits at the bottom rather than being
// ineligible: the operator asked for that callsign.
// rank is the ladder, as one number.
//
// 9 WL DXCC 8 DXCC 7 WL band 6 band
// 5 WL mode 4 mode 3 WL slot 2 slot 1 watched, nothing needed
// 0 nothing to call for
// A WATCHED callsign outranks everything that is not watched. That is what a
// watch list means: the operator has named this station, and the machine's
// opinion of what the log needs does not get to overrule it.
//
// It did before, one rung at a time — watched new band above plain new band,
// but a watched station with nothing needed at the very bottom. On a band full
// of stations that ARE needed, that station was never reached: a watched
// DXpedition sat there all evening while the engine worked Brazilians. The
// list is not a tie-breaker, it is the answer.
//
// Below that line the old order stands, and for the same reasons: what is
// needed first, and a real need above one that exists only because a QSL never
// came — an unconfirmed new BAND still outranks a real new SLOT, because the
// band is the bigger prize whatever state it is in.
//
// 100+ every watched callsign, ordered among themselves by the same rule
// 18 DXCC 16 DXCC unconf
// 14 band 12 band unconf
// 10 mode 8 mode unconf
// 6 slot 4 slot unconf
// 0 nothing to call for
//
// needLabel is what the candidate is worth, in words: the rung, or the name of
// the orthogonal marker when that is the whole reason for the call.
func needLabel(c Candidate) string {
if c.Need == NeedExtra && c.Extra != "" {
return "new " + c.Extra
}
return c.Need.String()
}
func rank(c Candidate) int {
if c.Need == NeedNone {
if c.Watched {
return 1
}
return 0
r := int(c.Need) * 4 // slot 4, mode 8, band 12, DXCC 16
if c.Need != NeedNone && !c.Unconfirmed {
r += 2
}
r := int(c.Need) * 2 // slot 2, mode 4, band 6, DXCC 8
if c.Watched {
r++
// Above every unwatched station, whatever the log makes of either.
return 100 + r
}
return r
}
@@ -371,6 +517,40 @@ func isGrid(tok string) bool {
return gridRe.MatchString(tok)
}
// messages splits a decoded line into the messages it carries.
//
// One transmission can hold two. MSHV answers several callers at once — its
// own multi-answer transmission, not SuperFox — and the decoder prints them as
// one line:
//
// YV5ALI RR73; F4BPO <HK0/PY8WW> -08
//
// The second half is a report to F4BPO. Reading only the start of the line, the
// engine saw a station working YV5ALI, decided it could not answer us, and
// dropped the target — at the exact moment the DX was answering. Each segment
// is its own message and names its own recipient first.
func messages(msg string) []string {
return strings.Split(strings.ToUpper(strings.TrimSpace(msg)), ";")
}
// bare strips the angle brackets a decoder puts round a compressed callsign,
// and upper-cases what is left. "<HP/WE9G>" and "HP/WE9G" are one station, and
// every comparison in here has to agree about that.
func bare(call string) string {
return strings.Trim(strings.ToUpper(strings.TrimSpace(call)), "<>")
}
// addressedTo reports whether one message segment is addressed to a callsign.
// The recipient is the first token, sometimes bracketed when the sender has
// compressed a non-standard call.
func addressedTo(part, call string) bool {
toks := strings.Fields(part)
if len(toks) == 0 || call == "" {
return false
}
return bare(toks[0]) == bare(call)
}
// callable reports whether a station can be answered RIGHT NOW.
//
// A station in mid-exchange is committed to somebody else: it will not answer,
@@ -383,16 +563,22 @@ func callable(c Candidate, myCall string) bool {
if c.CQ {
return true
}
toks := strings.Fields(strings.ToUpper(strings.TrimSpace(c.Msg)))
if len(toks) == 0 {
parts := messages(c.Msg)
if len(parts) == 0 {
return false // nothing to read: assume it is busy rather than call blind
}
if myCall != "" && toks[0] == strings.ToUpper(myCall) {
return true // it is calling us
}
switch toks[len(toks)-1] {
case "RR73", "RRR", "73":
return true
for _, part := range parts {
toks := strings.Fields(part)
if len(toks) == 0 {
continue
}
if addressedTo(part, myCall) {
return true // it is calling us
}
switch toks[len(toks)-1] {
case "RR73", "RRR", "73":
return true
}
}
return false
}
@@ -403,8 +589,12 @@ func callingUs(c Candidate, myCall string) bool {
if myCall == "" || c.CQ {
return false
}
toks := strings.Fields(strings.ToUpper(strings.TrimSpace(c.Msg)))
return len(toks) > 0 && toks[0] == strings.ToUpper(myCall)
for _, part := range messages(c.Msg) {
if addressedTo(part, myCall) {
return true
}
}
return false
}
// finished reports that the exchange with this station is over: it sent us the
@@ -420,13 +610,17 @@ func finished(decodes []Candidate, call, myCall string) bool {
if strings.ToUpper(c.Call) != call {
continue
}
toks := strings.Fields(strings.ToUpper(strings.TrimSpace(c.Msg)))
if len(toks) < 2 || toks[0] != me {
continue
}
switch toks[len(toks)-1] {
case "RR73", "RRR", "73":
return true
// Every segment: a fox says goodbye to one caller and hello to the next
// in the same transmission.
for _, part := range messages(c.Msg) {
toks := strings.Fields(part)
if len(toks) < 2 || !addressedTo(part, me) {
continue
}
switch toks[len(toks)-1] {
case "RR73", "RRR", "73":
return true
}
}
}
return false
@@ -466,6 +660,9 @@ func (e *Engine) OnPeriod(p Period) Action {
if !e.set.Enabled {
return Action{}
}
if !p.At.IsZero() {
e.now = p.At
}
// ONE station at a time, on the receiver it is being called on.
//
// This is the guarantee with two decoders running: while a target is held,
@@ -482,16 +679,38 @@ func (e *Engine) OnPeriod(p Period) Action {
t := *e.target
tc := strings.ToUpper(t.Call)
// HAS IT ANSWERED US? Settled first, before any of the checks below can
// decide to leave it.
//
// The reply lands in the same period the ladder is re-read, and that
// period used to be judged with answered still false — so a station
// answering our CQ-call was dropped for a better-ranked one in the exact
// period it came back to us. Watched from the shack: mid-exchange with
// V31MA, report sent, and OpsLog switched to a station calling on the
// other side of the screen. A QSO in progress outranks the ladder.
if seen := bestOf(p.Decodes, tc); seen != nil && callingUs(*seen, p.MyCall) {
e.answered = true
}
// The exchange is over — either the station sent us its last frame, or
// the log now holds it. Hand straight on to the next station in the same
// period rather than waiting for the next one: the slot is the resource.
if finished(p.Decodes, tc, p.MyCall) || workedNow(p.Decodes, tc) {
e.release(tc, false)
// Straight on to the next station, list or no list: pick() is what
// knows the chase list, and with one on it the answer is simply the
// next callsign there — a list of two DXpeditions must not stop
// after the first.
return e.pick(p, fmt.Sprintf("QSO with %s finished", tc))
// AND NOTHING ELSE THIS PERIOD. The next station is picked on the next
// one, fifteen seconds later, and it is still there.
//
// His RR73 is decoded while we are between overs, so the decoder is
// about to send our own 73 in the slot that is opening. Answering
// somebody else now takes that slot: the reply switches the DX call
// mid-sequence and the 73 never goes out whole — an operator watching
// saw both transmissions in one period, and the station at the other
// end never got the frame that closes the contact.
//
// This used to hand straight on "because the slot is the resource".
// The slot is worth less than the QSO it would spoil.
return Action{Kind: DoNothing,
Reason: fmt.Sprintf("QSO with %s finished — leaving the next slot for our 73", tc)}
}
// The clock backstop. Every counter below depends on decodes arriving in
@@ -501,22 +720,82 @@ func (e *Engine) OnPeriod(p Period) Action {
return Action{Kind: DoHalt, Reason: fmt.Sprintf("%s held for %s with nothing to show for it", tc, e.set.MaxHold)}
}
if e.trace != nil {
e.trace("period %s holding %s calls=%d/%d misses=%d/%d%s",
p.Key, tc, e.attempts, e.maxAttempts(t), e.misses, e.set.Misses,
map[bool]string{true: " (transmitting)", false: ""}[p.TX.Transmitting])
}
// SOMETHING BETTER HAS COME ON THE AIR.
//
// A target is held until it answers or a brake releases it, and that is
// right once an exchange has started — but before it has, holding means
// spending the next two minutes on a new slot while the watched
// DXpedition calls CQ three rows above it. Which is what an operator
// sees: the first CQ ignored, then the second one answered because the
// other call had run its course.
//
// So while the target has NOT answered us, a strictly better station
// takes its place. "Better" is the ladder, which does not flicker: a
// station's need does not change from period to period, so this cannot
// oscillate between two of them — only a genuinely higher rung wins.
if !e.answered {
if a, ok := e.preempt(p); ok {
return a
}
}
if seen := bestOf(p.Decodes, tc); seen != nil {
// The decode is refreshed so a reply carries a current timestamp; the
// hold clock is NOT — see heldSince.
e.target = seen
e.misses, e.lastMiss = 0, ""
e.misses, e.lastMiss, e.seenKey = 0, "", p.Key
e.txSlot = slotOf(p.At, periodSecs(p, *seen))
// In QSO: the decoder is sequencing the exchange on its own and the
// attempt counter has done its job. Interrupting it with another
// reply is how two transmissions land in one slot.
if callingUs(*seen, p.MyCall) {
e.attempts = 0
e.answered = true
// The exchange is under way, so the hold clock starts again from
// here: it exists to end a call nobody answers, and this one has
// been answered. Without this a QSO that began at the end of a
// long wait could be halted mid-exchange by a backstop that was
// counting the wait.
e.heldSince = p.At
return Action{}
}
// IT IS WORKING SOMEBODY ELSE, AND WE GO ON CALLING.
//
// This used to stop, on the reasoning that a station in a QSO cannot
// hear the call. That is how a pileup is NOT worked: a DX with a
// queue answers one caller per period, and the only way to be the
// next one is to keep calling while it works the others. An operator
// watched exactly that — D44TWO finishing a contact, the call
// started, the DX coming back to somebody else, and the engine
// giving up on a station that was about to be free.
//
// The effort is already bounded: seven calls, fifteen for a watched
// station, and the miss counter for one that goes off the air. And
// nothing is wasted while it is busy — a better station may still
// take the slot, because it has not answered us (see preempt).
//
// The callable test still governs the CHOICE of a target, where it
// belongs: a reply to a decode in mid-exchange is one WSJT-X and
// JTDX may refuse outright.
if e.trace != nil && !callable(*seen, p.MyCall) {
e.trace("period %s %s is working %s — carrying on calling", p.Key, tc, addressee(seen.Msg))
}
return Action{}
}
// Absent. Only its OWN transmit periods count against it.
// Absent. Only its OWN transmit periods count against it — and never one
// of ours: our transmission is the reason it is not there.
if p.TX.Transmitting {
return Action{}
}
// Nor a period it was already decoded in: see seenKey.
if e.seenKey == p.Key {
return Action{}
}
if e.txSlot >= 0 && slotOf(p.At, periodSecs(p, t)) != e.txSlot {
return Action{}
}
@@ -536,65 +815,132 @@ func (e *Engine) OnPeriod(p Period) Action {
if e.stopped {
return Action{} // an explicit target gave up; the operator restarts it
}
// Never start a call over a transmission in progress: the reply would land
// in a slot the decoder is already using.
if p.TX.Transmitting {
return Action{}
}
return e.pick(p, "")
}
// pick chooses the best station on the air and answers it.
//
// NEVER over a transmission in progress, and that guard belongs HERE because
// there are two ways in. A reply is not a request the decoder queues: WSJT-X
// acts on it at once, drops the exchange it is in and starts calling the new
// station — so a reply sent while our own 73 was going out cut that 73 about a
// second in, and the station we had just worked never got it. Reported from the
// air, and the sequence is exactly this one: his RRR is decoded, the QSO reads
// as finished, and the next station is picked in the same instant.
//
// The slot is worth having, but not at the price of the QSO in hand. The next
// period is a fifteen-second wait and everything worth calling is still there.
func (e *Engine) pick(p Period, why string) Action {
if e.trace != nil {
e.tracePick(p)
}
if p.TX.Transmitting {
if why != "" {
return Action{Kind: DoNothing, Reason: why + " — holding until the transmission ends"}
}
return Action{}
}
only := onlyList(e.set.Only)
var best *Candidate
var bestRank int
// bestRank of everything eligible, rested or not: a station that is resting
// may only be re-picked while nothing better is on the air, and that is the
// comparison.
topRank := 0
// The best station that is wanted, decoded, and working somebody else. It
// is not a candidate — it cannot answer — but it is the reason the engine
// is silent, and the operator is entitled to know that.
waiting, waitingRank := "", 0
for i := range p.Decodes {
c := p.Decodes[i]
if !e.eligible(c, p, only) {
continue
}
if r := rank(c); r > topRank {
topRank = r
}
}
for i := range p.Decodes {
c := p.Decodes[i]
if !e.eligible(c, p, only) {
if ok, why := e.judge(c, p, only); !ok {
if why == "busy" {
if r := rank(c); r > waitingRank {
waiting, waitingRank = strings.ToUpper(c.Call), r
}
}
continue
}
r := rank(c)
if resting, ok := e.rested[strings.ToUpper(c.Call)]; ok && p.At.Before(resting) {
// Rested: allowed back only when it is the best thing there is.
// Anything of higher rank takes the slot instead.
if r < topRank {
continue
}
}
if best == nil || better(c, r, *best, bestRank, p.MyCall) {
cc := c
best, bestRank = &cc, r
}
}
e.waiting = waiting
if best == nil {
if waiting != "" {
return Action{Kind: DoNothing,
Reason: fmt.Sprintf("waiting for %s — it is working somebody else", waiting)}
}
if why != "" {
return Action{Kind: DoNothing, Reason: why + " — nothing else worth calling"}
}
return Action{}
}
e.waiting = ""
e.target, e.heldSince, e.targetInst = best, p.At, best.Instance
e.attempts, e.misses, e.txSlot, e.lastMiss = 0, 0, -1, ""
reason := fmt.Sprintf("calling %s (%s%s)", best.Call, watchedTag(*best), best.Need)
// ITS SLOT IS KNOWN FROM THE DECODE THAT MADE IT A CANDIDATE.
//
// This used to start at -1, meaning "parity unknown", and with parity
// unknown the miss counter has nothing to filter on: every period without
// the station counted, INCLUDING the one we spend transmitting to it, where
// it cannot be decoded by definition. An operator answering a CQ saw the
// counter at two misses out of three before the station had had a single
// chance to come back — one bad period from being given up on.
e.attempts, e.misses, e.lastMiss = 0, 0, ""
e.txSlot = slotOf(p.At, periodSecs(p, *best))
e.answered = false
e.waiting = ""
reason := fmt.Sprintf("calling %s (%s%s)", best.Call, watchedTag(*best), needLabel(*best))
if why != "" {
reason = why + " — " + reason
}
return Action{Kind: DoReply, Decode: best.Decode, Reason: reason}
}
// tracePick writes the one line that says what this period held and what it
// was worth. Counts by refusal, then the best few candidates in rank order —
// enough to see WHY a station on the screen was not the one called.
func (e *Engine) tracePick(p Period) {
only := onlyList(e.set.Only)
refused := map[string]int{}
// The callsigns too, not only the counts. "worked=2" answers "how many" and
// leaves "which" — and which is the whole question when an operator is
// looking at one station on the screen and asking why it was passed over.
who := map[string][]string{}
type scored struct {
c Candidate
r int
}
var ok []scored
for i := range p.Decodes {
if good, why := e.judge(p.Decodes[i], p, only); good {
ok = append(ok, scored{p.Decodes[i], rank(p.Decodes[i])})
} else {
refused[why]++
if len(who[why]) < 4 {
who[why] = append(who[why], p.Decodes[i].Call)
}
}
}
sort.Slice(ok, func(i, j int) bool { return ok[i].r > ok[j].r })
best := make([]string, 0, 3)
for i := 0; i < len(ok) && i < 3; i++ {
best = append(best, fmt.Sprintf("%s(%s%s,%d dB,r%d)",
ok[i].c.Call, watchedTag(ok[i].c), needLabel(ok[i].c), ok[i].c.SNR, ok[i].r))
}
why := make([]string, 0, len(refused))
for _, k := range []string{"worked", "nothing-needed", "busy", "resting", "halted", "parked", "hidden", "not-chased", "replay", "self"} {
if n := refused[k]; n > 0 {
names := strings.Join(who[k], ",")
if n > len(who[k]) {
names += ",…"
}
why = append(why, fmt.Sprintf("%s=%d(%s)", k, n, names))
}
}
e.trace("period %s rx=%q decodes=%d callable=%d [%s] refused[%s]%s",
p.Key, p.Instance, len(p.Decodes), len(ok), strings.Join(best, " "),
strings.Join(why, " "),
map[bool]string{true: " (transmitting)", false: ""}[p.TX.Transmitting])
}
func watchedTag(c Candidate) string {
if c.Watched {
return "watched "
@@ -604,30 +950,100 @@ func watchedTag(c Candidate) string {
// eligible is every refusal that applies before a station is even ranked.
func (e *Engine) eligible(c Candidate, p Period, only []string) bool {
ok, _ := e.judge(c, p, only)
return ok
}
// judge is eligible() with the reason attached, in one word.
//
// The reason exists for the log. An auto-call that calls nobody is the hardest
// thing to argue with — the band is full, the panel shows a dozen stations
// wanted, and nothing goes out — and "twenty-three decodes, nineteen already
// worked, three greyed, one resting" answers it in a line where a boolean
// cannot.
func (e *Engine) judge(c Candidate, p Period, only []string) (bool, string) {
call := strings.ToUpper(strings.TrimSpace(c.Call))
if call == "" || call == strings.ToUpper(p.MyCall) {
return false
return false, "self"
}
if !c.IsNew {
return false // replayed history: the station may be hours gone
return false, "replay" // the station may be hours gone
}
if len(only) > 0 {
// The named stations, and each only until the QSO with it is made: an
// explicit request is not a standing order to work the same station all
// evening. The others on the list stay callable.
return inList(only, call) && !e.done[call] && !c.Worked
switch {
case !inList(only, call):
return false, "not-chased"
case e.greyed[call]:
return false, "halted"
case e.done[call] || c.Worked:
return false, "worked"
}
return true, ""
}
if c.Worked || e.done[call] {
return false
return false, "worked"
}
if e.greyed[call] {
return false, "halted"
}
// A STATION CALLING US is answered, needed or not.
//
// It has heard us, it is waiting, and the QSO is one over away — refusing it
// because the log has nothing to gain is how an operator finishes a contact,
// sees two stations calling them on the next sequence, and watches the
// machine ignore both. Everything below this point is about choosing whom to
// CALL; a caller is not chosen, it is already there.
//
// The refusals above still apply — worked on this band and mode, the QSO
// already made, a station the operator stopped. Those are answers about this
// station, not about the log's appetite.
if callingUs(c, p.MyCall) {
return true, ""
}
// "LoTW users only" is a rule about STRANGERS. It cannot overrule the watch
// list: naming a callsign is the operator saying they want that station, and
// a DXpedition that uploads nowhere is exactly the kind of station one puts
// on the list. Reported from the air — a watched J38DX, plainly calling CQ,
// never called all evening because it is not in the LoTW user file.
// FILTERED OFF THE SCREEN. The operator's own filters, applied to the
// transmitter: what is not shown is not called.
if e.set.OnScreenOnly && c.Hidden {
return false, "hidden"
}
if rank(c) == 0 {
return false
return false, "nothing-needed"
}
if e.rounds[call] >= e.set.MaxRounds {
return false // parked for the session
// A WATCHED callsign is never parked.
//
// Parking is the answer to "it will not answer, stop wasting the evening on
// it" — a fair verdict about a station the LOG picked out, and the wrong one
// about a station the OPERATOR did. A DXpedition running a pileup takes more
// than two series of calls to get through to, which is precisely why it was
// put on the list; watched ZD8GB was refused for the rest of the session
// after fourteen unanswered calls, while it went on transmitting six streams
// a period.
//
// The rest between series still applies, so it does not monopolise the
// transmitter — it simply never becomes ineligible.
if e.rounds[call] >= e.set.MaxRounds && !c.Watched {
return false, "parked" // its series are spent for the session
}
// RESTING. A series that ended in a brake is followed by a real pause,
// whatever else is on the air — the exception used to be "unless nothing
// better is decoding", and for the station everybody is chasing that is
// every period: seven calls, a halt, and the same station called again four
// seconds later. From the outside that is not a rest, it is a stutter.
if until, ok := e.rested[call]; ok && p.At.Before(until) {
return false, "resting"
}
// Mid-exchange with somebody else: it cannot answer us — see callable.
return callable(c, p.MyCall)
if !callable(c, p.MyCall) {
return false, "busy"
}
return true, ""
}
// better orders two eligible stations: the need first, then the one already
@@ -645,11 +1061,78 @@ func better(a Candidate, ra int, b Candidate, rb int, myCall string) bool {
return a.SNR > b.SNR
}
// preempt hands the slot to a better station, if one is on the air.
func (e *Engine) preempt(p Period) (Action, bool) {
if e.target == nil || p.TX.Transmitting {
// Mid-over: the reply would switch the decoder's call in the middle of
// a transmission. It waits for the gap, like every other call.
return Action{}, false
}
held := rank(*e.target)
heldSeen := bestOf(p.Decodes, strings.ToUpper(e.target.Call)) != nil
only := onlyList(e.set.Only)
best, bestRank := (*Candidate)(nil), held
for i := range p.Decodes {
c := p.Decodes[i]
if strings.EqualFold(c.Call, e.target.Call) || !e.eligible(c, p, only) {
continue
}
// Strictly better takes over. So does an EQUAL rung when the station we
// are calling is not even on the air this period: the seven calls are
// going into the void while a station of the same value is calling CQ
// three rows above it, which is what an operator sees and cannot explain.
r := rank(c)
switch {
case r > bestRank:
case r == bestRank && !heldSeen && best == nil:
case best != nil && r == bestRank && better(c, r, *best, bestRank, p.MyCall):
default:
continue
}
{
cc := c
best, bestRank = &cc, r
}
}
if best == nil {
return Action{}, false
}
was := strings.ToUpper(e.target.Call)
e.drop()
e.target, e.heldSince, e.targetInst = best, p.At, best.Instance
return Action{Kind: DoReply, Decode: best.Decode,
Reason: fmt.Sprintf("%s (%s%s) takes over from %s — nothing had been answered yet",
best.Call, watchedTag(*best), needLabel(*best), was)}, true
}
// drop lets the target go with no verdict attached: not worked, not given up
// on, not rested. It is simply not the station to be calling right now, and it
// is picked again like any other the moment it is.
func (e *Engine) drop() {
e.target, e.attempts, e.misses, e.txSlot, e.lastMiss = nil, 0, 0, -1, ""
e.targetInst, e.answered, e.seenKey = "", false, ""
}
// addressee is who a message is being sent to — the first token, which is the
// callsign being answered — the first segment of a multi-answer line, which is
// the QSO it is finishing.
func addressee(msg string) string {
parts := messages(msg)
if len(parts) == 0 {
return "someone else"
}
toks := strings.Fields(parts[0])
if len(toks) == 0 {
return "someone else"
}
return bare(toks[0])
}
// release clears the target. gaveUp marks it as a series that ended in a brake
// rather than in a QSO.
func (e *Engine) release(call string, gaveUp bool) {
e.target, e.attempts, e.misses, e.txSlot, e.lastMiss = nil, 0, 0, -1, ""
e.targetInst = ""
e.targetInst, e.answered = "", false
if !gaveUp {
// A finished QSO is not a failed series — the callsign keeps its rounds —
// but it IS finished: nothing more is wanted from this station today,
@@ -662,7 +1145,11 @@ func (e *Engine) release(call string, gaveUp bool) {
func (e *Engine) giveUp(call string, t Candidate) {
e.release(call, true)
e.rounds[call]++
e.rested[call] = time.Now().Add(e.set.Rest)
at := e.now
if at.IsZero() {
at = time.Now()
}
e.rested[call] = at.Add(restFor(e.set.RestPeriods, candidateSecs(t)))
// An explicit "call this station" that runs out of attempts stops the
// feature instead of moving on. There is nothing else it was asked to do.
if strings.TrimSpace(e.set.Only) != "" {
@@ -693,19 +1180,32 @@ func (e *Engine) NoteTX(tx TXState) Action {
return Action{}
}
t := *e.target
tc := strings.ToUpper(t.Call)
tc := bare(t.Call)
msg := strings.ToUpper(strings.TrimSpace(tx.Msg))
switch {
case msg != "":
toks := strings.Fields(msg)
if len(toks) < 3 || toks[0] != tc || !isGrid(toks[2]) {
// bare(): a decoder compresses a non-standard callsign into angle
// brackets — "<HP/WE9G> F4BPO JN36" is a call to HP/WE9G — and comparing
// the raw token left the counter at 0/15 while the operator watched call
// after call go out. Every brake downstream of it was dead too.
if len(toks) < 3 || bare(toks[0]) != tc {
return Action{}
}
if !isGrid(toks[2]) {
// A report, an R-report, RR73: we are INSIDE the exchange, not
// opening it. It does not count as a call — and it settles that
// nothing may take this station's place, which matters when the
// decoder is answering somebody the engine never picked (the
// operator double-clicked a row) and no reply has been decoded yet.
e.answered = true
return Action{}
}
default:
// JTDX reports no transmit message. The DX call is all there is, so
// every transmit period aimed at the target counts — more generous, and
// far better than a counter frozen at zero for ever.
if strings.ToUpper(strings.TrimSpace(tx.DXCall)) != tc {
if bare(tx.DXCall) != tc {
return Action{}
}
}
@@ -715,7 +1215,8 @@ func (e *Engine) NoteTX(tx TXState) Action {
}
max := e.maxAttempts(t)
e.giveUp(tc, t)
return Action{Kind: DoHalt, Reason: fmt.Sprintf("%s called %d times without an answer", tc, max)}
return Action{Kind: DoHalt, Soft: true,
Reason: fmt.Sprintf("%s called %d times without an answer — stopping after this over", tc, max)}
}
// bestOf returns the most callable decode of one station in a period.
@@ -750,6 +1251,28 @@ func workedNow(decodes []Candidate, call string) bool {
return false
}
// restFor turns a number of the station's own overs into a deadline.
//
// A station transmits every OTHER slot, so one of its overs is two T/R periods —
// and the extra half-cycle is what makes the answer stable: without it the
// deadline lands exactly on the station's next transmission, where a
// millisecond of clock skew decides whether it is called or passed over. Landing
// it mid-cycle makes "sit out one over" mean one over, every time.
func restFor(overs, trSec int) time.Duration {
if overs <= 0 {
return time.Duration(trSec) * time.Second // no rest: its next over will do
}
return time.Duration(overs*2*trSec+trSec) * time.Second
}
// candidateSecs is the station's own T/R period in seconds, defaulting to FT8's.
func candidateSecs(c Candidate) int {
if c.TRPeriod > 0 {
return c.TRPeriod
}
return 15
}
func periodSecs(p Period, c Candidate) int {
if c.TRPeriod > 0 {
return c.TRPeriod
+533 -17
View File
@@ -2,6 +2,7 @@ package autocall
import (
"fmt"
"strings"
"testing"
"time"
)
@@ -56,13 +57,17 @@ func on() *Engine { return New(Settings{Enabled: true}) }
// ── The ladder ────────────────────────────────────────────────────────────
func TestLadderOrder(t *testing.T) {
// Every rung, in the order the operator asked for.
// Every rung. The watched ones come FIRST, ordered among themselves by what
// is needed — the list is the operator's answer, not a tie-breaker.
order := []Candidate{
cq("A", NeedDXCC, 0, watched), cq("B", NeedDXCC, 0),
cq("C", NeedBand, 0, watched), cq("D", NeedBand, 0),
cq("E", NeedMode, 0, watched), cq("F", NeedMode, 0),
cq("G", NeedSlot, 0, watched), cq("H", NeedSlot, 0),
cq("A", NeedDXCC, 0, watched), cq("C", NeedBand, 0, watched),
cq("E", NeedMode, 0, watched), cq("G", NeedSlot, 0, watched),
cq("I", NeedNone, 0, watched),
cq("B", NeedDXCC, 0), cq("D", NeedBand, 0),
cq("F", NeedMode, 0), cq("H", NeedSlot, 0),
// The orthogonal markers sit at the foot of the ladder: worth a call
// when nothing better is on the air, never worth leaving a band for.
cq("J", NeedExtra, 0),
}
for i := 1; i < len(order); i++ {
if rank(order[i-1]) <= rank(order[i]) {
@@ -76,10 +81,17 @@ func TestLadderOrder(t *testing.T) {
}
// And the pick agrees with the ladder, whatever order the period lists them.
e := on()
a := e.OnPeriod(period(0, order[7], order[3], order[0], order[5]))
a := e.OnPeriod(period(0, order[8], order[5], order[0], order[6]))
if a.Kind != DoReply || a.Decode.Call != "A" {
t.Fatalf("picked %+v, want the watched new entity", a)
}
// A watched station with NOTHING needed still beats a new entity that is not
// watched — the case that sent an operator hunting: a watched DXpedition sat
// on the band all evening while the engine worked what the log wanted.
e = on()
if a := e.OnPeriod(period(2, cq("RARE", NeedDXCC, 0), cq("WATCHED", NeedNone, -20, watched))); a.Decode.Call != "WATCHED" {
t.Errorf("picked %q, want the watched callsign", a.Decode.Call)
}
}
func TestStrongestWinsBetweenEquals(t *testing.T) {
@@ -232,24 +244,56 @@ func TestAReleasedStationYieldsToAnythingBetter(t *testing.T) {
}
}
func TestAReleasedStationIsCalledAgainWhenNothingBetterIsOnTheAir(t *testing.T) {
// A series that ended in a brake is followed by ONE of the station's own overs
// passed over — long enough to be a pause, short enough that the DX everybody
// is chasing is still there when the calling resumes. It used to be two
// minutes, which on FT8 is four overs: by then the DX has worked four other
// callers, and half the time it has gone.
func TestAReleasedStationSitsOutOneOfItsOvers(t *testing.T) {
e := on()
e.OnPeriod(period(0, cq("DX", NeedBand, -5)))
tx := TXState{Transmitting: true, Msg: "DX " + me + " JN36"}
for i := 0; i < 7; i++ {
e.NoteTX(tx)
}
a := e.OnPeriod(period(2, cq("DX", NeedBand, -5)))
if a.Kind != DoReply || a.Decode.Call != "DX" {
t.Errorf("nothing better on the air and the station was not called again: %+v", a)
// Its very next over is passed over, whatever else is on the air: seven
// calls, a halt, and the same station called again four seconds later is not
// a rest, it is a stutter.
if a := e.OnPeriod(period(2, cq("DX", NeedBand, -5))); a.Kind != DoNothing {
t.Fatalf("called again during the rest: %+v", a)
}
// And the one after that goes: still there, still wanted, and the operator
// has listened through an over.
if a := e.OnPeriod(period(4, cq("DX", NeedBand, -5))); a.Kind != DoReply {
t.Errorf("after one over: %+v, want the station called again", a)
}
}
func TestTheAttemptsCapLetsTheOverFinish(t *testing.T) {
e := on()
e.OnPeriod(period(0, cq("DX", NeedDXCC, -5)))
tx := TXState{Transmitting: true, Msg: "DX " + me + " JN36"}
var a Action
for i := 0; i < 7; i++ {
a = e.NoteTX(tx)
}
if a.Kind != DoHalt {
t.Fatalf("no halt after seven calls: %+v", a)
}
// The cap trips WHILE the seventh call is going out — cutting the carrier
// there sends half a call. It asks the decoder to finish the over first.
if !a.Soft {
t.Error("the attempts cap cut the transmission that counted it")
}
}
func TestAStationIsParkedAfterItsRounds(t *testing.T) {
e := on()
tx := TXState{Transmitting: true, Msg: "DX " + me + " JN36"}
// Rounds are spaced past the rest (2 min = 8 periods) or the station would
// simply be resting rather than parked.
for round := 1; round <= 3; round++ {
a := e.OnPeriod(period(round*2, cq("DX", NeedBand, -5)))
a := e.OnPeriod(period(round*10, cq("DX", NeedBand, -5)))
if a.Kind != DoReply {
t.Fatalf("round %d: not called (%+v)", round, a)
}
@@ -259,7 +303,7 @@ func TestAStationIsParkedAfterItsRounds(t *testing.T) {
}
// Three series of seven is twenty-one calls. That is the end of it for this
// session — the whole point of the exercise is that it cannot reach fifty.
if a := e.OnPeriod(period(20, cq("DX", NeedBand, -5))); a.Kind != DoNothing {
if a := e.OnPeriod(period(60, cq("DX", NeedBand, -5))); a.Kind != DoNothing {
t.Errorf("a fourth series was started: %+v", a)
}
}
@@ -271,9 +315,13 @@ func TestFinishedQSOMovesToTheNextPriority(t *testing.T) {
e.OnPeriod(period(0, cq("DX", NeedDXCC, -5)))
done := callsMe("DX", NeedDXCC, -5)
done.Msg = me + " DX RR73"
a := e.OnPeriod(period(2, done, cq("NEXT", NeedBand, -10)))
// The period the QSO ends in belongs to our own 73 — nothing else is called.
if a := e.OnPeriod(period(2, done, cq("NEXT", NeedBand, -10))); a.Kind != DoNothing {
t.Fatalf("took the slot our 73 goes out in: %+v", a)
}
a := e.OnPeriod(period(4, cq("NEXT", NeedBand, -10)))
if a.Kind != DoReply || a.Decode.Call != "NEXT" {
t.Errorf("after the QSO ended: %+v, want the next priority in the same period", a)
t.Errorf("next period: %+v, want the next priority", a)
}
}
@@ -282,12 +330,14 @@ func TestFinishedQSOWithNoPriorityAnswersWhoeverIsCallingUs(t *testing.T) {
e.OnPeriod(period(0, cq("DX", NeedDXCC, -5)))
done := callsMe("DX", NeedDXCC, -5)
done.Msg = me + " DX RR73"
// Two stations calling us, nothing needed from either: the strongest wins.
// Two stations calling us, nothing needed from either: the strongest wins
// on the period after the one our 73 goes out in.
weak := callsMe("WEAK", NeedNone, -18)
weak.Watched = true
loud := callsMe("LOUD", NeedNone, -4)
loud.Watched = true
a := e.OnPeriod(period(2, done, weak, loud))
e.OnPeriod(period(2, done))
a := e.OnPeriod(period(4, weak, loud))
if a.Kind != DoReply || a.Decode.Call != "LOUD" {
t.Errorf("answered %+v, want the strongest of the stations calling us", a)
}
@@ -403,7 +453,8 @@ func TestChaseListTakesSeveralCallsigns(t *testing.T) {
// single request.
done := callsMe("VP6D", NeedDXCC, -22)
done.Msg = me + " VP6D RR73"
a = e.OnPeriod(period(4, done, cq("3Y0J", NeedSlot, -1)))
e.OnPeriod(period(4, done, cq("3Y0J", NeedSlot, -1)))
a = e.OnPeriod(period(6, cq("3Y0J", NeedSlot, -1)))
if a.Kind != DoReply || a.Decode.Call != "3Y0J" {
t.Errorf("after working VP6D: %+v, want the other station on the list", a)
}
@@ -460,3 +511,468 @@ func TestTheOtherReceiverCannotBreakTheQSOInProgress(t *testing.T) {
t.Errorf("after the QSO ended, the other receiver was still locked out: %+v", a)
}
}
// The one reported from the air: his RRR arrives, we are sending our 73, and
// the engine picked the next station in the same instant. WSJT-X acts on a
// reply at once — it dropped the exchange and started calling the new station,
// cutting the 73 a second in.
func TestNothingIsCalledOverOurOwnTransmission(t *testing.T) {
e := on()
e.OnPeriod(period(0, cq("DX", NeedDXCC, -5)))
done := callsMe("DX", NeedDXCC, -5)
done.Msg = me + " DX RRR"
p := period(2, done, cq("NEXT", NeedBand, -10))
p.TX = TXState{Transmitting: true, Msg: "DX " + me + " 73"}
if a := e.OnPeriod(p); a.Kind != DoNothing {
t.Fatalf("called %+v while our own over was still going out", a)
}
// The QSO is still released — only the next call waits.
if e.Target() != "" {
t.Errorf("target = %q after the QSO finished, want none", e.Target())
}
// Next period, carrier down: now it may take the next station.
if a := e.OnPeriod(period(4, cq("NEXT", NeedBand, -10))); a.Kind != DoReply || a.Decode.Call != "NEXT" {
t.Errorf("once the transmission ended: %+v, want the next station called", a)
}
}
func TestTheHoldClockRestartsWhenTheStationAnswers(t *testing.T) {
e := on()
e.OnPeriod(period(0, cq("DX", NeedDXCC, -5)))
// Called for a long time — nearly the backstop — and then he answers.
for p := 2; p <= 14; p += 2 {
e.OnPeriod(period(p, cq("DX", NeedDXCC, -5)))
}
e.OnPeriod(period(16, callsMe("DX", NeedDXCC, -5)))
// The exchange must not be halted by a backstop that was counting the wait.
for _, p := range []int{18, 20} {
if a := e.OnPeriod(period(p, callsMe("DX", NeedDXCC, -5))); a.Kind == DoHalt {
t.Fatalf("period %d: halted an exchange in progress (%s)", p, a.Reason)
}
}
}
func TestARealNeedOutranksAnUnconfirmedOne(t *testing.T) {
real := cq("REAL", NeedBand, -20)
unconf := cq("UNCONF", NeedBand, -2)
unconf.Unconfirmed = true
// Same need, and the unconfirmed one is 18 dB louder. The band never worked
// is still the catch: the other is a QSL to chase, not a QSO to make.
e := on()
if a := e.OnPeriod(period(0, unconf, real)); a.Decode.Call != "REAL" {
t.Errorf("picked %q, want the band never worked", a.Decode.Call)
}
// Watched changes that, and is meant to: the list is the operator's answer.
unconf.Watched = true
e = on()
if a := e.OnPeriod(period(0, unconf, real)); a.Decode.Call != "UNCONF" {
t.Errorf("picked %q, want the watched station", a.Decode.Call)
}
unconf.Watched = false
// Between two unwatched stations, an unconfirmed BAND still beats a real
// SLOT: the band is the bigger prize whatever state it is in.
slot := cq("SLOT", NeedSlot, 0)
e = on()
if a := e.OnPeriod(period(0, slot, unconf)); a.Decode.Call != "UNCONF" {
t.Errorf("picked %q, want the unconfirmed band over a real slot", a.Decode.Call)
}
}
// ── The operator's Halt ───────────────────────────────────────────────────
func TestHaltSetsTheStationAsideForTheSession(t *testing.T) {
e := on()
if a := e.OnPeriod(period(0, cq("DX", NeedDXCC, -5))); a.Decode.Call != "DX" {
t.Fatalf("not called: %+v", a)
}
// The operator stops it mid-call.
if got := e.Halt(); got != "DX" {
t.Fatalf("Halt returned %q, want the station being called", got)
}
if e.Target() != "" {
t.Error("the target survived a halt")
}
// Still the loudest new entity on the air, period after period. It is the
// operator's verdict, so it is not called again — not next period, not in
// ten minutes.
for _, n := range []int{2, 4, 40} {
if a := e.OnPeriod(period(n, cq("DX", NeedDXCC, -5))); a.Kind != DoNothing {
t.Errorf("period %d: called a station the operator had stopped: %+v", n, a)
}
}
// Naming it explicitly does not override the operator either.
e.SetSettings(Settings{Enabled: true, Only: "DX"})
if a := e.OnPeriod(period(42, cq("DX", NeedDXCC, -5))); a.Kind != DoNothing {
t.Errorf("the chase list overrode a halt: %+v", a)
}
// Switching auto-call off and on is what starts over.
e.Reset()
e.SetSettings(Settings{Enabled: true})
if a := e.OnPeriod(period(44, cq("DX", NeedDXCC, -5))); a.Kind != DoReply {
t.Errorf("after a restart the station is fair game again: %+v", a)
}
}
func TestHaltWithNothingBeingCalledIsJustAHalt(t *testing.T) {
e := on()
if got := e.Halt(); got != "" {
t.Errorf("Halt returned %q with no target", got)
}
if e.Greylisted() != 0 {
t.Errorf("greylisted %d stations from an idle halt", e.Greylisted())
}
}
func TestTraceSaysWhyNobodyWasCalled(t *testing.T) {
var lines []string
e := on()
e.SetTrace(func(f string, args ...any) { lines = append(lines, fmt.Sprintf(f, args...)) })
worked := cq("A", NeedDXCC, -5, worked)
nothing := cq("B", NeedNone, -5)
busyOne := busy("C", NeedBand, -5)
e.Halt() // nothing held: no-op, keeps the set empty
e.OnPeriod(period(0, worked, nothing, busyOne))
if len(lines) == 0 {
t.Fatal("tracing on and nothing was written")
}
got := lines[len(lines)-1]
for _, want := range []string{"decodes=3", "callable=0", "worked=1", "nothing-needed=1", "busy=1"} {
if !strings.Contains(got, want) {
t.Errorf("trace %q does not say %q", got, want)
}
}
// And when it DOES call, the line names the candidates it ranked.
lines = nil
e.OnPeriod(period(2, cq("DX", NeedBand, -9, watched)))
if len(lines) == 0 || !strings.Contains(lines[0], "DX(watched band,-9 dB,r118)") {
t.Errorf("trace %v does not describe the station it called", lines)
}
}
func TestAStationCallingUsIsAnsweredEvenWithNothingToGain(t *testing.T) {
e := on()
// A QSO has just ended and two stations are calling us. Neither is worth
// anything to the log — and both are worth answering: they have heard us,
// they are waiting, and the contact is one over away.
weak := callsMe("WEAK", NeedNone, -18)
loud := callsMe("LOUD", NeedNone, -3)
a := e.OnPeriod(period(0, weak, loud))
if a.Kind != DoReply || a.Decode.Call != "LOUD" {
t.Fatalf("answered %+v, want the strongest of the stations calling us", a)
}
// A caller already worked on this band and mode is a duplicate, not a QSO.
e = on()
done := callsMe("DUPE", NeedNone, -1)
done.Worked = true
if a := e.OnPeriod(period(2, done)); a.Kind != DoNothing {
t.Errorf("answered a station already in the log on this band and mode: %+v", a)
}
// And one the operator halted stays halted, however politely it calls.
e = on()
e.OnPeriod(period(4, cq("STOP", NeedDXCC, -5)))
e.Halt()
if a := e.OnPeriod(period(6, callsMe("STOP", NeedDXCC, -5))); a.Kind != DoNothing {
t.Errorf("answered a station the operator had stopped: %+v", a)
}
// A needed station still comes first: a caller with nothing to gain is
// answered when nothing better is on the air, which is what was asked for.
e = on()
if a := e.OnPeriod(period(8, callsMe("CALLER", NeedNone, 0), cq("RARE", NeedDXCC, -20))); a.Decode.Call != "RARE" {
t.Errorf("picked %q, want the new entity ahead of a caller with nothing needed", a.Decode.Call)
}
}
// TestAStationWorkingSomebodyElseIsNotCHOSEN — the test above is about a target
// already being called; this is about picking one. A reply to a decode in
// mid-exchange is a reply WSJT-X and JTDX may refuse outright, so it never
// starts a call there.
func TestAStationWorkingSomebodyElseIsNotCHOSEN(t *testing.T) {
e := on()
busyNow := busy("ON7GB", NeedSlot, +5)
busyNow.Msg = "PY2SAD ON7GB JO21"
if a := e.OnPeriod(period(0, busyNow)); a.Kind == DoReply {
t.Fatalf("called %+v — it is in a QSO with PY2SAD", a)
}
if e.Target() != "" {
t.Errorf("target is %q", e.Target())
}
// Its final frame is different: one period from free is the best moment
// there is to be calling it.
last := busy("ON7GB", NeedSlot, +5)
last.Msg = "PY2SAD ON7GB RR73"
if a := e.OnPeriod(period(2, last)); a.Kind != DoReply {
t.Errorf("%+v — a station on its last frame was not called", a)
}
}
func TestAFinalFrameToSomebodyElseIsNotABusyTarget(t *testing.T) {
e := on()
e.OnPeriod(period(0, cq("DX", NeedSlot, 0)))
// Sending RR73 to another station: one period from being free, and the best
// moment there is to be calling it.
wrap := busy("DX", NeedSlot, 0)
wrap.Msg = "PY2SAD DX RR73"
if a := e.OnPeriod(period(2, wrap)); a.Kind != DoNothing || e.Target() != "DX" {
t.Errorf("dropped a station that was finishing: %+v (target %q)", a, e.Target())
}
}
func TestNothingHiddenByThePanelIsCalled(t *testing.T) {
e := New(Settings{Enabled: true, OnScreenOnly: true})
// The operator has filtered the list down to CQs: what is not on the screen
// is not called, whatever the log makes of it.
hidden := cq("RARE", NeedDXCC, 0)
hidden.Hidden = true
shown := cq("PLAIN", NeedSlot, -20)
if a := e.OnPeriod(period(0, hidden, shown)); a.Decode.Call != "PLAIN" {
t.Errorf("picked %q, want the station the panel is showing", a.Decode.Call)
}
// With the panel publishing nothing, nothing is hidden and the ladder
// decides alone.
e = New(Settings{Enabled: true, OnScreenOnly: true})
free := cq("RARE", NeedDXCC, 0)
if a := e.OnPeriod(period(2, free, shown)); a.Decode.Call != "RARE" {
t.Errorf("picked %q with no filtering in force, want the new entity", a.Decode.Call)
}
}
// MSHV answers two stations in one transmission and the decoder prints them as
// one line. Reported from the air: the DX was answering us in the second half
// and the engine, reading only the first, dropped it as busy.
func TestAMultiAnswerLineIsReadWhole(t *testing.T) {
fox := cq("HK0/PY8WW", NeedDXCC, -17, watched)
fox.CQ = false
fox.Msg = "YV5ALI RR73; " + me + " <HK0/PY8WW> -08"
if !callingUs(fox, me) {
t.Error("the second half is a report to us and was not read as one")
}
if !callable(fox, me) {
t.Error("a station answering us was judged uncallable")
}
// Held as the target, that line must not release it — it is the answer we
// were waiting for, not a station working somebody else.
e := on()
e.OnPeriod(period(0, cq("HK0/PY8WW", NeedDXCC, -17, watched)))
if a := e.OnPeriod(period(2, fox)); a.Kind != DoNothing || e.Target() != "HK0/PY8WW" {
t.Errorf("dropped the DX as it answered us: %+v (target %q)", a, e.Target())
}
// The exchange is under way, so the attempt counter has done its job.
if e.Status().Attempts != 0 {
t.Errorf("attempts = %d while in QSO, want 0", e.Status().Attempts)
}
// And its final frame to us, in the same shape, ends the QSO.
done := fox
done.Msg = "IK2ABC RR73; " + me + " <HK0/PY8WW> RR73"
if !finished([]Candidate{done}, "HK0/PY8WW", me) {
t.Error("a 73 to us inside a multi-answer line did not end the QSO")
}
}
// Reported from the air twice: the DX sends RR73, our own 73 is about to go
// out, and the engine answered somebody else in that very slot — two
// transmissions in one period, and the station at the other end never got the
// frame that closes the contact.
func TestTheSlotAfterAQSOBelongsToOur73(t *testing.T) {
e := on()
e.OnPeriod(period(0, cq("HP/WE9G", NeedDXCC, -6)))
bye := callsMe("HP/WE9G", NeedDXCC, -6)
bye.Msg = "<" + me + "> HP/WE9G RR73"
// A new band is decoding in the same period and is not called.
a := e.OnPeriod(period(2, bye, cq("GW8DX", NeedBand, +2)))
if a.Kind != DoNothing {
t.Fatalf("called %+v in the slot our 73 goes out in", a)
}
if !strings.Contains(a.Reason, "73") {
t.Errorf("reason %q does not say why the slot was left alone", a.Reason)
}
// It is still there fifteen seconds later, which is the whole cost.
if a := e.OnPeriod(period(4, cq("GW8DX", NeedBand, +2))); a.Kind != DoReply || a.Decode.Call != "GW8DX" {
t.Errorf("next period: %+v, want the new band called", a)
}
}
func TestABetterStationTakesOverBeforeAnybodyHasAnswered(t *testing.T) {
e := on()
e.OnPeriod(period(0, cq("PLAIN", NeedSlot, +10)))
// A watched station comes on the air: nothing has answered us yet, so the
// call in progress is worth less than the one now possible.
a := e.OnPeriod(period(2, cq("PLAIN", NeedSlot, +10), cq("WATCHED", NeedNone, -15, watched)))
if a.Kind != DoReply || a.Decode.Call != "WATCHED" {
t.Fatalf("%+v — a better station did not take over", a)
}
// Equal rungs do NOT take over while the station being called is on the air.
e = on()
e.OnPeriod(period(4, cq("A", NeedBand, 0)))
if a := e.OnPeriod(period(6, cq("A", NeedBand, 0), cq("B", NeedBand, +20))); a.Kind != DoNothing {
t.Errorf("%+v — swapped between two stations of equal value", a)
}
// But they do when it is absent: seven calls into the void while a station
// of the same value is calling CQ is what the operator was watching.
if a := e.OnPeriod(period(8, cq("B", NeedBand, +20))); a.Kind != DoReply || a.Decode.Call != "B" {
t.Errorf("%+v — kept calling a station that was not on the air", a)
}
// Once the station has answered, nothing takes its place.
e = on()
e.OnPeriod(period(10, cq("DX", NeedSlot, 0)))
e.OnPeriod(period(12, callsMe("DX", NeedSlot, 0)))
if a := e.OnPeriod(period(14, callsMe("DX", NeedSlot, 0), cq("RARE", NeedDXCC, 0, watched))); a.Kind != DoNothing {
t.Errorf("%+v — abandoned an exchange in progress", a)
}
}
// TestAnExchangeInProgressIsNeverAbandoned is the shack report: mid-QSO with
// V31MA — its report decoded, our RR73 going out — and a station of a higher
// rung called us from the other side of the screen. The engine switched.
func TestAnExchangeInProgressIsNeverAbandoned(t *testing.T) {
e := on()
// V31MA is worth nothing on the ladder: worked before, nothing needed.
if a := e.OnPeriod(period(0, callsMe("V31MA", NeedNone, -12))); a.Kind != DoReply {
t.Fatalf("%+v — a station calling us was not answered", a)
}
// Its report arrives in the same period a better station calls us. That
// period used to be judged before the reply was taken into account.
a := e.OnPeriod(period(2,
callsMe("V31MA", NeedNone, -12),
callsMe("F5NNN", NeedSlot, -10)))
if a.Kind != DoNothing {
t.Fatalf("%+v — left V31MA mid-exchange", a)
}
if e.target == nil || e.target.Call != "V31MA" {
t.Fatalf("target is %v — the QSO in progress lost its place", e.target)
}
// Our own transmission settles it too: a report is not an opening call, so
// even a QSO the operator started by hand is protected.
e = on()
e.OnPeriod(period(4, cq("V31MA", NeedNone, -12, watched)))
e.NoteTX(TXState{Transmitting: true, Msg: "V31MA F4BPO RR73"})
if !e.answered {
t.Error("sending a report did not count as being inside the exchange")
}
if a := e.OnPeriod(period(6, cq("V31MA", NeedNone, -12, watched), callsMe("F5NNN", NeedDXCC, -10))); a.Kind != DoNothing {
t.Errorf("%+v — abandoned a QSO we were in the middle of", a)
}
if e.attempts != 0 {
t.Errorf("attempts=%d — an exchange frame was counted as a call", e.attempts)
}
}
// TestAPileupIsWorkedByCallingThroughIt is the shack report: D44TWO finishing a
// contact, the call started, the DX coming back to somebody else — and the
// engine giving up on a station that was one period from being free.
func TestAPileupIsWorkedByCallingThroughIt(t *testing.T) {
e := on()
if a := e.OnPeriod(period(0, cq("D44TWO", NeedDXCC, -7))); a.Kind != DoReply {
t.Fatalf("%+v", a)
}
// It answers three other callers in a row — which is what a DX with a queue
// does, and calling through it is how the queue is joined.
does := func(n int) Action { return e.OnPeriod(period(n, busy("D44TWO", NeedDXCC, -7))) }
for _, n := range []int{2, 4, 6} {
if a := does(n); a.Kind != DoNothing {
t.Fatalf("%+v — stopped calling a station working the pileup", a)
}
if e.Target() != "D44TWO" {
t.Fatalf("target is %q — the station was released while it worked others", e.Target())
}
}
// And when it comes to us, the exchange starts as usual.
if a := e.OnPeriod(period(8, callsMe("D44TWO", NeedDXCC, -7))); a.Kind != DoNothing {
t.Errorf("%+v", a)
}
if !e.answered {
t.Error("the reply was not taken as the start of the exchange")
}
// A BETTER station may still take the slot while it is busy: nothing has
// been answered, so nothing is lost by moving.
e = on()
e.OnPeriod(period(10, cq("D44TWO", NeedSlot, -7)))
if a := e.OnPeriod(period(12, busy("D44TWO", NeedSlot, -7), cq("RARE", NeedDXCC, -20, watched))); a.Kind != DoReply || a.Decode.Call != "RARE" {
t.Errorf("%+v — a watched new one did not take the slot from a busy station", a)
}
}
// TestTheFirstCallStartsWithNoMisses is the shack report: a CQ answered for the
// first time, and the toolbar already reading two misses out of three.
func TestTheFirstCallStartsWithNoMisses(t *testing.T) {
e := on()
// It calls CQ on an odd slot; we answer.
if a := e.OnPeriod(period(1, cq("ER1CW", NeedBand, -2))); a.Kind != DoReply {
t.Fatalf("%+v", a)
}
// The next period is OURS: we are transmitting to it, and of course it is
// not decoded. That is not a miss.
pp := period(2)
pp.TX = TXState{Transmitting: true}
e.OnPeriod(pp)
if e.misses != 0 {
t.Fatalf("misses=%d after our own transmit period", e.misses)
}
// Nor is a period of the wrong parity with nothing in it.
e.OnPeriod(period(4))
if e.misses != 0 {
t.Fatalf("misses=%d — counted a period the station never transmits in", e.misses)
}
// ITS period, and it is not there: that is a miss.
e.OnPeriod(period(3))
if e.misses != 1 {
t.Fatalf("misses=%d — the station's own silent period was not counted", e.misses)
}
}
// Parking answers "it will not answer, stop wasting the evening on it" — which
// is a verdict about a station the LOG picked out, not about one the OPERATOR
// did. From the air: a watched ZD8GB, six streams a period, refused for the
// rest of the session after two series of unanswered calls.
func TestAWatchedCallsignIsNeverParked(t *testing.T) {
spent := func(c Candidate) *Engine {
e := New(Settings{Enabled: true, MaxRounds: 2})
e.OnPeriod(period(0)) // the engine's clock, so the rest below is period time
for i := 0; i < 2; i++ {
e.giveUp(strings.ToUpper(c.Call), c) // a series ended by a brake
}
return e
}
// Period 8, well past the rest that follows a series: what is left is the
// parking, and only the parking.
plain := cq("PLAIN", NeedDXCC, 0)
if a := spent(plain).OnPeriod(period(8, plain)); a.Kind == DoReply {
t.Errorf("%+v — a station whose series are spent was called again", a)
}
dx := cq("ZD8GB", NeedDXCC, 0, watched)
if a := spent(dx).OnPeriod(period(8, dx)); a.Kind != DoReply {
t.Errorf("%+v — a watched DXpedition was parked for the session", a)
}
}
// A period is judged more than once — the decodes arrive in a burst and
// stragglers follow — and a later judgement of it holds a partial view, not
// evidence that the station has gone. From the air: D2ACE answered in the very
// period the counter then read as a miss.
func TestAPeriodTheTargetWasSeenInIsNeverAMiss(t *testing.T) {
e := on()
if a := e.OnPeriod(period(1, cq("D2ACE", NeedBand, 13))); a.Kind != DoReply {
t.Fatalf("%+v", a)
}
// Its own next period: decoded, so the exchange is under way.
p := period(3, callsMe("D2ACE", NeedBand, 13))
e.OnPeriod(p)
if e.Status().Misses != 0 {
t.Fatalf("misses=%d after being decoded", e.Status().Misses)
}
// The same period again, this time from a flush that carries only the
// stragglers — the target is not among them.
e.OnPeriod(period(3))
if got := e.Status().Misses; got != 0 {
t.Errorf("misses=%d — a second flush of a period it was seen in counted against it", got)
}
}
+30
View File
@@ -60,3 +60,33 @@ func TestIcomSilenceBackoff(t *testing.T) {
t.Errorf("backoff overshot the ceiling: %s", g)
}
}
// A new session must not be judged on the previous one's silence.
//
// From an operator's log: a rig switched to standby, then a dial-and-drop loop
// every forty seconds for as long as it was left there. lastGoodAt bounds "the
// link answers but no CI-V comes back"; it belongs to a session, and it was
// never cleared when a new one opened, so every fresh session started already
// past the grace — and the Icom console, where the power-ON button lives,
// blinked away on every pass.
func TestAFreshSessionStartsWithACleanSilenceClock(t *testing.T) {
b := &IcomSerial{
lastGoodAt: time.Now().Add(-30 * time.Minute), // a session from before standby
readFails: 9,
silentGrace: icomSilentGraceMax,
}
// What Connect does once the transport is open, before anything is sent.
b.lastGoodAt = time.Time{}
b.readFails = 0
b.silentGrace = icomSilentGrace
if !b.lastGoodAt.IsZero() {
t.Fatal("the previous session's last good read survived into this one")
}
tolerate := func(lastGood time.Time, silentFor, grace time.Duration) bool {
return lastGood.IsZero() || silentFor < grace
}
if !tolerate(b.lastGoodAt, time.Hour, b.silentGrace) {
t.Error("a session silent since connect was torn down — that is a rig in standby, and where the ON button has to work")
}
}
+15 -1
View File
@@ -67,12 +67,26 @@ type icomAudio struct {
txOuter uint16
txSend uint16
lastRx atomic.Int64 // UnixNano of last packet (liveness)
rxCount atomic.Int64 // packets delivered on this stream
done chan struct{}
closeOnce sync.Once
}
func (a *icomAudio) markRx() { a.lastRx.Store(time.Now().UnixNano()) }
func (a *icomAudio) markRx() {
a.lastRx.Store(time.Now().UnixNano())
a.rxCount.Add(1)
}
// packets reports whether the stream is actually delivering — the difference
// between "audio is on" and "audio is arriving", which is what makes it worth
// naming as a suspect when CI-V has gone quiet on the same session.
func (a *icomAudio) packets() int64 {
if a == nil {
return 0
}
return a.rxCount.Load()
}
// Close tears the audio stream down (disconnect a few times; UDP is lossy).
func (a *icomAudio) Close() {
+79 -4
View File
@@ -43,7 +43,7 @@ var icnBE = binary.BigEndian
// = CI-V only (the proven default). The audio stream is fully separate from CAT,
// so enabling it can't affect freq/mode/DSP control.
func NewIcomNet(host, user, pass string, civAddr int, digitalDefault string, audioSink func([]byte)) *IcomSerial {
if civAddr <= 0 || civAddr > 0xFF {
if civAddr < 0 || civAddr > 0xFF {
civAddr = 0x98 // IC-7610
}
if digitalDefault == "" {
@@ -132,6 +132,13 @@ type icomNet struct {
// loop, not the rig — and RS-BA1 showing no such dropouts points that way.
txCiv atomic.Uint32
txAtData atomic.Uint32
// WHAT was asked, not just how much. A rig that answers at connect and then
// never again has usually been sent something it does not like, and counting
// the unanswered commands says nothing about which one that was. The last few
// command headers are kept so the silence report can name them — the only way
// to find a poison command on a radio nobody here has.
cmdMu sync.Mutex
lastCmd []string
rx chan []byte // CI-V byte chunks from civPump → Read (control replies)
scopeRx chan []byte // scope (0x27) frames, kept off rx so the panadapter
@@ -268,6 +275,7 @@ func (n *icomNet) Write(p []byte) (int, error) {
n.vCivSeq++
n.seqMu.Unlock()
n.txCiv.Add(1)
n.noteCmd(p)
pkt := icnCivData(seq, n.vID, n.vRemote, civSeq, p)
n.sentMu.Lock()
n.sentBuf[seq] = pkt
@@ -280,6 +288,35 @@ func (n *icomNet) Write(p []byte) (int, error) {
return len(p), nil
}
// noteCmd remembers the command bytes of a CI-V frame — everything after the
// preamble and the two addresses, up to four bytes, which is command,
// sub-command and the first of the data.
func (n *icomNet) noteCmd(p []byte) {
if len(p) < 5 {
return
}
body := p[4:]
if len(body) > 4 {
body = body[:4]
}
n.cmdMu.Lock()
n.lastCmd = append(n.lastCmd, fmt.Sprintf("% X", body))
if len(n.lastCmd) > 8 {
n.lastCmd = n.lastCmd[len(n.lastCmd)-8:]
}
n.cmdMu.Unlock()
}
// recentCmds is what noteCmd collected, oldest first.
func (n *icomNet) recentCmds() string {
n.cmdMu.Lock()
defer n.cmdMu.Unlock()
if len(n.lastCmd) == 0 {
return "none"
}
return strings.Join(n.lastCmd, " | ")
}
// icnTrace toggles verbose per-frame CI-V request/reply logging for diagnosing
// the network transport. Off by default (the connect-step logs stay); flip to
// true to trace every TX/RX again.
@@ -496,6 +533,18 @@ func (n *icomNet) civPump() {
}
debugLog.Printf("icom net: no CI-V DATA for 10 s (transport last heard %s ago; last scope frame %s ago; last socket error: %v; missing-seq backlog: %d; CI-V commands SENT since the last answer: %d)",
time.Since(lastPkt).Round(time.Second), scopeAge, lastErr, len(n.rxMissing), n.txCiv.Load()-n.txAtData.Load())
debugLog.Printf("icom net: the last CI-V commands sent, oldest first: %s", n.recentCmds())
// THE AUDIO STREAM IS THE FIRST SUSPECT, AND ONLY THE LOG CAN SAY SO.
//
// The RX audio stream is experimental and shares the rig's session with
// CI-V. The shape seen in the field is exactly this one: audio packets
// arriving by the hundred while not one CI-V reply comes back, the
// watchdog tearing the session down, and the whole thing beginning
// again — a loop an operator reads as "the Icom keeps disconnecting",
// with nothing pointing at the switch that would end it.
if n.audio != nil && n.audio.packets() > 0 {
debugLog.Printf("icom net: the RX audio stream is running and still delivering while CI-V has gone quiet — that option is experimental and shares this session. If the drops continue, turn OFF \"Stream RX audio over the network\" in Settings → CAT and see whether control steadies.")
}
// And try the gentle repair before the 30 s watchdog tears the whole
// session down: if the rig quietly closed the CI-V data flow (the
// transport is still chatting, so the session itself stands), saying
@@ -808,20 +857,46 @@ func dialIcomNet(host, user, pass, compName string, rigAddr byte, cancel <-chan
n.vTracked++
n.vCivSeq++
go n.ctrlPump()
go n.civPump()
// Optional RX audio stream (50003). The rig was told (conninfo rxEnable=1) to
// stream audio; open the socket + handshake now. A failure here is NON-fatal:
// CAT works without audio, so we log and continue rather than tear down a
// perfectly good control/CI-V session.
//
// BEFORE the pumps start, because the conninfo below touches the control-
// stream auth state, and after ctrlPump is running that state belongs to it.
if wantAudio {
if a, err := dialIcomAudio(host, audioSink, cancel); err != nil {
debugLog.Printf("icom net: audio stream FAILED (CAT unaffected): %v", err)
} else {
n.audio = a
// AND THE CONNINFO AGAIN, NOW THAT SOMEBODY IS LISTENING ON 50003.
//
// The first one goes out during the login, before this socket exists —
// it has to, since it is what authorises the stream. So the rig is told
// to send audio to a port nothing is bound to yet, and what comes back
// is an ICMP port-unreachable; it then backs off, and the audio appears
// only when its own retry timer comes round. An operator timed that at
// twenty to thirty seconds of silence after switching the speakers on,
// and one log here shows a minute and a half.
//
// Re-sent once the port is open, so the rig starts streaming into a
// socket that is ready for it. Idempotent — the same message the session
// already carries, which is why RS-BA1 repeats it too.
pkt := icnConnInfo(n.cTracked, n.cAuthSeq, n.cTokReq, n.cID, n.cRemote, n.cToken, user, rigMAC, 50002, 50003, 0x01)
n.cSentBuf[n.cTracked] = pkt
n.cTracked++
n.cAuthSeq++
if _, err := ctrl.Write(pkt); err != nil {
debugLog.Printf("icom net: could not re-send the conninfo after opening the audio port: %v", err)
} else {
debugLog.Printf("icom net: conninfo re-sent now that :50003 is listening — the rig can start the audio at once")
}
}
}
go n.ctrlPump()
go n.civPump()
return n, nil
}
+18 -2
View File
@@ -172,12 +172,13 @@ const (
)
// NewIcomSerial builds an (unconnected) Icom serial backend. baud defaults to
// 115200, rig address to the IC-7610's 0x98 when out of range.
// 115200, rig address to the IC-7610's 0x98 when out of range — and 0x00 is in
// range: it is a valid CI-V address that some rigs and interfaces are set to.
func NewIcomSerial(portName string, baud, civAddr int, digitalDefault string) *IcomSerial {
if baud <= 0 {
baud = 115200
}
if civAddr <= 0 || civAddr > 0xFF {
if civAddr < 0 || civAddr > 0xFF {
civAddr = 0x98 // IC-7610
}
if digitalDefault == "" {
@@ -231,6 +232,21 @@ func (b *IcomSerial) Connect() error {
_ = port.SetRTS(false)
b.port = port
b.model = civ.ModelName(b.rigAddr)
// A NEW SESSION IS NOT JUDGED ON THE OLD ONE'S SILENCE.
//
// lastGoodAt bounds "the control link answers but no CI-V comes back". It
// belongs to a session, and it was never cleared when a new one opened —
// so a rig that went to standby half an hour ago handed every fresh session
// a half-hour-old "last good read", which is past the grace before the first
// command is even sent. The session was torn down at once, redialled twenty
// seconds later, and torn down again: a loop with no way out, and the Icom
// console (with its power-ON button) blinking away on every pass.
//
// Cleared, the rule reads as it was written: silent since connect is a rig in
// standby, and the session is kept so the operator can wake it.
b.lastGoodAt = time.Time{}
b.readFails = 0
b.silentGrace = icomSilentGrace
// Start the reader before any request: recv() now waits on respCh, which only
// the reader feeds. respCh is buffered so a burst (or the scope stream) never
+79
View File
@@ -0,0 +1,79 @@
package extsvc
import (
"fmt"
"strings"
)
// Configured reports what a service still needs before it can be uploaded to.
//
// It exists so the answer lives NEXT TO THE UPLOADERS that enforce it. Written
// once in the app instead, it drifted immediately: Club Log was refused for a
// missing API key, which nobody has ever set — OpsLog carries its own
// application key (see clublogAppAPIKey) and the account is an email, a password
// and the logbook callsign. An operator whose live upload had been working for
// months was told his service was not configured.
//
// Each case mirrors the guard at the top of the matching Upload* function. It
// answers "can this be attempted", not "are these credentials right": only the
// service can say that, and it says it by refusing the upload.
func Configured(svc Service, cfg ExternalServices) error {
missing := func(service string, fields ...string) error {
return fmt.Errorf("%s is not configured — %s", service, strings.Join(fields, ", "))
}
set := func(v string) bool { return strings.TrimSpace(v) != "" }
var need []string
add := func(ok bool, what string) {
if !ok {
need = append(need, what)
}
}
switch svc {
case ServiceQRZ:
add(set(cfg.QRZ.APIKey), "the logbook API key")
if len(need) > 0 {
return missing("QRZ.com", need...)
}
case ServiceClublog:
// No API key: OpsLog's own application key is embedded.
add(set(cfg.Clublog.Email), "the account email")
add(set(cfg.Clublog.Password), "the password")
add(set(cfg.Clublog.Callsign), "the logbook callsign")
if len(need) > 0 {
return missing("Club Log", need...)
}
case ServiceHRDLog:
add(set(cfg.HRDLog.Callsign), "the station callsign")
add(set(cfg.HRDLog.Code), "the upload code")
if len(need) > 0 {
return missing("HRDLog.net", need...)
}
case ServiceEQSL:
add(set(cfg.EQSL.Username), "the username (callsign)")
add(set(cfg.EQSL.Password), "the password")
if len(need) > 0 {
return missing("eQSL.cc", need...)
}
case ServiceHamQTH:
add(set(cfg.HamQTH.Username), "the username")
add(set(cfg.HamQTH.Password), "the password")
if len(need) > 0 {
return missing("HamQTH", need...)
}
case ServiceCloudlog:
add(set(cfg.Cloudlog.URL), "the instance URL")
add(set(cfg.Cloudlog.APIKey), "the API key")
add(set(cfg.Cloudlog.StationID), "the station profile")
if len(need) > 0 {
return missing("Cloudlog / Wavelog", need...)
}
case ServiceLoTW:
add(set(cfg.LoTW.TQSLPath), "the path to tqsl.exe")
add(set(cfg.LoTW.StationLocation), "the TQSL station location")
if len(need) > 0 {
return missing("LoTW", need...)
}
}
return nil
}
+55 -2
View File
@@ -395,6 +395,47 @@ func titleCase(s string) string {
// lives, and keeps the ones that say WHO they are — name, address, QSL route.
// A portable operator's cards still go to the home address, so that address is
// not wrong; their county is.
// sameEntityName reports whether two country names denote the same entity.
//
// The two come from different vocabularies — the callbook writes "Germany"
// where cty.dat writes "Fed. Rep. of Germany", "United States" where the ADIF
// list says "United States of America" — so they are compared on their
// significant words with the boilerplate of officialdom removed, and one
// containing the other counts as a match.
//
// Deliberately generous. Getting it wrong in the strict direction discards a
// correct grid, which is the fault this exists to fix; getting it wrong in the
// generous direction keeps a location from a neighbouring entity, which is the
// state of every callbook record that has no page for the portable call anyway.
func sameEntityName(a, b string) bool {
na, nb := entityKey(a), entityKey(b)
if na == "" || nb == "" {
return false
}
return na == nb || strings.Contains(na, nb) || strings.Contains(nb, na)
}
var entityNoise = map[string]bool{
"THE": true, "OF": true, "FED": true, "REP": true, "REPUBLIC": true,
"FEDERAL": true, "FEDERATION": true, "DEM": true, "DEMOCRATIC": true,
"STATE": true, "KINGDOM": true, "AMERICA": true,
}
// entityKey reduces a country name to its significant letters.
func entityKey(s string) string {
s = strings.ToUpper(strings.TrimSpace(s))
var b strings.Builder
for _, tok := range strings.FieldsFunc(s, func(r rune) bool {
return r == ' ' || r == '.' || r == ',' || r == '-'
}) {
if entityNoise[tok] {
continue
}
b.WriteString(tok)
}
return b.String()
}
func clearHomeLocation(r *Result) {
r.Country, r.Continent = "", ""
r.CQZ, r.ITUZ, r.DXCC = 0, 0, 0
@@ -430,11 +471,23 @@ func fillFromDXCC(r *Result, dxcc DXCCResolver) bool {
//
// Same-entity portables (F4BPO/P, W2RE/2) are untouched: the entities match,
// and there the home details ARE where the operator is.
// UNLESS THE RECORD IS ABOUT THE OPERATION ITSELF.
//
// Some compound calls have a callbook page of their own, filed under the
// slashed form and describing where the station actually is: QRZ's HP/WE9G
// carries Altos del Maria, Panama, square EJ98xq. Clearing that threw away
// the one field the lookup existed to find, and the QSO was logged with no
// grid at all while the page plainly showed one.
//
// The record's OWN country is what tells the two apart: a page for the
// operation names the entity being operated from, a home page names home.
if dxccNum != 0 && strings.ContainsRune(r.Callsign, '/') && !saysNothingAboutLocation(r.Callsign) {
if home := homeCall(r.Callsign); home != "" && home != r.Callsign {
if homeNum, _, _, _, _, _, _, homeOK := dxcc.Resolve(home); homeOK && homeNum != 0 && homeNum != dxccNum {
clearHomeLocation(r)
filled = true
if !sameEntityName(r.Country, country) {
clearHomeLocation(r)
filled = true
}
}
}
}
+57
View File
@@ -91,3 +91,60 @@ func TestSameEntityPortableKeepsItsLocation(t *testing.T) {
t.Errorf("lat/lon = %v/%v — the precise home position was replaced by the entity centroid", r.Lat, r.Lon)
}
}
// The other half again, and the one an operator reported: a compound call with
// a callbook page OF ITS OWN. QRZ files HP/WE9G under that exact form, with the
// Panama address and square the station is actually operating from — and the
// QSO was being logged with no grid at all while the page plainly showed one.
func TestACompoundCallWithItsOwnPageKeepsThatPagesLocation(t *testing.T) {
dxcc := testDXCC()
dxcc["HP/WE9G"] = struct {
num int
country string
cont string
cqz, ituz int
lat, lon float64
}{num: 88, country: "Panama", cont: "NA", cqz: 7, ituz: 11, lat: 8.5, lon: -80.0}
dxcc["WE9G"] = struct {
num int
country string
cont string
cqz, ituz int
lat, lon float64
}{num: 291, country: "United States", cont: "NA", cqz: 5, ituz: 8, lat: 39.8, lon: -98.5}
r := Result{
Callsign: "HP/WE9G",
Name: "Richard B",
Country: "Panama", // the RECORD's own country: this page is the operation
Grid: "EJ98xq",
Lat: 8.686667, Lon: -80.043333,
}
fillFromDXCC(&r, dxcc)
if r.Grid != "EJ98xq" {
t.Errorf("grid = %q, want EJ98xq — the page describes the operation, not a home address", r.Grid)
}
if r.Lat != 8.686667 || r.Lon != -80.043333 {
t.Errorf("lat/lon = %v/%v — the station's own position was replaced by the entity centroid", r.Lat, r.Lon)
}
}
func TestSameEntityNameAcrossVocabularies(t *testing.T) {
same := [][2]string{
{"Germany", "Fed. Rep. of Germany"},
{"United States", "United States of America"},
{"Panama", "Panama"},
{"Kosovo", "Republic of Kosovo"},
}
for _, p := range same {
if !sameEntityName(p[0], p[1]) {
t.Errorf("%q and %q read as different entities", p[0], p[1])
}
}
for _, p := range [][2]string{{"Costa Rica", "United States"}, {"France", "Belgium"}, {"", "Panama"}} {
if sameEntityName(p[0], p[1]) {
t.Errorf("%q and %q read as the same entity", p[0], p[1])
}
}
}
+7
View File
@@ -319,6 +319,12 @@ type Status struct {
LastErr string `json:"last_err,omitempty"`
Broker string `json:"broker"`
Bands []string `json:"bands"`
// What the feed is actually filtered on, so a panel showing nothing can say
// WHY instead of leaving the operator to guess: the radius in force, and how
// many receiver squares it came to. A radius raised in Preferences that
// never reached the subscription is invisible without these two.
NearKm int `json:"near_km"`
Squares int `json:"squares"`
}
func (w *Watcher) Status() Status {
@@ -327,6 +333,7 @@ func (w *Watcher) Status() Status {
st := Status{
Running: w.running, Received: w.received, LastAt: w.lastAt,
LastErr: w.lastErr, Broker: w.cfg.Broker,
NearKm: w.cfg.NearKm, Squares: len(w.cfg.RxGrids),
}
st.Bands = append(st.Bands, w.cfg.Bands...)
return st
+104 -31
View File
@@ -62,6 +62,12 @@ const (
// whether it is worth calling at all.
pileupWindow = 2 * time.Minute
// backfillEvery is how often the history query is asked again for a target
// that is still being watched. Five minutes is PSK Reporter's own courtesy
// interval for repeating a query, and it happens to be the period most
// uploaders batch on.
backfillEvery = 5 * time.Minute
// The passband histogram: 60 Hz bins from 200 Hz to 4000 Hz. Above 4 kHz
// there is essentially no FT8, and drawing the empty space made the strip
// look broken rather than empty.
@@ -202,10 +208,12 @@ type Watcher struct {
subs []string
spots []spot
// backfilled remembers the target the REST history was fetched for, so the
// panel's polling cannot re-fetch it every second. PSK Reporter's query API
// answers that with a rate limit, and rightly.
backfilled string
// backfilled remembers the target the REST history was fetched for and when,
// so the panel's polling cannot re-fetch it every second PSK Reporter's
// query API answers that with a rate limit, and rightly — while a target
// held for a while still gets a fresh look every few minutes.
backfilled string
backfilledAt time.Time
}
func New(cfg Config) *Watcher {
@@ -271,27 +279,46 @@ func (w *Watcher) Watch(target, mode string, dialHz int64) error {
return nil
}
w.mu.Lock()
// The window belongs to the target it was collected for. Keeping it across a
// change would answer the new question with the old station's evidence.
if changed {
w.spots = w.spots[:0]
w.dropWindowOfPreviousTarget()
}
w.mu.Unlock()
if err := w.resubscribe(client); err != nil {
return err
}
if changed && w.cfg.Scope == ScopeTarget {
// Under the band-wide subscription the window is already full of the new
// target's reports; under the narrow one it is empty, and the REST query
// is what makes the panel useful in the first fifteen seconds instead of
// after five minutes.
if changed {
// In BOTH scopes. The band-wide subscription was assumed to arrive with
// the target's reports already in the window — true only once it has been
// running a while, and false in the case that matters: the operator picks
// a station a minute after opening the panel and sees one decode where
// another program, running for an hour, shows four.
go w.backfill(target, mode)
}
return nil
}
// dropWindowOfPreviousTarget empties the collected window when it belonged to
// the station being left behind.
//
// WHOSE WINDOW IS IT? Under the narrow scope the subscription IS the target —
// three filters about one station — so the window is his, and keeping it across
// a change would answer the new question with the old station's evidence.
//
// Under the band-wide scope it is the BAND's: every FTx report on it, filtered
// by target only when the analysis is drawn. Clearing it there threw away an
// hour of accumulated evidence on every click, and a panel that had been showing
// hundreds of reports read zero — the operator clicking a decode to ask "can he
// hear me" is the very moment that history is worth something, and it was being
// deleted in order to answer the question.
func (w *Watcher) dropWindowOfPreviousTarget() {
w.mu.Lock()
defer w.mu.Unlock()
if w.cfg.Scope == ScopeBand {
return
}
w.spots = w.spots[:0]
}
// resubscribe replaces every filter with the ones the current target and scope
// want. Takes the old ones down first: a target change that only ADDED filters
// would leave the previous station's reports arriving for ever.
@@ -377,7 +404,7 @@ func (w *Watcher) connect() (mqtt.Client, error) {
if err := w.resubscribe(c); err != nil {
w.cfg.Logf("pskr target: %v", err)
}
if target != "" && w.cfg.Scope == ScopeTarget {
if target != "" {
go w.backfill(target, mode)
}
}
@@ -449,7 +476,15 @@ func (w *Watcher) SetOperator(call, grid string) {
// Snapshot recomputes the analysis from the window.
func (w *Watcher) Snapshot() Analysis {
// Due another look at the history? Checked here because this is what the
// panel calls every second; the query itself is rate-limited inside
// backfill, so this cannot turn into a request per poll.
w.mu.Lock()
if t, m := w.target, w.mode; t != "" && time.Since(w.backfilledAt) >= backfillEvery {
w.mu.Unlock()
go w.backfill(t, m)
w.mu.Lock()
}
defer w.mu.Unlock()
now := time.Now()
@@ -633,34 +668,42 @@ func top(m map[string]Entry, limit int) []Entry {
return out
}
// suggestOffset picks an audio slot to call on: the middle of the widest run of
// empty bins below the ceiling.
// suggestOffset picks an audio slot to call on.
//
// Below the CEILING, not below 4000 Hz. The ceiling is the highest offset he
// has actually decoded, and it is the only evidence available about how wide
// his receiver is set — plenty of stations run 2500 Hz. Suggesting 3400 Hz to
// somebody whose passband stops at 2700 is advice to transmit into a filter.
//
// Two passes, and the second is the one that matters on a busy DX. Looking for
// an empty run alone answered "nowhere" exactly when the answer was most
// wanted: a hundred decodes across a 2800 Hz passband leave no run of clear
// bins at all, and the panel drew a full histogram with no advice under it.
// Failing a real gap, the quietest slot is still better than the one the
// operator would have picked by eye.
func suggestOffset(bins []Bin, ceiling int) int {
if ceiling < 1000 {
return 0
}
used := map[int]bool{}
count := make(map[int]int, len(bins))
busy := make(map[int]bool, len(bins)*3)
for _, b := range bins {
count[b.OffsetHz] = b.Count
if b.Count > 0 {
used[b.OffsetHz] = true
// The neighbours too: FT8 is 50 Hz wide and the bins are 60, so a
// signal on a bin edge covers the next one as surely as its own.
used[b.OffsetHz-binHz] = true
used[b.OffsetHz+binHz] = true
busy[b.OffsetHz], busy[b.OffsetHz-binHz], busy[b.OffsetHz+binHz] = true, true, true
}
}
bestStart, bestLen := -1, 0
start, run := -1, 0
// From 1000 Hz up: below that is where every default transmit offset sits,
// so it is the most crowded part of the passband and the least useful
// advice.
for edge := 1020; edge+binHz <= ceiling; edge += binHz {
if used[edge] {
// so it is the most crowded part of the passband and the least useful advice.
const low = 1020
high := (ceiling / binHz) * binHz
// Pass 1 — the widest clear run, and call from its middle.
bestStart, bestLen, start, run := -1, 0, -1, 0
for edge := low; edge <= high; edge += binHz {
if busy[edge] {
start, run = -1, 0
continue
}
@@ -672,10 +715,32 @@ func suggestOffset(bins []Bin, ceiling int) int {
bestStart, bestLen = start, run
}
}
if bestStart < 0 || bestLen < 2 {
if bestStart >= 0 && bestLen >= 2 {
return bestStart + bestLen*binHz/2
}
// Pass 2 — no clear run: the least busy slot. Walked from the top down, so
// a tie goes to the higher offset, which is the less crowded half of any
// passband and the half a pile-up leaves alone.
quietest, fewest := -1, 1<<30
for edge := high; edge >= low; edge -= binHz {
if c := count[edge]; c < fewest {
quietest, fewest = edge, c
}
}
if quietest < 0 {
return 0
}
return bestStart + bestLen*binHz/2
// Never past the ceiling: the top bin CONTAINS it, so its middle can sit
// beyond the highest offset he has been shown to decode — which is the one
// thing this function exists to avoid.
if quietest+binHz/2 > ceiling {
quietest -= binHz
}
if quietest < low {
return 0
}
return quietest + binHz/2
}
// bandTag names the band a dial frequency is on, in PSK Reporter's own
@@ -755,11 +820,19 @@ type pskrReports struct {
// is what gets an application rate-limited off the service for everyone.
func (w *Watcher) backfill(target, mode string) {
w.mu.Lock()
if w.backfilled == target {
// Once per target, then no more often than the refresh interval.
//
// The live feed alone lags by design: PSK Reporter's uploaders batch their
// reports, most of them every five minutes, so between two batches the
// window only holds what happened to have been sent. Asking the history
// again at that same cadence keeps it as full as a program that has been
// subscribed for an hour — which is the whole of the difference an operator
// sees when comparing the two side by side.
if w.backfilled == target && time.Since(w.backfilledAt) < backfillEvery {
w.mu.Unlock()
return
}
w.backfilled = target
w.backfilled, w.backfilledAt = target, time.Now()
w.mu.Unlock()
got := 0
+51 -4
View File
@@ -99,10 +99,12 @@ func TestSuggestOffsetAvoidsTheOccupiedBinsAndTheCeiling(t *testing.T) {
if got < 1620 || got > 2340 {
t.Errorf("suggested %d Hz, want somewhere in the empty 1560-2400 run", got)
}
// A passband that stops low must not produce advice above it: transmitting
// past the DX's filter is the one outcome worse than picking a busy slot.
if got := suggestOffset(bins, 1500); got != 0 {
t.Errorf("suggested %d Hz with a 1500 Hz ceiling and no room, want none", got)
// A passband with no gap at all still gets an answer — the quietest slot,
// which is what an operator would look for by eye. What it must never do is
// advise ABOVE the ceiling: transmitting past the DX's filter is the one
// outcome worse than picking a busy slot.
if got := suggestOffset(bins, 1500); got <= 1000 || got > 1500 {
t.Errorf("suggested %d Hz with a full 1500 Hz passband, want a slot inside it", got)
}
if got := suggestOffset(nil, 0); got != 0 {
t.Errorf("suggested %d Hz with no data at all, want none", got)
@@ -132,3 +134,48 @@ func TestTopicsFollowTheScope(t *testing.T) {
t.Errorf("band scope = %v, want the one band-wide filter", got)
}
}
// The case reported from the air: a busy DX, 103 decodes across a 2805 Hz
// passband, and the panel drew the whole histogram with no advice under it.
func TestACrowdedPassbandStillGetsAnAnswer(t *testing.T) {
// Every bin from 1020 to 2800 occupied — no clear run anywhere, and the
// quietest slot is the answer.
bins := []Bin{}
for hz := 1020; hz <= 2760; hz += binHz {
n := 5
if hz == 2400 { // one slot noticeably quieter than the rest
n = 1
}
bins = append(bins, Bin{OffsetHz: hz, Count: n})
}
got := suggestOffset(bins, 2805)
if got == 0 {
t.Fatal("no advice on a full passband — this is exactly when it is wanted")
}
if got < 2400 || got > 2460 {
t.Errorf("suggested %d Hz, want the quietest slot around 2400", got)
}
}
// Under the band-wide scope the window is the BAND's, not the target's: it is
// every FTx report on it, filtered by target only when the analysis is drawn.
// Clearing it on a target change threw away an hour of accumulated evidence at
// the exact moment it was worth something — the operator clicking a decode to
// ask "can he hear me" saw the report count drop to zero.
func TestBandScopeKeepsItsWindowAcrossATargetChange(t *testing.T) {
for _, tc := range []struct {
scope Scope
keep bool
}{{ScopeBand, true}, {ScopeTarget, false}} {
w := &Watcher{cfg: Config{Scope: tc.scope, Logf: func(string, ...any) {}}}
w.target, w.mode = "OLD", "FT8"
w.spots = []spot{{TxCall: "OLD", RxCall: "F4BPO", at: time.Now()}}
w.dropWindowOfPreviousTarget()
w.target = "NEW"
if got := len(w.spots) > 0; got != tc.keep {
t.Errorf("%s scope: window kept = %v, want %v", tc.scope, got, tc.keep)
}
}
}
+41
View File
@@ -0,0 +1,41 @@
package steppir
import (
"testing"
"time"
)
// The controller says nothing until its own poll comes round, so a move has to
// be reported from the moment it is COMMANDED. Without it the app's "block TX
// while the elements travel" had a hole: the grace covering the command ran out
// before the first poll that would have seen the movement, and the transmitter
// was released in the middle of a move.
func TestAJustCommandedMoveReportsMotion(t *testing.T) {
c := &Client{}
c.lastStatus = &Status{Connected: true} // idle, as the controller last said
if st, _ := c.GetStatus(); st.MotorsMoving != 0 {
t.Fatal("an idle antenna reports motion")
}
c.statusMu.Lock()
c.moveCmdAt = time.Now()
c.statusMu.Unlock()
st, _ := c.GetStatus()
if st.MotorsMoving == 0 {
t.Error("a move commanded a moment ago is not reported as motion")
}
if c.lastStatus.MotorsMoving != 0 {
t.Error("the optimistic flag leaked into the cached status the poll owns")
}
// Bounded: an antenna that never reports motion must not latch the transmit
// inhibit on for ever.
c.statusMu.Lock()
c.moveCmdAt = time.Now().Add(-moveOptimisticWindow - time.Second)
c.statusMu.Unlock()
if st, _ := c.GetStatus(); st.MotorsMoving != 0 {
t.Error("the optimistic window never expires")
}
}
+57 -2
View File
@@ -65,6 +65,25 @@ const (
// self-corrects instead of lying forever.
const pendingDirTTL = 45 * time.Second
// The same two cadences the Ultrabeam uses, and for the same reason: transmit
// is inhibited while the elements travel, so every poll interval between the
// motors stopping and this client noticing is a second the operator cannot call
// with the antenna already in place.
const (
pollIdle = 2 * time.Second
pollMoving = 250 * time.Millisecond
)
// moveOptimisticWindow is how long after a commanded move GetStatus reports
// motion before the controller has had a chance to say so.
//
// The SteppIR reports nothing until its own poll comes round, so without this
// the app's "block TX while moving" had a hole in it: the grace that covers the
// command ran out before the first poll that would have seen the movement, and
// the transmitter was released in the middle of a move. Bounded, so an antenna
// that never reports motion cannot latch the inhibit on for ever.
const moveOptimisticWindow = 3 * time.Second
// Transport says how to reach the controller.
type Transport struct {
Mode string // "tcp" | "serial"
@@ -103,6 +122,8 @@ type Client struct {
statusMu sync.RWMutex
lastStatus *Status
lastSetKHz int
// moveCmdAt is when a move was last COMMANDED — see moveOptimisticWindow.
moveCmdAt time.Time
// lastDriftKHz is the frequency last reported for a controller that had gone
// somewhere other than where it was told, so the disagreement is stated once
// and not on every poll. Zero when it is where it should be.
@@ -191,7 +212,28 @@ func (c *Client) GetStatus() (*Status, error) {
if c.lastStatus == nil {
return &Status{Connected: false}, nil
}
return c.lastStatus, nil
// A COPY, so the optimistic flag below can never leak into the status the
// poll goroutine owns — and so a caller holding the value cannot see it
// change under them mid-read.
st := *c.lastStatus
if st.Connected && st.MotorsMoving == 0 && c.movingOptimisticallyLocked() {
st.MotorsMoving = 1 // sentinel: commanded, not yet reported (read as != 0)
}
return &st, nil
}
// movingOptimisticallyLocked reports a move commanded too recently for the
// controller to have answered. Callers hold statusMu.
func (c *Client) movingOptimisticallyLocked() bool {
return !c.moveCmdAt.IsZero() && time.Since(c.moveCmdAt) < moveOptimisticWindow
}
// MovingOptimistically is the same question from outside the lock — the poll
// loop asks it to decide its cadence.
func (c *Client) MovingOptimistically() bool {
c.statusMu.RLock()
defer c.statusMu.RUnlock()
return c.movingOptimisticallyLocked()
}
// open dials the transport. Callers hold connMu.
@@ -266,8 +308,9 @@ func (c *Client) pollLoop() {
close(c.done)
}
}()
ticker := time.NewTicker(2 * time.Second)
ticker := time.NewTicker(pollIdle)
defer ticker.Stop()
fast := false
for {
select {
case <-c.stopChan:
@@ -315,6 +358,17 @@ func (c *Client) pollLoop() {
c.lastStatus = st
c.statusMu.Unlock()
c.checkDrift(st)
// Follow the motors with the poll rate; changed only when it changes,
// since the antenna is polled for hours on end.
if moving := st.MotorsMoving != 0 || c.MovingOptimistically(); moving != fast {
fast = moving
if fast {
ticker.Reset(pollMoving)
} else {
ticker.Reset(pollIdle)
}
}
}
}
}
@@ -639,6 +693,7 @@ func (c *Client) SetFrequency(freqKhz int, direction int) error {
c.statusMu.Lock()
c.lastSetKHz = freqKhz
c.pendingDir, c.pendingDirAt, c.pendingDirSet = direction, time.Now(), true
c.moveCmdAt = time.Now() // report motion at once — see moveOptimisticWindow
c.statusMu.Unlock()
return nil
}
+44 -1
View File
@@ -134,6 +134,23 @@ type Client struct {
// clears rather than latching the TX-inhibit on for ever.
const ubMoveOptimisticWindow = 3 * time.Second
// Poll cadences: what an idle antenna is worth, and what a moving one is worth.
// See the poll loop.
const (
ubPollIdle = 2 * time.Second
ubPollMoving = 250 * time.Millisecond
)
// movingOptimistically reports whether a move was commanded so recently that the
// antenna cannot have answered yet — the same window GetStatus reports motion
// for, so the fast poll starts with the movement rather than one interval into
// it.
func (c *Client) movingOptimistically() bool {
c.statusMu.RLock()
defer c.statusMu.RUnlock()
return !c.moveCmdAt.IsZero() && time.Since(c.moveCmdAt) < ubMoveOptimisticWindow
}
// LastSetKHz returns the frequency (kHz) most recently commanded to the antenna,
// or 0 if none yet.
func (c *Client) LastSetKHz() int {
@@ -312,8 +329,22 @@ func (c *Client) pollLoop() {
close(c.done)
}
}()
ticker := time.NewTicker(2 * time.Second) // Increased from 500ms to 2s
// TWO CADENCES, and the fast one is what matters.
//
// An idle antenna has nothing to say, so two seconds is generous. A MOVING
// one has one thing to say and it is urgent: transmit is inhibited while the
// elements travel, so every poll interval between the motors stopping and
// this loop noticing is a second the operator cannot call — with the antenna
// already in place and the rig still gagged. Reported from the air as "it
// stays orange one or two seconds after it has finished".
//
// While the motors run — or a move has just been commanded — the antenna is
// asked four times a second. The controller answers a status query in
// milliseconds; this is nothing to it, and it lasts only as long as the
// movement does.
ticker := time.NewTicker(ubPollIdle)
defer ticker.Stop()
fast := false
pollCount := 0
pollFails := 0 // consecutive failed status polls (transient timeouts tolerated)
@@ -436,6 +467,18 @@ func (c *Client) pollLoop() {
c.lastStatus = status
c.statusMu.Unlock()
// Follow the motors with the poll rate. Changed only when it actually
// changes: Reset on a ticker is cheap but not free, and the antenna is
// polled for hours on end.
if moving := status.MotorsMoving != 0 || c.movingOptimistically(); moving != fast {
fast = moving
if fast {
ticker.Reset(ubPollMoving)
} else {
ticker.Reset(ubPollIdle)
}
}
case <-c.stopChan:
return
}
+90 -1
View File
@@ -36,6 +36,28 @@ import (
// have one without the other. They only share the feed, which either one starts.
const keyChaseNew = "cluster.chase_new"
// keyChaseNewBandsOff lists the bands the panel is NOT to show, comma
// separated.
//
// Stored as the EXCLUSIONS rather than the selection, so that an empty setting
// — every operator who has never opened this — means "show them all", and so
// that a band added to the station's list later appears here on its own. Stored
// the other way round, a selection saved today would silently hide 4 m the day
// a transverter arrives.
const keyChaseNewBandsOff = "cluster.chase_new_bands_off"
// ChaseNewBands is the band vocabulary of the panel's own filter: HF through
// 70 cm, in the order an operator reads a band plan.
//
// A fixed list, not the station's: the two answer different questions. The
// station list says what this station can work at all, and still applies —
// this one says what is worth WATCHING right now, which changes with the hour
// and the season, not with the shack.
var ChaseNewBands = []string{
"160m", "80m", "60m", "40m", "30m", "20m", "17m", "15m", "12m", "10m",
"6m", "4m", "2m", "70cm",
}
// chaseNewMax bounds the panel. A list nobody can read to the bottom is not more
// information, and the oldest rows are the least likely to still be on the air.
const chaseNewMax = 200
@@ -149,6 +171,69 @@ var chaseModes = map[string]bool{
// atomic rather than the settings store.
func (a *App) chaseNewEnabled() bool { return a.chaseNewOn.Load() }
// GetChaseNewBands returns the bands the panel is set to SHOW — every band in
// the vocabulary that has not been switched off.
func (a *App) GetChaseNewBands() []string {
off := map[string]bool{}
for _, b := range splitCSV(a.settingOr(keyChaseNewBandsOff, "")) {
off[strings.ToLower(strings.TrimSpace(b))] = true
}
out := make([]string, 0, len(ChaseNewBands))
for _, b := range ChaseNewBands {
if !off[b] {
out = append(out, b)
}
}
return out
}
// SetChaseNewBands takes the bands to SHOW and stores the complement.
//
// Nothing is filtered out of the store retroactively: the rows already
// collected stay until they age out, and the next message is the one that
// obeys. A panel that emptied itself on a settings click would look like it had
// lost the feed.
func (a *App) SetChaseNewBands(show []string) {
want := map[string]bool{}
for _, b := range show {
want[strings.ToLower(strings.TrimSpace(b))] = true
}
var off []string
for _, b := range ChaseNewBands {
if !want[b] {
off = append(off, b)
}
}
a.setSetting(keyChaseNewBandsOff, strings.Join(off, ","))
a.refreshChaseNewBands()
applog.Printf("chase new: showing %d of %d bands", len(ChaseNewBands)-len(off), len(ChaseNewBands))
}
// refreshChaseNewBands re-reads the panel's own band filter into the cache the
// feed consults. Called at startup, and whenever the selection is saved.
func (a *App) refreshChaseNewBands() {
off := map[string]bool{}
for _, b := range splitCSV(a.settingOr(keyChaseNewBandsOff, "")) {
if b = strings.ToLower(strings.TrimSpace(b)); b != "" {
off[b] = true
}
}
a.chaseNewBandsOff.Store(off)
}
// chaseNewBandShown is the per-message half: a map read on the MQTT goroutine.
func (a *App) chaseNewBandShown(band string) bool {
v := a.chaseNewBandsOff.Load()
if v == nil {
return true // nothing loaded yet — better to show than to swallow
}
off, ok := v.(map[string]bool)
if !ok {
return true
}
return !off[strings.ToLower(strings.TrimSpace(band))]
}
// chaseBandAllowed reports whether a band is one the operator uses.
//
// PSK Reporter carries every band its receivers listen on, including microwave
@@ -217,7 +302,11 @@ func (a *App) feedChaseNew(sp pskr.Spot) {
// Both tests before the status lookup: they are map reads on short keys and
// they throw away most of the feed, so nothing further down pays for a band
// this station cannot work or a mode nobody answers.
if !chaseModes[mode] || !a.chaseBandAllowed(band) {
// Two band tests, and they answer two questions: can this station work the
// band at all (its own list), and does the operator want to WATCH it right
// now (this panel's own filter). A station with 2 m equipment that is
// chasing HF tonight needs the second one.
if !chaseModes[mode] || !a.chaseBandAllowed(band) || !a.chaseNewBandShown(band) {
return
}
+16 -1
View File
@@ -10,6 +10,10 @@ import (
// A contact that was not split still has a receive side, and the record
// forwarded to another logger has to carry it: Log4OM reads BAND_RX.
//
// The record UPLOADED to a service must not: in ADIF an absent BAND_RX means
// "same as transmit", and Wavelog shown both draws "17m/17m" on a simplex FT8
// contact — reported by OE6CLD, who had never logged a split QSO in his life.
func TestFillRXDefaults(t *testing.T) {
hz := int64(14074000)
q := qso.QSO{Callsign: "F4BPO", Band: "20m", FreqHz: &hz}
@@ -22,7 +26,7 @@ func TestFillRXDefaults(t *testing.T) {
}
// Assert on the RECORD another logger reads, not merely on the struct:
// both halves of the receive side have to reach it.
rec := strings.ToUpper(adif.SingleRecordADIF(q))
rec := strings.ToUpper(adif.ForwardRecordADIF(q))
if !strings.Contains(rec, "<BAND_RX:3>20M") {
t.Errorf("BAND_RX missing from the forwarded record:\n%s", rec)
}
@@ -40,3 +44,14 @@ func TestFillRXDefaultsKeepsSplit(t *testing.T) {
t.Errorf("split QSO was overwritten: band_rx=%q freq_rx=%v", q.BandRX, q.FreqRXHz)
}
}
// A genuine split contact is uploaded AS split: the rule above is about a
// receive side that repeats the transmit side, not about dropping one.
func TestSplitIsUploadedWithItsReceiveSide(t *testing.T) {
tx, rx := int64(14195000), int64(18100000)
q := qso.QSO{Callsign: "F4BPO", Band: "20m", BandRX: "17m", FreqHz: &tx, FreqRXHz: &rx}
up := strings.ToUpper(adif.SingleRecordADIF(q))
if !strings.Contains(up, "<BAND_RX:3>17M") || !strings.Contains(up, "<FREQ_RX:9>18.100000") {
t.Errorf("a cross-band contact lost its receive side:\n%s", up)
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ import (
const (
// appVersion is stamped on every heartbeat (and could feed the About box).
appVersion = "0.27.12"
appVersion = "0.27.15"
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
// to https://us.i.posthog.com for a US project.
+74
View File
@@ -0,0 +1,74 @@
package main
import (
"strings"
"testing"
"hamlog/internal/extsvc"
)
// An upload to a service with no credentials used to look exactly like one that
// worked: it ran on its own goroutine and reported into the QSL Manager's
// console, which is not open when the command came from the QSO list.
func TestUploadRefusesAnUnconfiguredService(t *testing.T) {
var empty extsvc.ExternalServices
for _, svc := range []extsvc.Service{
extsvc.ServiceCloudlog, extsvc.ServiceQRZ, extsvc.ServiceClublog,
extsvc.ServiceHRDLog, extsvc.ServiceEQSL, extsvc.ServiceHamQTH, extsvc.ServiceLoTW,
} {
err := uploadConfigured(svc, empty)
if err == nil {
t.Errorf("%s: an unconfigured service was accepted", svc)
continue
}
if !strings.Contains(err.Error(), "Settings") {
t.Errorf("%s: %q does not say where to fix it", svc, err)
}
}
}
// And a CONFIGURED service is not turned away. Club Log is the one that was:
// its API key is OpsLog's own application key, embedded and never entered, so
// demanding it refused every operator who had the service working.
func TestAConfiguredServiceIsAccepted(t *testing.T) {
var cfg extsvc.ExternalServices
cfg.Clublog.Email, cfg.Clublog.Password, cfg.Clublog.Callsign = "[email protected]", "secret", "F4BPO"
cfg.QRZ.APIKey = "1234-5678"
cfg.Cloudlog.URL, cfg.Cloudlog.APIKey, cfg.Cloudlog.StationID = "https://log.example.com", "cl-key", "3"
cfg.EQSL.Username, cfg.EQSL.Password = "F4BPO", "secret"
cfg.HamQTH.Username, cfg.HamQTH.Password = "f4bpo", "secret"
cfg.HRDLog.Callsign, cfg.HRDLog.Code = "F4BPO", "12345"
cfg.LoTW.TQSLPath, cfg.LoTW.StationLocation = `C:\Program Files (x86)\TrustedQSL\tqsl.exe`, "Home"
for _, svc := range []extsvc.Service{
extsvc.ServiceCloudlog, extsvc.ServiceQRZ, extsvc.ServiceClublog,
extsvc.ServiceHRDLog, extsvc.ServiceEQSL, extsvc.ServiceHamQTH, extsvc.ServiceLoTW,
} {
if err := uploadConfigured(svc, cfg); err != nil {
t.Errorf("%s: a configured service was refused: %v", svc, err)
}
}
}
// The message names what is actually missing, so the operator opens the right
// field rather than checking three that were already filled in.
func TestTheRefusalNamesTheMissingFields(t *testing.T) {
var cfg extsvc.ExternalServices
cfg.Clublog.Email = "[email protected]"
err := uploadConfigured(extsvc.ServiceClublog, cfg)
if err == nil {
t.Fatal("a half-configured Club Log was accepted")
}
msg := err.Error()
if strings.Contains(msg, "email") {
t.Errorf("%q asks for the one field that IS set", msg)
}
for _, want := range []string{"password", "logbook callsign"} {
if !strings.Contains(msg, want) {
t.Errorf("%q does not mention the missing %s", msg, want)
}
}
if strings.Contains(strings.ToLower(msg), "api key") {
t.Errorf("%q asks for the API key — it is OpsLog's own, embedded", msg)
}
}
+47
View File
@@ -0,0 +1,47 @@
package main
import (
"testing"
udp "hamlog/internal/integrations/udp"
)
// The text colour is derived from the background, never stored: an operator who
// picks a dark blue must not end up with black text on it in somebody else's
// window and conclude the feature is broken.
func TestHighlightForegroundFollowsTheBackground(t *testing.T) {
var a App
for _, tc := range []struct {
bg string
want udp.RGB
}{
{"#111827", hlWhite}, // near-black
{"#16823C", hlWhite}, // the new-DXCC green
{"#F472B6", hlBlack}, // the watchlist pink
{"#FFFFFF", hlBlack},
{"#E27A18", hlBlack}, // orange
} {
bg, fg := a.colourFor("", tc.bg)
if got, ok := parseHexRGB(tc.bg); !ok || got != bg {
t.Errorf("%s: background came back as %v", tc.bg, bg)
}
if fg != tc.want {
t.Errorf("%s: foreground %v, want %v", tc.bg, fg, tc.want)
}
}
}
// A colour that cannot be read is refused rather than half-read: silently
// becoming black is worse than keeping the default.
func TestHighlightColourParsing(t *testing.T) {
for _, s := range []string{"#F472B6", "f472b6", " #F472B6 "} {
if c, ok := parseHexRGB(s); !ok || c != (udp.RGB{R: 244, G: 114, B: 182}) {
t.Errorf("%q → %v ok=%v", s, c, ok)
}
}
for _, s := range []string{"", "#FFF", "pink", "#GGGGGG", "#F472B6F"} {
if _, ok := parseHexRGB(s); ok {
t.Errorf("%q was accepted", s)
}
}
}