Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3014796c1d | ||
|
|
405b0e24cf | ||
|
|
778db0542e | ||
|
|
f50806fbd9 |
@@ -716,6 +716,11 @@ type App struct {
|
||||
clublogMW *clublog.MostWanted // ClubLog "Most Wanted" DXCC ranking (opt-in)
|
||||
motorAnt motorAntenna // motorized antenna (Ultrabeam or SteppIR); nil when disabled
|
||||
ubFollowStop chan struct{} // stops the "follow frequency" loop; nil when off
|
||||
// qsoRecPushed records which SOURCE the recorder was started on: the network
|
||||
// stream, or a sound device. Switching CAT backends changes the answer, and a
|
||||
// recorder left capturing a device that no longer carries the radio records
|
||||
// silence without saying so.
|
||||
qsoRecPushed bool
|
||||
motorStartMu sync.Mutex // serialises startUltrabeam: two restarts at once left two poll loops on one COM port
|
||||
motorInhibStop chan struct{} // stops the "inhibit TX while moving" loop; nil when off
|
||||
motorMoveCmdNs atomic.Int64 // unixnano of the last commanded antenna move (grace window)
|
||||
@@ -8321,7 +8326,19 @@ func (a *App) startQSORecorderIfEnabled() {
|
||||
if !cfg.QSORecord {
|
||||
return
|
||||
}
|
||||
if err := a.qsoRec.Start(cfg.FromRadio, cfg.RecordingDevice, cfg.PrerollSeconds); err != nil {
|
||||
// Over the network there IS no radio sound device.
|
||||
//
|
||||
// An IC-705 or IC-7610 reached by LAN streams its receive audio through the
|
||||
// Icom protocol, and Windows sees nothing: the operator's audio settings can
|
||||
// only offer the PC's own microphone and speakers, so "From radio" has
|
||||
// nothing right to point at. The stream is pushed into the recorder instead
|
||||
// — same samples, no sound card in the middle, and no virtual cable to set up.
|
||||
from := cfg.FromRadio
|
||||
a.qsoRecPushed = a.icomNetAudioActive()
|
||||
if a.qsoRecPushed {
|
||||
from = audio.PushedSource
|
||||
}
|
||||
if err := a.qsoRec.Start(from, cfg.RecordingDevice, cfg.PrerollSeconds); err != nil {
|
||||
applog.Printf("qso-rec: start failed: %v", err)
|
||||
return
|
||||
}
|
||||
@@ -8336,6 +8353,17 @@ func (a *App) startQSORecorderIfEnabled() {
|
||||
applog.Printf("qso-rec: running (preroll %ds, mix=%v, gains rx=%.2f mic=%.2f)", cfg.PrerollSeconds, cfg.RecordingDevice != "" && cfg.RecordingDevice != cfg.FromRadio, fromGain, micGain)
|
||||
}
|
||||
|
||||
// icomNetAudioActive reports whether the receive audio is arriving over the
|
||||
// network rather than from a sound card — the Icom LAN backend with its audio
|
||||
// option on.
|
||||
func (a *App) icomNetAudioActive() bool {
|
||||
s, err := a.GetCATSettings()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return s.Enabled && s.Backend == "icom-net" && s.IcomNetAudio
|
||||
}
|
||||
|
||||
// qsoRecDir returns the configured recordings folder, defaulting to
|
||||
// <dataDir>/Recordings, and ensures it exists.
|
||||
func (a *App) qsoRecDir() string {
|
||||
@@ -8708,17 +8736,22 @@ func (a *App) clusterEventWorker() {
|
||||
// grid uses, so a spot is never one colour on screen and another on
|
||||
// the radio — and the index is cached, so this costs a map lookup.
|
||||
status := a.spotStatusName(s.DXCall, s.Band, mode, s.POTARef)
|
||||
// A status the operator has switched off never reaches the radio. A
|
||||
// skipped SEND rather than a transparent colour: a spot that is not
|
||||
// drawn should not occupy one of the panadapter's slots either.
|
||||
if !a.spotHidden(status) {
|
||||
col := a.spotColorFor(status)
|
||||
a.cat.SendSpot(cat.SpotInfo{
|
||||
FreqHz: s.FreqHz,
|
||||
Callsign: s.DXCall,
|
||||
Mode: mode,
|
||||
Comment: spotComment(s.Comment, status),
|
||||
Comment: spotComment(s.Comment, s.Spotter, s.Country, status),
|
||||
Color: col.Text,
|
||||
BackgroundColor: col.Bg,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// skimmerBase strips the reporting suffix from a spotter callsign: RBN skimmers
|
||||
@@ -13144,6 +13177,15 @@ func (a *App) LogUDPLoggedADIF(adifText string) (int64, error) {
|
||||
// (same reasoning as the manual path — award_refs on a busy shared MySQL blocked).
|
||||
if a.ctx != nil {
|
||||
wruntime.EventsEmit(a.ctx, "qso:logged", id)
|
||||
// A contact logged by WSJT-X / JTDX / MSHV is the one the operator has no
|
||||
// other confirmation of: the entry form did not clear, because they never
|
||||
// typed in it, and on the FT decodes tab the log grid is not even on
|
||||
// screen. Its own event, carrying enough to name the station — qso:logged
|
||||
// is an id, and fires twice per contact, so it can drive a refresh but not
|
||||
// a message.
|
||||
wruntime.EventsEmit(a.ctx, "qso:logged_external", map[string]any{
|
||||
"call": q.Callsign, "band": q.Band, "mode": q.Mode, "country": q.Country,
|
||||
})
|
||||
}
|
||||
qc := q
|
||||
go func() {
|
||||
@@ -13313,18 +13355,36 @@ func (a *App) consumeUDPEvents() {
|
||||
if len(lastDecodeSpot) > 4000 {
|
||||
lastDecodeSpot = map[string]time.Time{} // bound memory on long sessions
|
||||
}
|
||||
lastDecodeSpot[key] = now
|
||||
secs := a.catFlexDecodeSecs
|
||||
if secs <= 0 {
|
||||
secs = 120
|
||||
}
|
||||
// The palette governs the PANADAPTER, not one of the two things
|
||||
// that feed it. A decode spot is a callsign on the waterfall
|
||||
// exactly as a cluster spot is, so it answers to the same
|
||||
// per-status switch and the same colours — an operator who turned
|
||||
// "entity not resolved" off and still watched unresolved calls
|
||||
// pile up on the radio was right to call that a bug.
|
||||
status := a.spotStatusName(ev.DecodeCall, bandForHz(ev.DecodeFreqHz), ev.Mode, "")
|
||||
if a.spotHidden(status) {
|
||||
continue
|
||||
}
|
||||
lastDecodeSpot[key] = now
|
||||
// Green when the palette is off — the colour this feature has always
|
||||
// used, and what still tells a decode from a cluster spot.
|
||||
col := a.spotColorFor(status)
|
||||
textCol, bgCol := col.Text, col.Bg
|
||||
if textCol == "" {
|
||||
textCol, bgCol = "#FF34C759", ""
|
||||
}
|
||||
select {
|
||||
case spotQ <- cat.SpotInfo{
|
||||
FreqHz: ev.DecodeFreqHz,
|
||||
Callsign: ev.DecodeCall,
|
||||
Mode: ev.Mode,
|
||||
Color: "#FF34C759", // green — distinct from cluster orange
|
||||
Comment: fmt.Sprintf("%s %+ddB", ev.Mode, ev.DecodeSNR),
|
||||
Color: textCol,
|
||||
BackgroundColor: bgCol,
|
||||
Comment: spotComment(fmt.Sprintf("%s %+ddB", ev.Mode, ev.DecodeSNR), "", a.countryFor(ev.DecodeCall), status),
|
||||
LifetimeSec: secs,
|
||||
}:
|
||||
default:
|
||||
@@ -14860,6 +14920,13 @@ func (a *App) reloadCAT() {
|
||||
a.catFlexDecodeSpots = s.Enabled && s.Backend == "flex" && s.FlexDecodeSpots
|
||||
a.catFlexDecodeSecs = s.FlexDecodeSecs
|
||||
a.catFlexDVKDax = s.Enabled && s.Backend == "flex" && s.FlexDVKDax
|
||||
// The recorder's source depends on the backend: over the Icom LAN there is no
|
||||
// sound card to capture, the audio is pushed in. Restarted only when the
|
||||
// answer CHANGES, so an ordinary settings save never interrupts a recording.
|
||||
if want := s.Enabled && s.Backend == "icom-net" && s.IcomNetAudio; want != a.qsoRecPushed {
|
||||
applog.Printf("qso-rec: audio source changes (network=%v) — restarting the recorder", want)
|
||||
go a.startQSORecorderIfEnabled()
|
||||
}
|
||||
a.reloadCATShare(s)
|
||||
// Nothing about the link changed → leave it connected. See catLinkSig.
|
||||
if sig := catLinkSig(s); sig == a.catSig {
|
||||
@@ -14968,8 +15035,16 @@ func (a *App) reloadCAT() {
|
||||
} else {
|
||||
codec := audio.NewPCM16Codec()
|
||||
audioSink = func(payload []byte) {
|
||||
if pcm, err := codec.Decode(payload); err == nil {
|
||||
pcm, err := codec.Decode(payload)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
a.audioMgr.PushMonitorAudio(pcm)
|
||||
// And to the QSO recorder, which has no device to capture from
|
||||
// on this backend. It drops the samples unless a recording is
|
||||
// actually running, so this costs a function call when idle.
|
||||
if a.qsoRec != nil {
|
||||
a.qsoRec.PushRX(pcm)
|
||||
}
|
||||
}
|
||||
applog.Printf("icom-net audio: RX audio streaming ENABLED (experimental) → %q", acfg.ListeningDevice)
|
||||
@@ -19439,7 +19514,12 @@ func (a *App) spotStatusName(call, band, mode, potaRef string) string {
|
||||
case r.NewPfx:
|
||||
return "new-pfx"
|
||||
}
|
||||
if r.Status == "worked" {
|
||||
// WORKED means this CALLSIGN is in the log — the question an operator asks
|
||||
// of a spot ("have I had this station?"), and the one DXHunter answers.
|
||||
// The entity-level statuses above already say what the ENTITY is worth; an
|
||||
// entity worked here whose callsign is new is not "worked", it is simply no
|
||||
// news, which is what "none" means.
|
||||
if r.WorkedCall {
|
||||
return "worked"
|
||||
}
|
||||
return "none"
|
||||
@@ -20177,3 +20257,16 @@ func (a *App) tidyLogbookSchema(logbookConn *sql.DB) {
|
||||
// if this one is ever asked to serve as the logbook again.
|
||||
db.DropEmptyQSOTable(a.db, filepath.Base(a.dbPath))
|
||||
}
|
||||
|
||||
// countryFor names the DXCC entity of a callsign, or "" when it cannot be
|
||||
// resolved. Used to enrich a panadapter spot built from a WSJT-X decode, which
|
||||
// arrives as a bare callsign.
|
||||
func (a *App) countryFor(call string) string {
|
||||
if a.dxcc == nil || strings.TrimSpace(call) == "" {
|
||||
return ""
|
||||
}
|
||||
if m, ok := a.dxcc.Lookup(call); ok && m.Entity != nil {
|
||||
return m.Entity.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ var deniedCallHashes = map[string]struct{}{
|
||||
"d1ae6212ec057f9d5c6f379fb57acedac7c94142c9d49667dc04b2016d03d1b6": {},
|
||||
"0741c9e394b42f43191899105553b47155ddc3026da12b5360701f9c181ff123": {},
|
||||
"ab4926a3a0ab76d41b5b99cd3ad0683584970c341c29427c1dfa4b3c329ce415": {},
|
||||
"9d17c9c213a6cc89c12d7520bcf21c86a0cf43d17e82e74f33f3a77cb865d28a": {},
|
||||
}
|
||||
|
||||
// callDenied reports whether a callsign is on deniedCallHashes. The call is
|
||||
|
||||
@@ -1,4 +1,60 @@
|
||||
[
|
||||
{
|
||||
"version": "0.26.7",
|
||||
"date": "",
|
||||
"en": [
|
||||
"The NEW badge on a county now shows in the entry form itself, inside the field, and not only on the Info tab — it answers the question at the moment the operator is deciding whether to call.",
|
||||
"OmniRig: a Yaesu is no longer sent OmniRig's SetSimplexMode when tuning. It is a no-op on some (an FT-891 never moved) and harmful on others — on an FT-2000 it turned split on and moved reception to VFO B, which is why OpsLog then showed B instead of A. The direct frequency write, which is what tunes these rigs, is unchanged.",
|
||||
"The basemap buttons on the main map are shifted clear of the zoom controls — Light sat a few pixels from the minus button and was being clicked by mistake.",
|
||||
"Cluster, French interface: the WKD CALL status now reads DÉJÀ QSO instead of DÉJÀ CTC.",
|
||||
"Icom over LAN: the receive audio streamed by the rig now feeds the QSO recorder as well as the speakers. On a network connection Windows sees no radio sound card at all — the audio settings could only offer the PC microphone — so the stream is pushed straight into the recorder, with no virtual cable to set up."
|
||||
],
|
||||
"fr": [
|
||||
"Le badge NOUV du comté s'affiche maintenant dans le formulaire de saisie lui-même, à l'intérieur du champ, et plus seulement dans l'onglet Info — il répond au moment où l'opérateur décide d'appeler ou non.",
|
||||
"OmniRig : le SetSimplexMode d'OmniRig n'est plus envoyé aux Yaesu lors d'un changement de fréquence. Il est sans effet sur certains (un FT-891 ne bougeait pas) et nuisible sur d'autres — sur un FT-2000 il activait le split et faisait passer la réception sur le VFO B, d'où l'affichage du B au lieu du A. L'écriture directe de la fréquence, qui est ce qui accorde réellement ces postes, ne change pas.",
|
||||
"Les boutons de fond de carte sont décalés à l'écart des commandes de zoom — Light était à quelques pixels du bouton moins et se faisait cliquer par erreur.",
|
||||
"Cluster, interface française : le statut « DÉJÀ CTC » devient « DÉJÀ QSO ».",
|
||||
"Icom en réseau : l'audio reçu diffusé par le poste alimente maintenant l'enregistreur de QSO en plus des haut-parleurs. Sur une liaison réseau, Windows ne voit aucune carte son de la radio — les réglages audio ne proposaient que le micro du PC — donc le flux est injecté directement dans l'enregistreur, sans câble virtuel à installer."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.26.6",
|
||||
"date": "",
|
||||
"en": [
|
||||
"FT decodes: the continent filter is now a multiple choice — click AF, AS, OC and SA to keep those four. It still lists only the continents actually being decoded, plus any you have selected, so a filter can never strand itself with no chip left to switch it off.",
|
||||
"A QSO logged by WSJT-X, JTDX or MSHV now raises a notice in the corner naming the station. Watching the decodes, nothing else on screen said it had happened: the entry form never cleared, because nobody typed in it.",
|
||||
"Icom CI-V: a reply the rig sent to another controller on the same bus is no longer mistaken for ours, and a PTT command whose acknowledgement goes missing is verified by reading the rig instead of being reported as a failure. WSJT-X and JTDX answer a failed set_ptt with a Rig Control Error and drop the link mid-over, which is what an IC-7850 was doing three times a session. The check itself waits 700 ms rather than the poll's 150: the rig has just failed to answer twice, usually because it is retuning — JTDX moves the transmit frequency and keys in the same breath — and a short probe would fail for the same reason. Both outcomes are logged, so a failure that remains can be told from a fix that did not fire.",
|
||||
"FlexRadio: each spot status can now be kept off the panadapter entirely, with a switch beside its colours — and WSJT-X decode spots obey the same switches and the same colours. The palette governs the panadapter, not just one of the two things that feed it: statuses switched off still piled up on the waterfall because the decodes were pushed by another path.",
|
||||
"Panadapter spot comments now read like DXHunter's: the cluster text, then the spotter, the entity and the status — \"CQ up 2 [F4BPO] [Franz Josef Land] [New Slot]\". The words were running together because SmartSDR splits its command line on spaces; non-breaking spaces get them through.",
|
||||
"\"Already worked\" on a panadapter spot now means the CALLSIGN is in the log, not the entity. An entity worked on that band and mode is no news, and saying \"already worked\" of a station never contacted was wrong.",
|
||||
"FT decodes: a compound MSHV message that answers two stations in one line — \"DM8BJF RR73; F4BPO <RI1FJL> +14\" — is now recognised as addressed to you when your callsign is in the second half.",
|
||||
"Edit QSO: your own transmit power can be edited at last — the field was saved and written back but had no box, so a contact logged at the wrong power could never be corrected. The contacted station's extended locator gained a box for the same reason, and the power labels now say WHOSE power they are.",
|
||||
"FlexRadio: a spot is no longer removed and redrawn when nothing about it has changed. A busy skimmer feed re-spots the same station every few seconds — one two-minute session sent 2128 spot adds, 88 of them for a single callsign — and the panadapter did not move a pixel for any of them.",
|
||||
"Panadapter spot comments are kept within what the radio will accept: SmartSDR was cutting the longest ones mid-word, losing the entity and the status. The cluster's own words are trimmed first, the spotter, entity and status always survive. The column padding of an RBN line is collapsed to single spaces too — kept as non-breaking spaces it opened a gap wide enough to push the rest of the comment off the screen.",
|
||||
"Auto-call is withdrawn — it duplicated DXHunter, which already answers decodes. Clicking a decode to answer it is unchanged.",
|
||||
"The elastic bounce at the end of a list is gone, and a two-finger horizontal swipe no longer navigates the window away from the app. Both are browser behaviours that only appear on a touchpad or a touchscreen.",
|
||||
"The interface zoom now says what it is doing: a badge shows the factor while it changes, clicking it returns to 100%, and View → Zoom in / Zoom out / Actual size makes it findable. Ctrl+wheel and Ctrl+0 always worked, but nothing announced them — zoom by accident and there was no way back.",
|
||||
"Icom CI-V: a frequency or mode change whose acknowledgement goes missing is now verified by reading the rig back, like the PTT already was. All three are commands WSJT-X and JTDX answer with a Rig Control Error and a dropped link, and an IC-7850 log shows a set_freq doing exactly that.",
|
||||
"The log file now rotates while OpsLog is running, not only at startup. It was bounded on the belief that a session writes a few kilobytes; with the CI-V wire trace left on, one wrote 416 MB and nothing would have stopped it before the disk did."
|
||||
],
|
||||
"fr": [
|
||||
"Décodes FT : le filtre par continent est maintenant multiple — clique AF, AS, OC et SA pour garder ces quatre-là. Il ne liste toujours que les continents réellement décodés, plus ceux que tu as sélectionnés, pour qu'un filtre ne puisse pas se bloquer sans pastille pour le désactiver.",
|
||||
"Un QSO enregistré par WSJT-X, JTDX ou MSHV affiche maintenant une notification dans le coin, avec le nom de la station. En regardant les décodes, rien d'autre à l'écran ne le signalait : le formulaire ne se vidait pas, puisque personne n'y avait tapé.",
|
||||
"Icom CI-V : une réponse que la radio adresse à un autre contrôleur du même bus n'est plus prise pour la nôtre, et un ordre de PTT dont l'accusé de réception se perd est vérifié en interrogeant la radio au lieu d'être déclaré en échec. WSJT-X et JTDX répondent à un set_ptt en échec par une erreur de contrôle radio et coupent la liaison en pleine émission — ce que faisait un IC-7850 trois fois par session. La vérification attend 700 ms et non les 150 de la scrutation : la radio vient d'échouer deux fois, en général parce qu'elle se réaccorde — JTDX décale la fréquence d'émission et passe en émission dans la foulée — et une interrogation brève échouerait pour la même raison. Les deux issues sont journalisées, pour distinguer un échec réel d'un correctif qui n'a pas agi.",
|
||||
"FlexRadio : chaque statut de spot peut désormais être totalement exclu du panadapter, par un interrupteur à côté de ses couleurs — et les spots issus des décodes WSJT-X obéissent aux mêmes interrupteurs et aux mêmes couleurs. La palette régit le panadapter, pas seulement l'une des deux sources qui l'alimentent : les statuts décochés continuaient de s'entasser sur la cascade parce que les décodes passaient par un autre chemin.",
|
||||
"Les commentaires des spots du panadapter se lisent maintenant comme ceux de DXHunter : le texte du cluster, puis le spotteur, l'entité et le statut — « CQ up 2 [F4BPO] [Franz Josef Land] [New Slot] ». Les mots se collaient parce que SmartSDR découpe sa ligne de commande sur les espaces ; des espaces insécables les font passer.",
|
||||
"« Déjà contacté » sur un spot du panadapter désigne désormais l'INDICATIF présent dans le journal, et non l'entité. Une entité déjà faite sur cette bande et ce mode n'est pas une nouvelle, et annoncer « déjà contacté » pour une station jamais travaillée était faux.",
|
||||
"Décodes FT : un message composé MSHV qui répond à deux stations sur une seule ligne — « DM8BJF RR73; F4BPO <RI1FJL> +14 » — est maintenant reconnu comme vous étant adressé quand votre indicatif est dans la seconde moitié.",
|
||||
"Édition de QSO : sa propre puissance d'émission est enfin modifiable — le champ était enregistré et réécrit mais n'avait aucune case, donc un contact loggé à la mauvaise puissance ne pouvait pas être corrigé. Le locator étendu du correspondant gagne une case pour la même raison, et les libellés de puissance disent maintenant à QUI elle appartient.",
|
||||
"FlexRadio : un spot n'est plus supprimé puis redessiné quand rien n'a changé. Un flux de skimmers actif re-spotte la même station toutes les quelques secondes — une session de deux minutes envoyait 2128 ajouts, dont 88 pour un seul indicatif — sans que le panadapter bouge d'un pixel.",
|
||||
"Les commentaires des spots du panadapter tiennent maintenant dans ce que la radio accepte : SmartSDR coupait les plus longs en plein mot, perdant l'entité et le statut. Le texte du cluster est rogné en premier, le spotteur, l'entité et le statut survivent toujours. L'alignement en colonnes des lignes RBN est aussi ramené à une seule espace : conservé en espaces insécables, il ouvrait un trou assez large pour repousser le reste du commentaire hors de l'écran.",
|
||||
"L'appel automatique est retiré — il faisait doublon avec DXHunter, qui répond déjà aux décodages. Cliquer un décodage pour répondre ne change pas.",
|
||||
"Le rebond élastique en fin de liste a disparu, et un balayage horizontal à deux doigts ne fait plus quitter l'application. Deux comportements de navigateur qui n'apparaissent qu'au pavé tactile ou sur écran tactile.",
|
||||
"Le zoom de l'interface s'annonce enfin : une pastille affiche le facteur pendant qu'il change, un clic dessus revient à 100 %, et le menu Affichage → Zoom avant / Zoom arrière / Taille réelle le rend trouvable. Ctrl+molette et Ctrl+0 fonctionnaient déjà, mais rien ne le disait — un zoom involontaire et on ne savait plus revenir.",
|
||||
"Icom CI-V : un changement de fréquence ou de mode dont l'accusé de réception se perd est désormais vérifié en interrogeant la radio, comme l'était déjà le PTT. Les trois sont des ordres auxquels WSJT-X et JTDX répondent par une erreur de contrôle radio et une liaison coupée, et un log d'IC-7850 montre un set_freq faire précisément cela.",
|
||||
"Le fichier de log tourne maintenant en cours d'exécution, et plus seulement au démarrage. Sa limite reposait sur l'idée qu'une session écrit quelques kilo-octets ; avec la trace CI-V laissée active, l'une d'elles a écrit 416 Mo sans que rien ne l'arrête avant le disque."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.26.5",
|
||||
"date": "",
|
||||
|
||||
+92
-15
@@ -1284,11 +1284,22 @@ export default function App() {
|
||||
// by z, so it reflows to fill that larger box and then scales back to exactly the
|
||||
// window (more content visible when zoomed out, like a real browser zoom).
|
||||
const appRootRef = useRef<HTMLDivElement>(null);
|
||||
// The current factor, shown briefly whenever it changes.
|
||||
//
|
||||
// Ctrl+wheel and Ctrl+0 have worked from the start, and NOTHING said so:
|
||||
// no menu entry, no readout. An operator who zoomed by accident — easy, the
|
||||
// wheel is over a grid and Ctrl is already down for something else — saw the
|
||||
// interface change size with no explanation and no way back. The number is
|
||||
// the fix; the menu entry makes it findable without reading a manual.
|
||||
const [uiZoom, setUiZoom] = useState(1);
|
||||
const [zoomShown, setZoomShown] = useState(false);
|
||||
const zoomHideRef = useRef(0);
|
||||
const setZoomRef = useRef<(z: number) => void>(() => {});
|
||||
useEffect(() => {
|
||||
const KEY = 'opslog.uiZoom';
|
||||
let z = parseFloat(localStorage.getItem(KEY) || '1');
|
||||
if (!Number.isFinite(z) || z <= 0) z = 1;
|
||||
const apply = () => {
|
||||
const apply = (announce = false) => {
|
||||
const el = appRootRef.current;
|
||||
if (!el) return;
|
||||
el.style.transformOrigin = '0 0';
|
||||
@@ -1296,17 +1307,36 @@ export default function App() {
|
||||
el.style.width = `${100 / z}vw`;
|
||||
el.style.height = `${100 / z}vh`;
|
||||
document.documentElement.setAttribute('data-uizoom', String(z));
|
||||
setUiZoom(z);
|
||||
// Only on a CHANGE: showing it at startup would put a badge over the log
|
||||
// every launch, for a number that is almost always 100 %.
|
||||
if (announce) {
|
||||
setZoomShown(true);
|
||||
window.clearTimeout(zoomHideRef.current);
|
||||
zoomHideRef.current = window.setTimeout(() => setZoomShown(false), 1600);
|
||||
}
|
||||
};
|
||||
apply();
|
||||
// The menu and the badge set the factor through here, so there is one
|
||||
// implementation of "zoom to z" and not three.
|
||||
setZoomRef.current = (next: number) => {
|
||||
z = Math.min(2.5, Math.max(0.5, Math.round(next * 10) / 10));
|
||||
localStorage.setItem(KEY, String(z));
|
||||
apply(true);
|
||||
};
|
||||
const onWheel = (e: WheelEvent) => {
|
||||
if (!e.ctrlKey && !e.metaKey) return; // plain wheel is left alone (scroll / freq nudge)
|
||||
e.preventDefault();
|
||||
z = Math.min(2.5, Math.max(0.5, Math.round((z + (e.deltaY < 0 ? 0.1 : -0.1)) * 10) / 10));
|
||||
localStorage.setItem(KEY, String(z));
|
||||
apply();
|
||||
apply(true);
|
||||
};
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if ((e.ctrlKey || e.metaKey) && (e.key === '0')) { e.preventDefault(); z = 1; localStorage.setItem(KEY, '1'); apply(); }
|
||||
if ((e.ctrlKey || e.metaKey) && (e.key === '0')) { e.preventDefault(); z = 1; localStorage.setItem(KEY, '1'); apply(true); }
|
||||
// Ctrl+plus / Ctrl+minus, the shortcuts every other application uses.
|
||||
// '=' as well as '+': on most layouts the plus is the shifted '='.
|
||||
if ((e.ctrlKey || e.metaKey) && (e.key === '+' || e.key === '=')) { e.preventDefault(); setZoomRef.current(z + 0.1); }
|
||||
if ((e.ctrlKey || e.metaKey) && (e.key === '-')) { e.preventDefault(); setZoomRef.current(z - 0.1); }
|
||||
};
|
||||
window.addEventListener('wheel', onWheel, { passive: false });
|
||||
window.addEventListener('keydown', onKey);
|
||||
@@ -2274,6 +2304,9 @@ export default function App() {
|
||||
const [clusterMacros, setClusterMacros] = useState(loadClusterMacros);
|
||||
useEffect(() => { if (!showSettings) setClusterMacros(loadClusterMacros()); }, [showSettings]);
|
||||
const clusterMacrosShown = useMemo(() => visibleClusterMacros(clusterMacros), [clusterMacros]);
|
||||
// Auto-call is withdrawn — it duplicated DXHunter, which answers decodes from
|
||||
// the same shack. This flag is the single place that says so at runtime.
|
||||
const AUTO_CALL_ENABLED = false;
|
||||
const [autoCall, setAutoCall] = useState<AutoCallSettings>(loadAutoCall);
|
||||
useEffect(() => { if (!showSettings) setAutoCall(loadAutoCall()); }, [showSettings]);
|
||||
// When each callsign was last answered, so a station still calling CQ is not
|
||||
@@ -2306,6 +2339,15 @@ export default function App() {
|
||||
// backstop below.
|
||||
const lastTxAtRef = useRef<Map<string, number>>(new Map());
|
||||
useEffect(() => {
|
||||
// AUTO-CALL IS WITHDRAWN — DXHunter already answers decodes, and two
|
||||
// programs doing it from one shack key over each other. See lib/autocall.ts.
|
||||
//
|
||||
// Returning here rather than deleting the loop: the decision it implements
|
||||
// is the delicate part, argued over and tested, and worth keeping intact.
|
||||
// The guard is what matters — an operator whose stored preference still
|
||||
// says "enabled" must not have their transmitter keyed by a feature they
|
||||
// can no longer see, let alone switch off.
|
||||
if (!AUTO_CALL_ENABLED) return;
|
||||
if (!autoCall.enabled) return;
|
||||
const now = Date.now();
|
||||
// A QSO is in progress somewhere if ANY receiver is transmitting or still
|
||||
@@ -2663,8 +2705,17 @@ export default function App() {
|
||||
// Backend-emitted toast messages (e.g. recording auto-send result/skip).
|
||||
useEffect(() => {
|
||||
const off = EventsOn('toast', (msg: any) => { if (msg) showToast(String(msg)); });
|
||||
return () => { off(); };
|
||||
}, [showToast]);
|
||||
// A QSO logged by an external app announces itself: nothing else on screen
|
||||
// says it happened when the operator is watching the decodes rather than the
|
||||
// entry form.
|
||||
const offExt = EventsOn('qso:logged_external', (p: any) => {
|
||||
const call = String(p?.call ?? '').trim();
|
||||
if (!call) return;
|
||||
const bits = [p?.band, p?.mode].filter(Boolean).join(' · ');
|
||||
showToast(`✅ ${t('toast.qsoLogged')} — ${call}${bits ? ` · ${bits}` : ''}`);
|
||||
});
|
||||
return () => { off(); offExt(); };
|
||||
}, [showToast, t]);
|
||||
|
||||
// Band openings — sporadic E on 6/4/2 m, detected from the spot stream.
|
||||
//
|
||||
@@ -4668,6 +4719,10 @@ export default function App() {
|
||||
{ type: 'item', label: t('edit.prefs'), action: 'edit.prefs' },
|
||||
]},
|
||||
{ name: 'view', label: t('menu.view'), items: [
|
||||
{ type: 'item', label: t('view.zoomIn'), action: 'view.zoomin', shortcut: 'Ctrl++' },
|
||||
{ type: 'item', label: t('view.zoomOut'), action: 'view.zoomout', shortcut: 'Ctrl+-' },
|
||||
{ type: 'item', label: t('view.zoomReset'), action: 'view.zoomreset', shortcut: 'Ctrl+0' },
|
||||
{ type: 'separator' },
|
||||
{ type: 'item', label: t('view.refresh'), action: 'view.refresh', shortcut: 'F5' },
|
||||
{ type: 'item', label: t('view.clearFilters'), action: 'view.clearfilters' },
|
||||
]},
|
||||
@@ -4716,6 +4771,9 @@ export default function App() {
|
||||
case 'file.exportCabrillo': exportCabrillo(); break;
|
||||
case 'file.deleteall': setShowDeleteAll(true); break;
|
||||
case 'file.exit': QuitApp(); break;
|
||||
case 'view.zoomin': setZoomRef.current(uiZoom + 0.1); break;
|
||||
case 'view.zoomout': setZoomRef.current(uiZoom - 0.1); break;
|
||||
case 'view.zoomreset': setZoomRef.current(1); break;
|
||||
case 'view.refresh': refresh(); break;
|
||||
case 'view.clearfilters': setFilterCallsign(''); setActiveFilter({ conditions: [], match: 'AND' }); break;
|
||||
case 'edit.edit': if (selectedId !== null) openEdit(selectedId); break;
|
||||
@@ -5156,9 +5214,21 @@ export default function App() {
|
||||
};
|
||||
const geoDetailRow = (
|
||||
<div className="flex gap-4 items-end">
|
||||
<div className="flex flex-col flex-1 min-w-0"><Label className="mb-1 h-3.5">{t('field.cnty')}</Label>
|
||||
<Input value={details.cnty ?? ''}
|
||||
{/* The badge sits INSIDE the field: this row is already tight, and a
|
||||
county name is short enough to leave room at its right. It answers the
|
||||
question at the moment the operator is deciding whether to call — the
|
||||
same answer the Info tab gives, one tab away from where they are. */}
|
||||
<div className="flex flex-col flex-1 min-w-0 relative"><Label className="mb-1 h-3.5">{t('field.cnty')}</Label>
|
||||
<Input value={details.cnty ?? ''} className={cn(entryNewCounty && 'pr-12')}
|
||||
onChange={(e) => setDetails((d) => ({ ...d, cnty: e.target.value }))} />
|
||||
{entryNewCounty && (
|
||||
<span
|
||||
title={t('detp.newCountyTip')}
|
||||
className="absolute right-1.5 bottom-1.5 rounded px-1.5 py-0.5 text-[10px] font-bold tracking-wide bg-success text-success-foreground pointer-events-none"
|
||||
>
|
||||
{t('detp.newCounty')}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col w-[64px] shrink-0"><Label className="mb-1 h-3.5">{t('field.cqz')}</Label>
|
||||
<Input value={details.cqz ?? ''} className="font-mono"
|
||||
@@ -5812,14 +5882,6 @@ export default function App() {
|
||||
txMsgs={txMsgs}
|
||||
txState={txState}
|
||||
txStates={txStates}
|
||||
autoCallOn={autoCall.enabled}
|
||||
// Written through the same key Preferences uses, so the two can never
|
||||
// disagree about whether the machine is armed.
|
||||
onToggleAutoCall={() => setAutoCall((prev) => {
|
||||
const next = { ...prev, enabled: !prev.enabled };
|
||||
writeUiPref(autoCallKey, JSON.stringify(next));
|
||||
return next;
|
||||
})}
|
||||
spotStatus={spotStatus as any}
|
||||
myCall={station.callsign}
|
||||
// A click ANSWERS the station: it hands the decode back to WSJT-X/MSHV as
|
||||
@@ -6668,6 +6730,21 @@ export default function App() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* The zoom factor, while it is changing.
|
||||
Centred at the top, out of the way of the entry form and the toasts,
|
||||
and clickable: the number is only half an answer if the way back to
|
||||
100 % is another thing to know. */}
|
||||
{zoomShown && uiZoom !== 1 && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setZoomRef.current(1)}
|
||||
title={t('view.zoomResetTip')}
|
||||
className="fixed top-2 left-1/2 -translate-x-1/2 z-[130] rounded-full border border-border bg-card/95 px-3 py-1 text-xs font-mono shadow-lg hover:bg-accent"
|
||||
>
|
||||
{Math.round(uiZoom * 100)}% · {t('view.zoomReset')}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* Transient toasts (bottom-right). Errors stack on top of the green
|
||||
success toast; both auto-dismiss. */}
|
||||
{/* Unlock encrypted passwords (set via Settings → Security). Dismissable:
|
||||
|
||||
@@ -531,7 +531,14 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
});
|
||||
const [bandSel, setBandSel] = usePersisted('bandSel', '');
|
||||
const [modeSel, setModeSel] = usePersisted('modeSel', '');
|
||||
const [contSel, setContSel] = usePersisted('contSel', '');
|
||||
// Continents are a MULTI-selection, not one at a time: the useful filter is
|
||||
// "everything except NA and EU", which a single-choice dropdown cannot say —
|
||||
// it can only name one continent to keep. Stored as a list (a Set does not
|
||||
// survive JSON), empty meaning no filter at all.
|
||||
const [contList, setContList] = usePersisted<string[]>('contList', []);
|
||||
const contSel = useMemo(() => new Set(contList), [contList]);
|
||||
const toggleCont = (c: string) =>
|
||||
setContList(contSel.has(c) ? contList.filter((x) => x !== c) : [...contList, c].sort());
|
||||
const [minSnr, setMinSnr] = usePersisted('minSnr', '');
|
||||
const [search, setSearch] = usePersisted('search', '');
|
||||
|
||||
@@ -554,8 +561,21 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
const calling = (txState?.dx_call ?? '').toUpperCase();
|
||||
const answersMe = (msg?: string): boolean => {
|
||||
if (!me || !msg) return false;
|
||||
const first = msg.trim().split(/\s+/)[0]?.replace(/[<>]/g, '').toUpperCase();
|
||||
return !!first && first === me;
|
||||
// EVERY segment, not just the first.
|
||||
//
|
||||
// MSHV answers two stations in one transmission and sends them as one line:
|
||||
//
|
||||
// DM8BJF RR73; F4BPO <RI1FJL> +14
|
||||
//
|
||||
// The second half is addressed to F4BPO, and reading only the start of the
|
||||
// line missed it — the operator being answered saw no badge at all, which is
|
||||
// the one moment this badge exists for. Each ';' segment is its own message
|
||||
// and names its own recipient first.
|
||||
for (const part of msg.split(';')) {
|
||||
const first = part.trim().split(/\s+/)[0]?.replace(/[<>]/g, '').toUpperCase();
|
||||
if (first && first === me) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// The choices are built from what is actually on the feed, and a selector with
|
||||
@@ -576,6 +596,15 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [decodes, spotStatus]);
|
||||
|
||||
// The chips are the continents on the feed — a selector with nothing to choose
|
||||
// is furniture — PLUS anything currently selected. Without that second half a
|
||||
// filter can strand itself: pick AF, the last African station stops decoding,
|
||||
// and the list empties with no chip left to switch it back off.
|
||||
const contChips = useMemo(
|
||||
() => [...new Set([...conts, ...contList])].sort(),
|
||||
[conts, contList],
|
||||
);
|
||||
|
||||
const filtered = useMemo(() => {
|
||||
const q = search.trim().toUpperCase();
|
||||
const floor = minSnr.trim() === '' ? null : parseInt(minSnr, 10);
|
||||
@@ -594,7 +623,7 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
for (const c of cats) if (have.has(c)) { hit = true; break; }
|
||||
if (!hit) return false;
|
||||
}
|
||||
if (contSel && e?.continent !== contSel) return false;
|
||||
if (contSel.size > 0 && !(e?.continent && contSel.has(e.continent))) return false;
|
||||
if (q && !(d.call.includes(q) || (d.grid ?? '').toUpperCase().includes(q) || (d.msg ?? '').toUpperCase().includes(q))) return false;
|
||||
return true;
|
||||
});
|
||||
@@ -627,11 +656,11 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
|
||||
const resetFilters = () => {
|
||||
setCqOnly(false); setLotwOnly(false); setBandSel('');
|
||||
setModeSel(''); setContSel(''); setMinSnr(''); setSearch('');
|
||||
setModeSel(''); setContList([]); setMinSnr(''); setSearch('');
|
||||
setCats(new Set());
|
||||
try { localStorage.setItem(CAT_KEY, '[]'); } catch { /* not worth failing over */ }
|
||||
};
|
||||
const anyFilter = cqOnly || lotwOnly || cats.size > 0 || !!bandSel || !!modeSel || !!contSel || !!minSnr || !!search.trim();
|
||||
const anyFilter = cqOnly || lotwOnly || cats.size > 0 || !!bandSel || !!modeSel || contSel.size > 0 || !!minSnr || !!search.trim();
|
||||
|
||||
const sel = 'h-8 rounded-lg border border-border bg-background px-2 text-sm';
|
||||
const chip = (on: boolean, tone = 'primary') => cn(
|
||||
@@ -700,11 +729,28 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
{modes.map((m) => <option key={m} value={m}>{m}</option>)}
|
||||
</select>
|
||||
)}
|
||||
{conts.length > 1 && (
|
||||
<select className={sel} value={contSel} onChange={(e) => setContSel(e.target.value)}>
|
||||
<option value="">{t('dec.allConts')}</option>
|
||||
{conts.map((c) => <option key={c} value={c}>{c}</option>)}
|
||||
</select>
|
||||
{/* Toggles, like the category badges above — the same gesture for the
|
||||
same kind of question. None lit is every continent, which is what an
|
||||
empty filter has always meant here. */}
|
||||
{contChips.length > 1 && (
|
||||
<span className="flex items-center gap-1 pl-1 border-l border-border/60 ml-1" title={t('dec.contsHint')}>
|
||||
{contChips.map((c) => {
|
||||
const on = contSel.has(c);
|
||||
return (
|
||||
<button
|
||||
key={c}
|
||||
type="button"
|
||||
onClick={() => toggleCont(c)}
|
||||
className={cn(
|
||||
'rounded border px-1.5 py-0.5 text-[11px] font-bold uppercase tracking-wide transition-all',
|
||||
on ? 'border-primary text-primary' : 'border-border text-muted-foreground opacity-50 hover:opacity-100',
|
||||
)}
|
||||
>
|
||||
{c}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</span>
|
||||
)}
|
||||
|
||||
<label className="flex items-center gap-1.5 text-sm text-muted-foreground">
|
||||
@@ -765,21 +811,6 @@ export function DecodesPanel({ decodes, txMsgs, txState, txStates, spotStatus, o
|
||||
filter. Halt goes LAST — it is the one that must be findable without
|
||||
reading, and the end of the row is the one position that never moves
|
||||
as filters come and go. */}
|
||||
{onToggleAutoCall && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onToggleAutoCall}
|
||||
title={t('dec.autoCallTip')}
|
||||
className={cn('h-8 px-2.5 rounded-lg text-sm inline-flex items-center gap-1.5 border',
|
||||
// Lit when it is armed, because what matters at a glance is not
|
||||
// "where is the switch" but "is this thing about to transmit".
|
||||
autoCallOn
|
||||
? 'border-warning bg-warning text-warning-foreground'
|
||||
: 'border-border text-muted-foreground hover:bg-muted hover:text-foreground')}
|
||||
>
|
||||
<Bot className="size-3.5" /> {t('dec.autoCall')}
|
||||
</button>
|
||||
)}
|
||||
{onHalt && (
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -366,7 +366,10 @@ export function WorldMap({ fromGrid, toGrid, fromLabel, toLabel, beamAzimuths, b
|
||||
<div className="relative isolate h-full w-full rounded-lg overflow-hidden border border-border">
|
||||
<div ref={worldRef} className="absolute inset-0" />
|
||||
{/* Basemap picker — Light / Street / Satellite (key-free tiles). */}
|
||||
<div className="absolute top-1 left-12 z-[500] flex rounded-md overflow-hidden shadow border border-border backdrop-blur">
|
||||
{/* Clear of the zoom buttons, not merely next to them: at left-12 the
|
||||
first basemap sat a few pixels from the − button and operators kept
|
||||
hitting Light when they meant to zoom out. */}
|
||||
<div className="absolute top-1 left-[4.5rem] z-[500] flex rounded-md overflow-hidden shadow border border-border backdrop-blur">
|
||||
{(Object.keys(BASEMAPS) as BasemapKey[]).map((k) => (
|
||||
<button
|
||||
key={k}
|
||||
|
||||
@@ -626,6 +626,7 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
||||
</div>
|
||||
<div className="flex items-end gap-2">
|
||||
<div className="flex flex-col flex-1"><Label>{t('qedit.grid')}</Label><Input value={draft.grid ?? ''} onChange={(e) => set('grid', e.target.value)} className="font-mono uppercase" /></div>
|
||||
<div className="flex flex-col w-24"><Label>{t('qedit.gridExt')}</Label><Input title={t('qedit.gridExtTip')} value={draft.gridsquare_ext ?? ''} onChange={(e) => set('gridsquare_ext', e.target.value)} className="font-mono uppercase" /></div>
|
||||
<div className="flex flex-col w-24"><Label>PFX</Label><Input readOnly value={pfxOf(draft.callsign ?? '')} className="font-mono bg-muted/40" /></div>
|
||||
</div>
|
||||
<div><Label>{t('qedit.comment')}</Label><Input value={draft.comment ?? ''} onChange={(e) => set('comment', e.target.value)}
|
||||
@@ -867,7 +868,7 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
||||
<F label={t('qedit.stationCallsign')} span={3}><Input value={draft.station_callsign ?? ''} onChange={(e) => set('station_callsign', e.target.value)} /></F>
|
||||
<F label={t('qedit.operator')} span={3}><Input value={draft.operator ?? ''} onChange={(e) => set('operator', e.target.value)} /></F>
|
||||
<F label={t('qedit.myGrid')}><Input value={draft.my_grid ?? ''} onChange={(e) => set('my_grid', e.target.value)} /></F>
|
||||
<F label={t('qedit.gridExt')}><Input value={draft.my_gridsquare_ext ?? ''} onChange={(e) => set('my_gridsquare_ext', e.target.value)} /></F>
|
||||
<F label={t('qedit.myGridExt')}><Input title={t('qedit.gridExtTip')} value={draft.my_gridsquare_ext ?? ''} onChange={(e) => set('my_gridsquare_ext', e.target.value)} /></F>
|
||||
<F label={t('qedit.country')} span={2}><Combobox value={draft.my_country ?? ''} options={countries} placeholder={t('qedit.country')} onChange={(v) => set('my_country', v)} /></F>
|
||||
<F label={t('qedit.state')}><Input value={draft.my_state ?? ''} onChange={(e) => set('my_state', e.target.value)} /></F>
|
||||
<F label={t('qedit.county')}><Input value={draft.my_cnty ?? ''} onChange={(e) => set('my_cnty', e.target.value)} /></F>
|
||||
@@ -903,6 +904,10 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
||||
<div>
|
||||
<p className="text-[11px] font-semibold text-muted-foreground uppercase tracking-wider mb-2">{t('qedit.powerWeather')}</p>
|
||||
<div className="grid grid-cols-6 gap-3">
|
||||
{/* YOUR power first, then theirs. tx_pwr was saved by this
|
||||
editor but had no field: a contact logged at the wrong
|
||||
power could be read back and never corrected. */}
|
||||
<F label={t('qedit.txPower')}><Input type="number" value={draft.tx_pwr ?? ''} onChange={(e) => set('tx_pwr', numOrUndef(e.target.value) as any)} /></F>
|
||||
<F label={t('qedit.rxPower')}><Input type="number" value={draft.rx_pwr ?? ''} onChange={(e) => set('rx_pwr', numOrUndef(e.target.value) as any)} /></F>
|
||||
<F label={t('qedit.distance')}><Input type="number" value={draft.distance ?? ''} onChange={(e) => set('distance', numOrUndef(e.target.value) as any)} /></F>
|
||||
<F label={t('qedit.aIndex')}><Input type="number" value={draft.a_index ?? ''} onChange={(e) => set('a_index', numOrUndef(e.target.value) as any)} /></F>
|
||||
|
||||
@@ -209,7 +209,6 @@ type SectionId =
|
||||
| 'databases'
|
||||
| 'awards'
|
||||
| 'cat'
|
||||
| 'ftx'
|
||||
| 'rotator'
|
||||
| 'winkeyer'
|
||||
| 'antenna'
|
||||
@@ -314,7 +313,6 @@ function buildTree(flexAvailable: boolean, t: (k: string) => string): TreeNode[]
|
||||
{ kind: 'item', label: t('sec.modes'), id: 'lists-modes' },
|
||||
]},
|
||||
{ kind: 'item', label: t('sec.cluster'), id: 'cluster' },
|
||||
{ kind: 'item', label: t('sec.ftx'), id: 'ftx' },
|
||||
{ kind: 'item', label: t('sec.udp'), id: 'udp' },
|
||||
{ kind: 'item', label: t('sec.adifmon'), id: 'adifmon' },
|
||||
{ kind: 'item', label: t('sec.foldersync'), id: 'foldersync' },
|
||||
@@ -343,7 +341,7 @@ function buildTree(flexAvailable: boolean, t: (k: string) => string): TreeNode[]
|
||||
const SECTION_KEY: Partial<Record<SectionId, string>> = {
|
||||
station: 'sec.station', profiles: 'sec.profiles', operating: 'sec.operating', confirmations: 'sec.confirmations',
|
||||
'external-services': 'sec.external', appearance: 'sec.appearance', lookup: 'sec.lookup', 'lists-bands': 'sec.bands', 'lists-modes': 'sec.modes',
|
||||
cluster: 'sec.cluster', ftx: 'sec.ftx', backup: 'sec.backup', database: 'sec.database', autostart: 'sec.autostart', udp: 'sec.udp',
|
||||
cluster: 'sec.cluster', backup: 'sec.backup', database: 'sec.database', autostart: 'sec.autostart', udp: 'sec.udp',
|
||||
adifmon: 'sec.adifmon',
|
||||
foldersync: 'sec.foldersync',
|
||||
webpublish: 'sec.webpublish',
|
||||
@@ -1801,7 +1799,7 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
// form: waiting for the modal's Save to see a colour on the waterfall would
|
||||
// make picking one a guessing game.
|
||||
type SpotColor = { text: string; bg?: string };
|
||||
const [spotColors, setSpotColors] = useState<{ enabled: boolean; colors: Record<string, SpotColor> }>({ enabled: true, colors: {} });
|
||||
const [spotColors, setSpotColors] = useState<{ enabled: boolean; colors: Record<string, SpotColor & { hide?: boolean }> }>({ enabled: true, colors: {} });
|
||||
useEffect(() => { GetSpotColors().then((c: any) => setSpotColors(c ?? { enabled: true, colors: {} })).catch(() => {}); }, []);
|
||||
const saveSpotColors = (next: { enabled: boolean; colors: Record<string, SpotColor> }) => {
|
||||
setSpotColors(next);
|
||||
@@ -4783,91 +4781,6 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
setEditingServer(next);
|
||||
}
|
||||
|
||||
// FTx decodes: what OpsLog does on its own with the digital stream.
|
||||
//
|
||||
// Auto-call KEYS THE TRANSMITTER without anyone clicking, so the panel is
|
||||
// deliberately explicit about it: off by default, every criterion opt-in, and
|
||||
// a plain statement of what the machine will do once it is on.
|
||||
function FtxPanel() {
|
||||
const set = (patch: Partial<AutoCallSettings>) => {
|
||||
const next = { ...autoCall, ...patch };
|
||||
setAutoCall(next);
|
||||
writeUiPref(autoCallKey, JSON.stringify(next));
|
||||
};
|
||||
const crit = (which: 'criteria' | 'watchCriteria', k: keyof AutoCallCriteria) => (
|
||||
<label key={k} className="flex items-center gap-1.5 text-xs cursor-pointer">
|
||||
<Checkbox
|
||||
checked={!!autoCall[which][k]}
|
||||
onCheckedChange={(v) => set({ [which]: { ...autoCall[which], [k]: !!v } } as any)}
|
||||
/>
|
||||
{t(`ftx.c_${k}`)}
|
||||
</label>
|
||||
);
|
||||
const KEYS: (keyof AutoCallCriteria)[] = ['dxcc', 'bandmode', 'band', 'mode', 'slot', 'grid', 'county', 'pota', 'pfx'];
|
||||
return (
|
||||
<>
|
||||
<SectionHeader title={t('sec.ftx')} hint={t('ftx.hint')} />
|
||||
<div className="space-y-4">
|
||||
<div className="rounded-md border border-border p-3 space-y-3">
|
||||
<label className="flex items-start gap-2 text-sm cursor-pointer">
|
||||
<Checkbox checked={autoCall.enabled} className="mt-0.5"
|
||||
onCheckedChange={(v) => set({ enabled: !!v })} />
|
||||
<span>
|
||||
{t('ftx.enable')}{' '}
|
||||
<span className="text-xs text-muted-foreground">{t('ftx.enableHint')}</span>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
{autoCall.enabled && (
|
||||
<div className="pl-6 space-y-3">
|
||||
<div>
|
||||
<p className="text-xs font-semibold text-muted-foreground mb-1.5">{t('ftx.callWhen')}</p>
|
||||
<div className="grid grid-cols-2 gap-x-4 gap-y-1">{KEYS.map((k) => crit('criteria', k))}</div>
|
||||
</div>
|
||||
|
||||
<div className="border-t border-border/60 pt-3">
|
||||
<p className="text-xs font-semibold text-muted-foreground mb-1">{t('ftx.watch')}</p>
|
||||
<p className="text-[11px] text-muted-foreground mb-1.5 leading-relaxed">{t('ftx.watchHint')}</p>
|
||||
<Textarea
|
||||
className="h-20 font-mono text-xs"
|
||||
placeholder={"4S7*\nTM0HQ\n*/P"}
|
||||
defaultValue={(autoCall.watch ?? []).join('\n')}
|
||||
key={`w-${(autoCall.watch ?? []).length}`}
|
||||
onBlur={(e) => set({
|
||||
watch: e.target.value.split('\n').map((x) => x.trim().toUpperCase()).filter(Boolean),
|
||||
})}
|
||||
/>
|
||||
{(autoCall.watch ?? []).length > 0 && (
|
||||
<div className="mt-2">
|
||||
<p className="text-[11px] text-muted-foreground mb-1">{t('ftx.watchOnlyIf')}</p>
|
||||
<div className="grid grid-cols-2 gap-x-4 gap-y-1">{KEYS.map((k) => crit('watchCriteria', k))}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="border-t border-border/60 pt-3 flex items-center gap-2 flex-wrap">
|
||||
<span className="text-xs text-muted-foreground">{t('ftx.cooldown')}</span>
|
||||
<Input type="number" min={10} max={3600} className="w-24 h-7 text-xs"
|
||||
defaultValue={autoCall.cooldownSec}
|
||||
key={`cd-${autoCall.cooldownSec}`}
|
||||
onBlur={(e) => {
|
||||
const v = parseInt(e.target.value, 10);
|
||||
if (!isNaN(v) && v >= 10 && v <= 3600) set({ cooldownSec: v });
|
||||
}} />
|
||||
<span className="text-xs text-muted-foreground">s</span>
|
||||
</div>
|
||||
|
||||
<p className="text-[11px] rounded border border-warning-border bg-warning-muted text-warning-muted-foreground px-2 py-1.5 leading-relaxed">
|
||||
{t('ftx.warn')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function ClusterPanel() {
|
||||
const sorted = [...clusterServers].sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0));
|
||||
// Written on every keystroke. This panel has no Save button, and a pair of
|
||||
@@ -7233,7 +7146,6 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
'lists-bands': BandsPanel,
|
||||
'lists-modes': ModesPanel,
|
||||
cluster: ClusterPanel,
|
||||
ftx: FtxPanel,
|
||||
udp: UDPIntegrationsPanelWrapper,
|
||||
// Module-scope components, wrapped so their props can be passed. The nested
|
||||
// panels below go through PanelHost instead — which is what now lets either
|
||||
@@ -7343,7 +7255,11 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
const c = spotColors.colors[k] ?? { text: '', bg: '' };
|
||||
return (
|
||||
<div key={k} className="flex items-center gap-3 px-3 py-1.5">
|
||||
<span className="text-xs flex-1 min-w-0">{t('spotcol.s_' + k)}</span>
|
||||
{/* Sent to the radio at all. First in the row because it
|
||||
decides whether the colours next to it mean anything. */}
|
||||
<Checkbox checked={!c.hide} title={t('spotcol.send')}
|
||||
onCheckedChange={(v) => setSpotColor(k, { hide: !v } as any)} />
|
||||
<span className={cn('text-xs flex-1 min-w-0', c.hide && 'opacity-40 line-through')}>{t('spotcol.s_' + k)}</span>
|
||||
{/* The preview is the point of the row: two colour boxes say
|
||||
nothing about what the pair looks like together. */}
|
||||
<span className="text-xs font-mono px-2 py-0.5 rounded"
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
// Auto-call: let OpsLog answer a decode without the operator clicking it.
|
||||
//
|
||||
// WITHDRAWN FROM THE INTERFACE, because DXHunter already does it.
|
||||
//
|
||||
// Two programs from the same shack deciding on their own to answer the same
|
||||
// decode is worse than either doing it alone: they cannot see each other, so
|
||||
// they key over one another, and afterwards there is no telling which of them
|
||||
// called. The duplicate is the one to remove, and DXHunter is where this lives.
|
||||
//
|
||||
// There is no switch in Preferences and no button on the decodes toolbar, and
|
||||
// App.tsx returns before the loop can run. The file is kept whole: the rules
|
||||
// below are the delicate part, argued over and tested, and rewriting them from
|
||||
// memory later would be worse than leaving them here. Reinstating the feature
|
||||
// means restoring all three — the settings page, the button, and the guard.
|
||||
//
|
||||
// This KEYS THE TRANSMITTER on its own, which is why the rules here are written
|
||||
// as a series of refusals rather than a search for a reason to call. Everything
|
||||
// below has to be true; anything unknown means no.
|
||||
@@ -154,9 +167,20 @@ export function shouldAutoCall(
|
||||
if (!call) return no('no callsign');
|
||||
// Never answer ourselves, however the decode reached us.
|
||||
if (opts.myCall && call === opts.myCall.trim().toUpperCase()) return no('own callsign');
|
||||
// Only a CQ. Answering a station mid-QSO is both rude and futile — WSJT-X
|
||||
// actions a Reply only for CQ and QRZ anyway.
|
||||
if (!d.cq) return no('not a CQ');
|
||||
// NOT limited to a CQ, deliberately.
|
||||
//
|
||||
// It used to be, on the reasoning that answering a station mid-QSO is calling
|
||||
// over somebody. That reasoning ignored the case the feature exists for: a
|
||||
// DXpedition running a pileup never sends CQ at all — it works caller after
|
||||
// caller — so the rule sat out the one contact auto-call was turned on for. A
|
||||
// new entity on 15 m FT8, decode after decode, and not a single transmission.
|
||||
//
|
||||
// WHEN to transmit is not ours to decide either: the Reply goes to the
|
||||
// decoder, and MSHV starts at once while JTDX waits for a CQ. Two correct
|
||||
// behaviours, both belonging to the program that owns the timing. Here the
|
||||
// question is only whether the station is one the operator wants — the
|
||||
// criteria below answer that, and the cooldown and the busy check keep it from
|
||||
// calling twice.
|
||||
// Not while ANY receiver is mid-QSO — transmitting, or holding a DX call it
|
||||
// has not finished with. Starting a second exchange before the first is done
|
||||
// is what turned this into a machine that called without stopping.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -991,6 +991,18 @@
|
||||
@layer base {
|
||||
* { @apply border-border; }
|
||||
html, body, #root { height: 100%; }
|
||||
/* No rubber-band, and no swipe-to-navigate.
|
||||
|
||||
Chromium lets a scroll that has reached the end pull the content a few
|
||||
pixels and spring back, and a two-finger horizontal swipe means "go back a
|
||||
page". Both are browser behaviours that have no meaning in a logbook: the
|
||||
first makes a table wobble at the bottom of a list, and the second can
|
||||
navigate the WebView away from the app entirely — a blank window and a
|
||||
restart. Neither shows up with a mouse, which is why they went unnoticed;
|
||||
they arrive with a precision touchpad or a touchscreen.
|
||||
|
||||
A no-op wherever the effects don't occur. */
|
||||
html, body { overscroll-behavior: none; }
|
||||
/* Root rem base. Tailwind sizing (text/heights/padding/gaps) is in rem, so
|
||||
this is the single global density knob — shrinks the whole UI uniformly
|
||||
while Leaflet maps (px-based) stay correct. Default browser base is 16px. */
|
||||
@@ -1055,3 +1067,15 @@
|
||||
filter: invert(1) brightness(1.8);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* Every scrollable pane keeps its overscroll to itself.
|
||||
|
||||
"contain" (not "none") on the inside: the pane still scrolls normally, it
|
||||
simply stops passing the leftover motion up to its parent — which is how
|
||||
scrolling a grid to its end used to tug the panel behind it. */
|
||||
.overflow-auto,
|
||||
.overflow-y-auto,
|
||||
.overflow-x-auto,
|
||||
.overflow-scroll {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Single source of truth for the app version shown in the UI (header + About).
|
||||
// Bump this on a release (the release script updates it alongside telemetry.go).
|
||||
export const APP_VERSION = '0.26.5';
|
||||
export const APP_VERSION = '0.26.7';
|
||||
|
||||
// Author / credits, shown in Help -> About.
|
||||
export const APP_AUTHOR = 'F4BPO';
|
||||
|
||||
@@ -3463,6 +3463,7 @@ export namespace main {
|
||||
export class SpotColor {
|
||||
text: string;
|
||||
bg?: string;
|
||||
hide?: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new SpotColor(source);
|
||||
@@ -3472,6 +3473,7 @@ export namespace main {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.text = source["text"];
|
||||
this.bg = source["bg"];
|
||||
this.hide = source["hide"];
|
||||
}
|
||||
}
|
||||
export class SpotColors {
|
||||
|
||||
@@ -20,9 +20,15 @@ var (
|
||||
mu sync.Mutex
|
||||
file *os.File
|
||||
path string
|
||||
written int64 // bytes in the CURRENT file, for the size check in Printf
|
||||
crashFile *os.File // kept open so the runtime can write a crash traceback to it
|
||||
)
|
||||
|
||||
// maxLogBytes is where the file rolls over, at startup AND while running.
|
||||
// A variable, not a constant, so the rotation can be exercised in a test without
|
||||
// writing ten megabytes to do it.
|
||||
var maxLogBytes int64 = 10 * 1024 * 1024
|
||||
|
||||
// Init opens (creates) the log file in dataDir. On rotation we truncate
|
||||
// at startup if the file is too big; for now it's a single file, no
|
||||
// rolling — the volume is low (a few KB per session).
|
||||
@@ -47,11 +53,11 @@ func Init(dataDir string) (string, error) {
|
||||
_ = os.Rename(oldLog, logPath)
|
||||
}
|
||||
}
|
||||
// Rotate (don't delete) once the file grows past ~10MB: rename it to
|
||||
// Rotate (don't delete) once the file grows past maxLogBytes: rename it to
|
||||
// opslog.log.1 so the PREVIOUS session's log survives. Deleting it outright used
|
||||
// to erase exactly the diagnostics we needed when a user reported an issue from
|
||||
// the session that just ended. One generation kept — enough, without unbounded growth.
|
||||
if fi, err := os.Stat(logPath); err == nil && fi.Size() > 10*1024*1024 {
|
||||
if fi, err := os.Stat(logPath); err == nil && fi.Size() > maxLogBytes {
|
||||
_ = os.Remove(logPath + ".1") // drop the older generation
|
||||
if err := os.Rename(logPath, logPath+".1"); err != nil {
|
||||
_ = os.Remove(logPath) // rename failed (locked?) → fall back to the old behaviour
|
||||
@@ -96,13 +102,57 @@ func Printf(format string, args ...any) {
|
||||
msg = msg[:len(msg)-1]
|
||||
}
|
||||
if file != nil {
|
||||
fmt.Fprintf(file, "%s %s\n", stamp, msg)
|
||||
n, _ := fmt.Fprintf(file, "%s %s\n", stamp, msg)
|
||||
written += int64(n)
|
||||
rotateIfBigLocked()
|
||||
}
|
||||
// Also dump to stderr in case the binary was launched with a console
|
||||
// attached (wails dev, custom build).
|
||||
fmt.Fprintf(os.Stderr, "%s %s\n", stamp, msg)
|
||||
}
|
||||
|
||||
// rotateIfBigLocked rolls the file over mid-session once it passes maxLogBytes.
|
||||
//
|
||||
// The check used to happen at STARTUP only, on the reasonable belief that a
|
||||
// session writes a few kilobytes. The CI-V wire trace disproved it: left on for
|
||||
// a day it wrote 416 MB, and nothing would have stopped it before the disk did.
|
||||
// A log that has to be rotated by quitting the program is not a bound.
|
||||
//
|
||||
// Same one-generation scheme as the startup rotation, so the previous stretch
|
||||
// survives — which is the half an operator usually needs, the part just before
|
||||
// the thing they are reporting.
|
||||
//
|
||||
// Caller holds mu.
|
||||
func rotateIfBigLocked() {
|
||||
if written < maxLogBytes || file == nil || path == "" {
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(file, "%s ── log reached %d MB, rotating to %s.1 ──\n",
|
||||
time.Now().Format("15:04:05.000"), maxLogBytes/(1024*1024), filepath.Base(path))
|
||||
_ = file.Close()
|
||||
file = nil
|
||||
_ = os.Remove(path + ".1")
|
||||
if err := os.Rename(path, path+".1"); err != nil {
|
||||
// Rename refused (the file is held open elsewhere, a virus scanner): keep
|
||||
// writing to the old handle rather than losing the log entirely, and try
|
||||
// again in another maxLogBytes rather than on every single line.
|
||||
f, oerr := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644)
|
||||
if oerr == nil {
|
||||
file = f
|
||||
}
|
||||
written = 0
|
||||
return
|
||||
}
|
||||
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644)
|
||||
if err != nil {
|
||||
return // nothing more to be done; the next Printf simply writes nowhere
|
||||
}
|
||||
file = f
|
||||
written = 0
|
||||
fmt.Fprintf(file, "%s ── continued from %s.1 ──\n",
|
||||
time.Now().Format("15:04:05.000"), filepath.Base(path))
|
||||
}
|
||||
|
||||
// Path returns where the file is so the UI can surface it.
|
||||
func Path() string {
|
||||
mu.Lock()
|
||||
@@ -118,4 +168,19 @@ func Close() {
|
||||
_ = file.Close()
|
||||
file = nil
|
||||
}
|
||||
// The crash file is held open for the whole run so the runtime can dump a
|
||||
// traceback into it without allocating; on the way out it has to be released
|
||||
// like any other handle, or the data directory cannot be moved or removed.
|
||||
if crashFile != nil {
|
||||
// The RUNTIME holds its own duplicate of this handle (SetCrashOutput), so
|
||||
// closing ours releases nothing on Windows — the data directory stays
|
||||
// locked. Hand the runtime a nil first. Anything fatal in the last moments
|
||||
// of shutdown is no longer captured, which is the right trade at a point
|
||||
// where the databases are already closed.
|
||||
_ = debug.SetCrashOutput(nil, debug.CrashOptions{})
|
||||
_ = crashFile.Close()
|
||||
crashFile = nil
|
||||
}
|
||||
path = ""
|
||||
written = 0
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package applog
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// The log has to be bounded WHILE RUNNING, not only at startup. The CI-V wire
|
||||
// trace left on for a day wrote 416 MB, and nothing would have stopped it
|
||||
// before the disk did.
|
||||
func TestRotatesMidSession(t *testing.T) {
|
||||
orig := maxLogBytes
|
||||
maxLogBytes = 8 * 1024 // small, so the test costs milliseconds
|
||||
defer func() { maxLogBytes = orig }()
|
||||
|
||||
dir := t.TempDir()
|
||||
p, err := Init(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer Close()
|
||||
|
||||
line := strings.Repeat("x", 256)
|
||||
for i := 0; i < 100; i++ { // ~25 KB: several times the limit
|
||||
Printf("%s", line)
|
||||
}
|
||||
|
||||
if _, err := os.Stat(p + ".1"); err != nil {
|
||||
t.Fatalf("no previous generation kept: %v", err)
|
||||
}
|
||||
fi, err := os.Stat(p)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if fi.Size() > maxLogBytes {
|
||||
t.Fatalf("current log is %d bytes, over the %d limit — it did not roll over", fi.Size(), maxLogBytes)
|
||||
}
|
||||
// The new file says where the rest went: a log that starts mid-sentence with
|
||||
// no explanation is how an operator concludes the app lost its history.
|
||||
b, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(b), "continued from "+filepath.Base(p)+".1") {
|
||||
t.Error("the new file does not point at the one it continues")
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,48 @@ func (r *Recorder) Start(fromDev, micDev string, prerollSec int) error {
|
||||
twoSrc := r.twoSrc
|
||||
r.mu.Unlock()
|
||||
|
||||
// Capture goroutine(s) feed the per-source queues.
|
||||
// The radio side is either CAPTURED from a sound device or PUSHED in from
|
||||
// somewhere else. Over the network there is no sound device at all: an
|
||||
// IC-705 reached by LAN streams its receive audio over the Icom protocol,
|
||||
// and the operator's audio settings can only offer the PC's own microphone
|
||||
// and speakers. fromDev == PushedSource says "someone else will feed me",
|
||||
// and PushRX is how they do it.
|
||||
if fromDev == PushedSource {
|
||||
LogSink("recorder: radio audio is pushed in (network), not captured from a device")
|
||||
} else {
|
||||
r.startRadioCapture(fromDev, stop)
|
||||
}
|
||||
if twoSrc {
|
||||
r.startMicCapture(micDev, stop)
|
||||
}
|
||||
r.finishStart(fromDev, micDev, twoSrc, stop)
|
||||
return nil
|
||||
}
|
||||
|
||||
// PushedSource is the "device" name that means the radio audio arrives through
|
||||
// PushRX instead of a capture stream.
|
||||
const PushedSource = "\x00pushed"
|
||||
|
||||
// PushRX feeds one chunk of 16-bit mono PCM from a non-device source.
|
||||
//
|
||||
// Safe to call when nothing is recording — the samples are dropped, which is
|
||||
// what should happen: the network stream runs whenever the rig is connected,
|
||||
// and the recorder only wants it between BeginQSO and the save.
|
||||
func (r *Recorder) PushRX(pcm []byte) {
|
||||
r.mu.Lock()
|
||||
running := r.running
|
||||
r.mu.Unlock()
|
||||
if !running || len(pcm) == 0 {
|
||||
return
|
||||
}
|
||||
sm := bytesToInt16(pcm)
|
||||
r.srcMu.Lock()
|
||||
r.bufA = append(r.bufA, sm...)
|
||||
r.lastA = time.Now()
|
||||
r.srcMu.Unlock()
|
||||
}
|
||||
|
||||
func (r *Recorder) startRadioCapture(fromDev string, stop chan struct{}) {
|
||||
r.wg.Add(1)
|
||||
go func() {
|
||||
defer r.wg.Done()
|
||||
@@ -187,7 +228,9 @@ func (r *Recorder) Start(fromDev, micDev string, prerollSec int) error {
|
||||
LogSink("recorder: capture from %q failed: %v", DeviceName(fromDev), err)
|
||||
}
|
||||
}()
|
||||
if twoSrc {
|
||||
}
|
||||
|
||||
func (r *Recorder) startMicCapture(micDev string, stop chan struct{}) {
|
||||
r.wg.Add(1)
|
||||
go func() {
|
||||
defer r.wg.Done()
|
||||
@@ -202,8 +245,10 @@ func (r *Recorder) Start(fromDev, micDev string, prerollSec int) error {
|
||||
LogSink("recorder: capture from %q failed: %v", DeviceName(micDev), err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
// finishStart logs what is being recorded and arms the silence watchdog.
|
||||
func (r *Recorder) finishStart(fromDev, micDev string, twoSrc bool, stop chan struct{}) {
|
||||
// Name the devices being recorded FROM, once, at the start.
|
||||
//
|
||||
// A station with two radios has two sets of endpoints, and the recorder will
|
||||
@@ -262,7 +307,6 @@ func (r *Recorder) Start(fromDev, micDev string, prerollSec int) error {
|
||||
}
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
// mixTick drains the source queues, mixes what's available, and appends to the
|
||||
|
||||
+34
-1
@@ -74,6 +74,15 @@ type Flex struct {
|
||||
// end up outside the new window — see ZoomPan.
|
||||
panWindow map[string]panView
|
||||
|
||||
// spotSig is what each live spot LOOKS like, and when it was drawn. A
|
||||
// callsign spotted again with the same frequency, colour and comment does not
|
||||
// need to be removed and re-added: the panadapter would not change by one
|
||||
// pixel, and a busy RBN feed re-spots the same station every few seconds. One
|
||||
// two-minute session sent 2 128 adds and 1 634 removes, 88 of them for a
|
||||
// single callsign — see SendSpot.
|
||||
spotSig map[string]string
|
||||
spotSent map[string]time.Time
|
||||
|
||||
spotByCall map[string]int // callsign → live spot index, so re-spotting a call replaces its old spot (WSJT decodes re-fire every cycle)
|
||||
sentCmds map[int]string // seq → command text, so an R<seq> error names the command
|
||||
|
||||
@@ -205,7 +214,7 @@ func NewFlex(host string, port int, spotsEnabled bool) *Flex {
|
||||
return &Flex{
|
||||
host: strings.TrimSpace(host), port: port,
|
||||
slices: map[int]*flexSlice{}, spotsEnabled: spotsEnabled,
|
||||
spotIdx: map[int]bool{}, pendingSpot: map[int]string{}, pendingSpotMode: map[int]string{}, spotCall: map[int]string{}, spotMode: map[int]string{}, spotFreq: map[int]int64{}, pendingSpotFreq: map[int]int64{}, panWindow: map[string]panView{}, spotByCall: map[string]int{}, pendingSplit: map[int]bool{},
|
||||
spotIdx: map[int]bool{}, pendingSpot: map[int]string{}, pendingSpotMode: map[int]string{}, spotCall: map[int]string{}, spotMode: map[int]string{}, spotFreq: map[int]int64{}, pendingSpotFreq: map[int]int64{}, panWindow: map[string]panView{}, spotSig: map[string]string{}, spotSent: map[string]time.Time{}, spotByCall: map[string]int{}, pendingSplit: map[int]bool{},
|
||||
meterMeta: map[int]meterInfo{}, meterVal: map[int]float64{}, meterSub: map[int]bool{},
|
||||
sentCmds: map[int]string{}, txSetAt: map[string]time.Time{},
|
||||
pinnedSlice: -1,
|
||||
@@ -859,6 +868,13 @@ func (f *Flex) handleStatus(payload string) {
|
||||
}
|
||||
f.mu.Lock()
|
||||
if removed {
|
||||
// The radio expired or dropped this spot: forget what it looked
|
||||
// like, or the next identical spot would be skipped as "already
|
||||
// drawn" and the station would never come back.
|
||||
if c, ok := f.spotCall[idx]; ok {
|
||||
delete(f.spotSig, strings.ToUpper(c))
|
||||
delete(f.spotSent, strings.ToUpper(c))
|
||||
}
|
||||
delete(f.spotIdx, idx)
|
||||
delete(f.spotCall, idx)
|
||||
delete(f.spotMode, idx)
|
||||
@@ -1390,7 +1406,22 @@ func (f *Flex) SendSpot(s SpotInfo) error {
|
||||
// and Go mutexes aren't reentrant (calling send while locked deadlocks the
|
||||
// whole Flex goroutine → the radio drops OFFLINE).
|
||||
upperCall := strings.ToUpper(s.Callsign)
|
||||
// Unchanged and still fresh → leave it alone.
|
||||
//
|
||||
// Refreshed once past half its lifetime, so a long-lived spot still gets its
|
||||
// timer wound on and never quietly expires off the panadapter; anything that
|
||||
// actually differs (a new frequency, a status that has changed colour, a
|
||||
// different comment) is redrawn at once.
|
||||
sig := fmt.Sprintf("%d|%s|%s|%s|%s", s.FreqHz, s.Mode, s.Color, s.BackgroundColor, s.Comment)
|
||||
f.mu.Lock()
|
||||
if prev, ok := f.spotSig[upperCall]; ok && prev == sig {
|
||||
if at, ok := f.spotSent[upperCall]; ok && time.Since(at) < time.Duration(life)*time.Second/2 {
|
||||
f.mu.Unlock()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
f.spotSig[upperCall] = sig
|
||||
f.spotSent[upperCall] = time.Now()
|
||||
old, hadOld := f.spotByCall[upperCall]
|
||||
if hadOld {
|
||||
delete(f.spotByCall, upperCall)
|
||||
@@ -1464,6 +1495,8 @@ func (f *Flex) ClearSpots() error {
|
||||
f.spotCall = map[int]string{}
|
||||
f.spotMode = map[int]string{}
|
||||
f.spotFreq = map[int]int64{}
|
||||
f.spotSig = map[string]string{}
|
||||
f.spotSent = map[string]time.Time{}
|
||||
f.spotByCall = map[string]int{}
|
||||
connected := f.conn != nil
|
||||
f.mu.Unlock()
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package cat
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"hamlog/internal/cat/civ"
|
||||
)
|
||||
|
||||
// A CI-V bus can carry a second controller, and the rig answers each of them on
|
||||
// the same wire. A reply addressed to somebody else must not be taken for ours —
|
||||
// on an IC-7850 one arrived between a PTT command and its acknowledgement, the
|
||||
// acknowledgement was never matched, and the failure was handed to JTDX as a rig
|
||||
// control error.
|
||||
func TestForeignCIVRepliesAreIgnored(t *testing.T) {
|
||||
const rig = 0x8E
|
||||
frames, _ := civ.Scan([]byte{
|
||||
0xFE, 0xFE, 0x01, rig, 0x1C, 0x00, 0x01, 0xFD, // to controller 01 — not ours
|
||||
0xFE, 0xFE, civ.AddrController, rig, 0xFB, 0xFD, // to us: the acknowledgement
|
||||
0xFE, 0xFE, 0x00, rig, 0x00, 0x00, 0x25, 0x09, 0x14, 0x00, 0xFD, // transceive broadcast
|
||||
})
|
||||
if len(frames) != 3 {
|
||||
t.Fatalf("scanned %d frames, want 3", len(frames))
|
||||
}
|
||||
var kept []civ.Decoded
|
||||
for _, f := range frames {
|
||||
if f.From != rig {
|
||||
continue
|
||||
}
|
||||
if f.To != civ.AddrController && f.To != 0x00 {
|
||||
continue
|
||||
}
|
||||
kept = append(kept, f)
|
||||
}
|
||||
if len(kept) != 2 {
|
||||
t.Fatalf("kept %d frames, want 2 (ours + the broadcast)", len(kept))
|
||||
}
|
||||
if kept[0].Cmd != 0xFB {
|
||||
t.Errorf("the acknowledgement was not the first kept frame: % X", kept[0].Cmd)
|
||||
}
|
||||
if kept[1].To != 0x00 {
|
||||
t.Errorf("the transceive broadcast was dropped")
|
||||
}
|
||||
}
|
||||
@@ -514,8 +514,21 @@ func (b *IcomSerial) SetFrequency(hz int64) error {
|
||||
return fmt.Errorf("invalid frequency")
|
||||
}
|
||||
b.lastSetFreq, b.lastSetFreqAt = hz, time.Now()
|
||||
return b.execIdempotent(fmt.Sprintf("set frequency %d Hz", hz),
|
||||
err := b.execIdempotent(fmt.Sprintf("set frequency %d Hz", hz),
|
||||
append([]byte{civ.CmdSetFreq}, civ.FreqToBCD(hz)...)...)
|
||||
// Same reasoning as SetPTT: a lost acknowledgement is not a failed command,
|
||||
// and WSJT-X or JTDX answer a failed set_freq by dropping the link — an
|
||||
// IC-7850 log shows exactly that at 15:16:15, the disconnect four seconds
|
||||
// later. The rig is asked what frequency it is on rather than being called a
|
||||
// failure on the strength of a missing "FB".
|
||||
if err == nil || !errors.Is(err, errIcomAckLost) {
|
||||
return err
|
||||
}
|
||||
if got, rerr := b.readFreq(); rerr == nil && got == hz {
|
||||
applog.Printf("icom: frequency %d Hz not acknowledged, but the rig is on it — treating as done", hz)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (b *IcomSerial) SetMode(mode string) error {
|
||||
@@ -526,8 +539,17 @@ func (b *IcomSerial) SetMode(mode string) error {
|
||||
// Set the base mode (keeping the rig's current filter by sending only the
|
||||
// mode byte), then set the data-mode flag for digital modes.
|
||||
if err := b.execIdempotent("set mode "+mode, civ.CmdSetMode, code); err != nil {
|
||||
// A lost acknowledgement is not a refused mode — see SetPTT. The mode is
|
||||
// readable, so ask rather than report a failure that would cost the
|
||||
// digital application its connection.
|
||||
if !errors.Is(err, errIcomAckLost) {
|
||||
return err
|
||||
}
|
||||
if got, ok := b.readMode(); !ok || got != code {
|
||||
return err
|
||||
}
|
||||
applog.Printf("icom: mode %s not acknowledged, but the rig reports it — treating as done", mode)
|
||||
}
|
||||
dataByte := byte(0)
|
||||
if data {
|
||||
dataByte = 1
|
||||
@@ -569,12 +591,43 @@ func (b *IcomSerial) execIdempotent(what string, payload ...byte) error {
|
||||
}
|
||||
|
||||
// SetPTT keys or unkeys the transmitter (CI-V 0x1C 0x00).
|
||||
// A lost acknowledgement is NOT proof the rig ignored us, and treating it as one
|
||||
// is expensive: OpsLog fronts a Hamlib rigctl port, so the failure is handed
|
||||
// straight to WSJT-X or JTDX, which answer a failed set_ptt with a Rig Control
|
||||
// Error and drop the link mid-over. An IC-7850 log showed exactly that, three
|
||||
// times in a session, on a CI-V bus with a second controller corrupting frames.
|
||||
//
|
||||
// So when the acknowledgement does not arrive, ASK the rig what it is doing. PTT
|
||||
// is readable (0x1C 0x00), the answer is unambiguous, and a rig that is keyed
|
||||
// received the command whatever became of its reply.
|
||||
func (b *IcomSerial) SetPTT(on bool) error {
|
||||
state := byte(0)
|
||||
if on {
|
||||
state = 1
|
||||
}
|
||||
return b.execIdempotent(fmt.Sprintf("PTT %v", on), civ.CmdPTT, civ.SubPTT, state)
|
||||
err := b.execIdempotent(fmt.Sprintf("PTT %v", on), civ.CmdPTT, civ.SubPTT, state)
|
||||
if err == nil || !errors.Is(err, errIcomAckLost) {
|
||||
return err
|
||||
}
|
||||
// A GENEROUS window for the verification, not the poll's 150 ms.
|
||||
//
|
||||
// The rig has just failed to answer twice in 800 ms, and the reason seen on a
|
||||
// real IC-7850 is that it was retuning: JTDX moves the transmit frequency and
|
||||
// keys in the same breath. Asking it again with the short probe timeout would
|
||||
// fail for exactly the same reason and prove nothing.
|
||||
keyed, ok := b.readTXWithin(icomPTTVerifyTimeout)
|
||||
if ok && keyed == on {
|
||||
applog.Printf("icom: PTT %v not acknowledged, but the rig reports it — treating as done", on)
|
||||
return nil
|
||||
}
|
||||
// Logged either way, because "the fix did not work" and "the rig really did
|
||||
// not key" look identical from outside and need telling apart.
|
||||
if ok {
|
||||
applog.Printf("icom: PTT %v not acknowledged, and the rig reports %v — reporting the failure", on, keyed)
|
||||
} else {
|
||||
applog.Printf("icom: PTT %v not acknowledged, and the rig did not answer the check either", on)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SetPower turns the transceiver on or off (CI-V 0x18). Power-ON is prefixed with
|
||||
@@ -686,6 +739,19 @@ func (b *IcomSerial) reader(port civTransport, done chan struct{}) {
|
||||
if f.From != b.rigAddr {
|
||||
continue // echo of our own command
|
||||
}
|
||||
// Addressed to US, or broadcast.
|
||||
//
|
||||
// A CI-V bus can carry a second controller — RS-BA1, wfview, another
|
||||
// logger — and the rig answers each of them in turn on the same wire.
|
||||
// Those replies come FROM the rig, so the check above lets them through,
|
||||
// and one can be taken for the answer to our own command: an IC-7850 log
|
||||
// showed "FE FE 01 8E …" (to controller 01) arriving between our PTT
|
||||
// command and its acknowledgement, with bus collisions around it.
|
||||
// Transceive broadcasts (to 0x00) stay welcome — that is how the rig
|
||||
// announces a knob turn.
|
||||
if f.To != civ.AddrController && f.To != 0x00 {
|
||||
continue
|
||||
}
|
||||
if f.Cmd == civ.CmdScope {
|
||||
b.route(b.specCh, f)
|
||||
continue
|
||||
@@ -1273,16 +1339,30 @@ func (b *IcomSerial) readTXFreq() (int64, bool) {
|
||||
|
||||
// readTX reads the transmit state (CI-V 0x1C 0x00): non-zero data = keyed.
|
||||
func (b *IcomSerial) readTX() bool {
|
||||
on, _ := b.readTXWithin(icomDSPTimeout)
|
||||
return on
|
||||
}
|
||||
|
||||
// icomPTTVerifyTimeout is how long the PTT check waits. Long, deliberately: it
|
||||
// runs only after a command was already given up on, so it costs nothing in the
|
||||
// normal case and everything depends on it in the abnormal one.
|
||||
const icomPTTVerifyTimeout = 700 * time.Millisecond
|
||||
|
||||
// readTXWithin reads the transmit state, reporting whether the rig ANSWERED.
|
||||
//
|
||||
// The two are different questions and the caller usually needs both: "not
|
||||
// transmitting" and "did not say" are the same bool but not the same fact.
|
||||
func (b *IcomSerial) readTXWithin(timeout time.Duration) (on bool, answered bool) {
|
||||
if err := b.write(civ.CmdPTT, civ.SubPTT); err != nil {
|
||||
return false
|
||||
return false, false
|
||||
}
|
||||
f, err := b.recv(icomDSPTimeout, func(d civ.Decoded) bool {
|
||||
f, err := b.recv(timeout, func(d civ.Decoded) bool {
|
||||
return d.Cmd == civ.CmdPTT && len(d.Data) >= 2 && d.Data[0] == civ.SubPTT
|
||||
})
|
||||
if err != nil {
|
||||
return false
|
||||
return false, false
|
||||
}
|
||||
return f.Data[1] != 0
|
||||
return f.Data[1] != 0, true
|
||||
}
|
||||
|
||||
// readMeter reads a meter (CI-V 0x15) and returns it scaled to 0-100.
|
||||
|
||||
@@ -500,10 +500,30 @@ func (o *OmniRig) SetFrequency(hz int64) error {
|
||||
// deliberately; a spot click is a request to change frequency, not to change
|
||||
// VFO. On SUB the direct FreqB write below does the whole job.
|
||||
onSubVFO := vfo == "B" || vfo == "BB" || vfo == "BA"
|
||||
// …and NEVER on a Yaesu.
|
||||
//
|
||||
// On Yaesu the call is useless at best: an FT-891 logged "SetSimplexMode OK"
|
||||
// on every spot click while FreqA never moved (see below — the direct property
|
||||
// write is what actually tunes these rigs). On an FT-2000 it is worse than
|
||||
// useless. From a log of one QSY, before and after the call:
|
||||
//
|
||||
// Vfo="AB"(0x80) Split=0x10000 (off) → the operator's state
|
||||
// Vfo="BA"(0x100) Split=0x8000 (ON) → after SetSimplexMode
|
||||
//
|
||||
// The rig-agnostic "receive and transmit HERE, simplex" method turned split ON
|
||||
// and moved reception to VFO B, which is exactly what the operator reported:
|
||||
// OpsLog showing B instead of A. OpsLog was not misreading the radio — it was
|
||||
// reading it correctly after having moved it itself.
|
||||
//
|
||||
// Restricted to Yaesu because that is where the evidence is: on Icom the call
|
||||
// is authoritative and the direct write is the unreliable one.
|
||||
isYaesu := isYaesuRig(rigType)
|
||||
simplexOK := false
|
||||
switch {
|
||||
case onSubVFO:
|
||||
debugLog.Printf("OmniRig.SetFrequency: on VFO %q — skipping SetSimplexMode so the rig stays on SUB", vfo)
|
||||
case isYaesu:
|
||||
debugLog.Printf("OmniRig.SetFrequency: %q is a Yaesu — skipping SetSimplexMode (a no-op on some, and on an FT-2000 it turns split on and jumps to VFO B); the direct write below does the work", rigType)
|
||||
default:
|
||||
if _, err := oleutil.CallMethod(o.rig, "SetSimplexMode", int32(hz32)); err == nil {
|
||||
simplexOK = true
|
||||
|
||||
@@ -125,3 +125,24 @@ func TestOmniRigWriteTarget(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SetSimplexMode is skipped on Yaesu, and that is not a preference.
|
||||
//
|
||||
// On an FT-891 it returned OK on every spot click while the rig never moved. On
|
||||
// an FT-2000 it did something worse — a log of one QSY shows the state going
|
||||
// from Vfo="AB" split off to Vfo="BA" split ON, so the operator's reception
|
||||
// jumped to VFO B and OpsLog, reading the radio correctly, displayed B. The
|
||||
// direct FreqA/Freq write does the tuning on these rigs.
|
||||
func TestYaesuRigsAreRecognisedForTheSimplexSkip(t *testing.T) {
|
||||
for _, yes := range []string{"FT-2000", "FT-891", "FTDX10", "ftdx101", " FT-991A "} {
|
||||
if !isYaesuRig(yes) {
|
||||
t.Errorf("%q not recognised as a Yaesu — SetSimplexMode would still be called on it", yes)
|
||||
}
|
||||
}
|
||||
// Everything else keeps the call: on Icom it is the authoritative one.
|
||||
for _, no := range []string{"IC-7610", "TS-590", "K3", "", "Flex-6600"} {
|
||||
if isYaesuRig(no) {
|
||||
t.Errorf("%q wrongly treated as a Yaesu", no)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+124
-20
@@ -24,6 +24,16 @@ const keySpotColors = "flex.spot_colors"
|
||||
type SpotColor struct {
|
||||
Text string `json:"text"`
|
||||
Bg string `json:"bg,omitempty"`
|
||||
// Hide keeps this status OFF the panadapter entirely.
|
||||
//
|
||||
// Expressed as "hide" and not "send" so the zero value means SEND: every
|
||||
// palette stored before this existed has to keep behaving as it did, and a
|
||||
// missing field must never be read as "the operator turned this off".
|
||||
//
|
||||
// A colour and a switch rather than one control: the operator who stops
|
||||
// drawing already-worked stations today may want them back tomorrow, and
|
||||
// their colour should still be there when they do.
|
||||
Hide bool `json:"hide,omitempty"`
|
||||
}
|
||||
|
||||
// SpotColors is the whole palette, keyed by the status names the cluster uses.
|
||||
@@ -97,14 +107,17 @@ func normSpotColors(s SpotColors) SpotColors {
|
||||
if !known[k] {
|
||||
continue
|
||||
}
|
||||
c := SpotColor{}
|
||||
c := SpotColor{Hide: v.Hide}
|
||||
if hexARGB(v.Text) {
|
||||
c.Text = strings.ToUpper(strings.TrimSpace(v.Text))
|
||||
}
|
||||
if hexARGB(v.Bg) {
|
||||
c.Bg = strings.ToUpper(strings.TrimSpace(v.Bg))
|
||||
}
|
||||
if c.Text != "" || c.Bg != "" {
|
||||
// Kept when it carries ANY decision — a status with no colours but "hide"
|
||||
// set is a real instruction, and dropping it would silently switch that
|
||||
// status back on.
|
||||
if c.Text != "" || c.Bg != "" || c.Hide {
|
||||
out.Colors[k] = c
|
||||
}
|
||||
}
|
||||
@@ -190,36 +203,127 @@ func (a *App) spotColorFor(status string) SpotColor {
|
||||
func spotStatusTag(status string) string {
|
||||
switch status {
|
||||
case "new":
|
||||
return "NEW DXCC"
|
||||
return "New DXCC"
|
||||
case "new-band-mode":
|
||||
return "NEW BAND+MODE"
|
||||
return "New B&M"
|
||||
case "new-band":
|
||||
return "NEW BAND"
|
||||
return "New Band"
|
||||
case "new-mode":
|
||||
return "NEW MODE"
|
||||
return "New Mode"
|
||||
case "new-slot":
|
||||
return "NEW SLOT"
|
||||
return "New Slot"
|
||||
case "new-pota":
|
||||
return "NEW POTA"
|
||||
return "New POTA"
|
||||
case "new-county":
|
||||
return "NEW COUNTY"
|
||||
return "New Cnty"
|
||||
case "new-pfx":
|
||||
return "NEW PFX"
|
||||
return "New Pfx"
|
||||
case "my-call":
|
||||
return "ME"
|
||||
return "Me"
|
||||
case "worked":
|
||||
return "Worked"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// spotComment appends the status tag to the cluster's own comment.
|
||||
func spotComment(comment, status string) string {
|
||||
c := strings.TrimSpace(comment)
|
||||
tag := spotStatusTag(status)
|
||||
if tag == "" {
|
||||
return c
|
||||
// spotComment builds what the panadapter shows under a spot:
|
||||
//
|
||||
// CQ up 2 [F4BPO] [Franz Josef Land] [New Slot]
|
||||
//
|
||||
// the cluster's own text, then WHO spotted it, then the entity, then what it is
|
||||
// worth. Same order and same shape as DXHunter, whose users read these at a
|
||||
// glance and should not have to learn a second convention.
|
||||
//
|
||||
// # The spaces are not spaces
|
||||
//
|
||||
// SmartSDR's command line separates parameters ON SPACES, so a comment written
|
||||
// with ordinary ones arrives at the radio as "CQup2[F4BPO]" — every word run
|
||||
// together, which is exactly how ours looked. Non-breaking spaces (U+00A0) pass
|
||||
// through the parser untouched and render as spaces on the panadapter. This is
|
||||
// the trick DXHunter uses, and there is no other way to get a readable comment
|
||||
// through that protocol.
|
||||
func spotComment(comment, spotter, country, status string) string {
|
||||
var b strings.Builder
|
||||
add := func(s string) {
|
||||
s = strings.TrimSpace(s)
|
||||
if s == "" {
|
||||
return
|
||||
}
|
||||
if c == "" {
|
||||
return "[" + tag + "]"
|
||||
if b.Len() > 0 {
|
||||
b.WriteString(" ")
|
||||
}
|
||||
return c + " [" + tag + "]"
|
||||
b.WriteString(s)
|
||||
}
|
||||
// The radio has the last word on length: a comment past roughly sixty
|
||||
// characters comes back from SmartSDR cut mid-word — one was echoed as
|
||||
// "…[European Russia" with the closing bracket and the status gone. So the
|
||||
// parts are added in order of what an operator would keep, and the cluster's
|
||||
// own words — the longest and the least specific — are the ones trimmed.
|
||||
// The cluster's own text arrives padded: RBN lines are column-aligned, so a
|
||||
// comment reads "FT8 5 dB LN14 CQ" with runs of spaces holding the
|
||||
// columns apart. Those runs became runs of NON-BREAKING spaces, which the
|
||||
// panadapter faithfully rendered as a gap wide enough to push the rest of the
|
||||
// comment off the screen. Columns mean nothing once the text is out of its
|
||||
// table: one space between words.
|
||||
comment = strings.Join(strings.Fields(comment), " ")
|
||||
tag := bracket(spotStatusTag(status))
|
||||
spot := bracket(spotter)
|
||||
cty := bracket(country)
|
||||
room := panCommentMax - len(tag) - len(spot) - len(cty) - 3 // 3 separators
|
||||
add(trimTo(comment, room))
|
||||
add(spot)
|
||||
add(cty)
|
||||
add(tag)
|
||||
// Every space, including the ones already inside the cluster's comment.
|
||||
return strings.ReplaceAll(b.String(), " ", "\u00A0")
|
||||
}
|
||||
|
||||
// panCommentMax is what SmartSDR keeps of a spot comment. Measured against a
|
||||
// real radio's own status echo, with a margin: the cost of being wrong is a
|
||||
// comment cut mid-word, and nothing in the protocol reports the limit.
|
||||
const panCommentMax = 58
|
||||
|
||||
// trimTo shortens s to at most n characters, on a word boundary when it can.
|
||||
// A negative or tiny budget yields nothing at all — the brackets that follow
|
||||
// matter more than a two-letter fragment of the cluster's text.
|
||||
func trimTo(s string, n int) string {
|
||||
s = strings.TrimSpace(s)
|
||||
if n < 4 {
|
||||
return ""
|
||||
}
|
||||
if len(s) <= n {
|
||||
return s
|
||||
}
|
||||
cut := s[:n]
|
||||
if i := strings.LastIndex(cut, " "); i > n/2 {
|
||||
cut = cut[:i]
|
||||
}
|
||||
return strings.TrimSpace(cut)
|
||||
}
|
||||
|
||||
// bracket wraps a non-empty value in square brackets.
|
||||
func bracket(s string) string {
|
||||
s = strings.TrimSpace(s)
|
||||
if s == "" {
|
||||
return ""
|
||||
}
|
||||
return "[" + s + "]"
|
||||
}
|
||||
|
||||
// spotHidden reports whether this status should stay off the panadapter.
|
||||
//
|
||||
// Read from the same cached palette as the colours — see spotColorFor — because
|
||||
// it is consulted on every spot from every cluster.
|
||||
func (a *App) spotHidden(status string) bool {
|
||||
a.spotColorsMu.Lock()
|
||||
if a.spotColorsCache == nil {
|
||||
c := a.GetSpotColors()
|
||||
a.spotColorsCache = &c
|
||||
}
|
||||
p := a.spotColorsCache
|
||||
a.spotColorsMu.Unlock()
|
||||
if c, ok := p.Colors[status]; ok {
|
||||
return c.Hide
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
+109
-18
@@ -1,6 +1,9 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// A colour the Flex refuses is a spot that never appears, and the command error
|
||||
// goes to a log nobody is reading. Anything that is not #AARRGGBB must be
|
||||
@@ -47,30 +50,118 @@ func TestNormSpotColors(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSpotComment(t *testing.T) {
|
||||
// The cluster's own text is kept: it carries the signal report and the
|
||||
// operator's note, which is why the spot is readable in the first place.
|
||||
if got := spotComment("CQ up 2", "new"); got != "CQ up 2 [NEW DXCC]" {
|
||||
t.Fatalf("got %q", got)
|
||||
// What the panadapter shows: the cluster's words, who spotted it, the entity,
|
||||
// then what it is worth — DXHunter's order, so an operator reads one
|
||||
// convention and not two.
|
||||
got := spotComment("CQ up 2", "F4BPO", "Franz Josef Land", "new-slot")
|
||||
want := "CQ up 2 [F4BPO] [Franz Josef Land] [New Slot]"
|
||||
if plain(got) != want {
|
||||
t.Fatalf("got %q, want %q", plain(got), want)
|
||||
}
|
||||
// An empty comment must not produce a leading space on the panadapter.
|
||||
if got := spotComment("", "new-band"); got != "[NEW BAND]" {
|
||||
t.Fatalf("got %q", got)
|
||||
// EVERY space is non-breaking, the ones inside the cluster comment included:
|
||||
// SmartSDR splits its command line on spaces, so a real one truncates the
|
||||
// comment at the first word.
|
||||
if strings.Contains(got, " ") {
|
||||
t.Fatalf("an ordinary space survived: %q", got)
|
||||
}
|
||||
// Nothing to say about a station already in the log.
|
||||
if got := spotComment("loud", "worked"); got != "loud" {
|
||||
t.Fatalf("got %q", got)
|
||||
if !strings.Contains(got, " ") {
|
||||
t.Fatal("no non-breaking space in the comment")
|
||||
}
|
||||
if got := spotComment("loud", "none"); got != "loud" {
|
||||
t.Fatalf("got %q", got)
|
||||
// Missing parts leave no empty brackets and no double separators.
|
||||
if p := plain(spotComment("", "", "", "new")); p != "[New DXCC]" {
|
||||
t.Fatalf("got %q", p)
|
||||
}
|
||||
// Every colourable status except the two quiet ones is labelled, or the
|
||||
if p := plain(spotComment("CQ", "", "Spain", "")); p != "CQ [Spain]" {
|
||||
t.Fatalf("got %q", p)
|
||||
}
|
||||
// A status with nothing to announce contributes no tag.
|
||||
if p := plain(spotComment("loud", "DL1ABC", "Germany", "none")); p != "loud [DL1ABC] [Germany]" {
|
||||
t.Fatalf("got %q", p)
|
||||
}
|
||||
// Every colourable status except the unresolved one is labelled, or the
|
||||
// palette would say something the text does not.
|
||||
for _, s := range spotColorOrder {
|
||||
if s == "worked" || s == "none" {
|
||||
for _, st := range spotColorOrder {
|
||||
if st == "none" {
|
||||
continue
|
||||
}
|
||||
if spotStatusTag(s) == "" {
|
||||
t.Fatalf("status %q has a colour but no tag", s)
|
||||
if spotStatusTag(st) == "" {
|
||||
t.Fatalf("status %q has a colour but no tag", st)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// plain puts the ordinary spaces back, for readable assertions.
|
||||
func plain(s string) string { return strings.ReplaceAll(s, " ", " ") }
|
||||
|
||||
// The per-status switch must survive a save with no colours on that row: it is
|
||||
// an instruction in its own right, and dropping it would quietly turn the status
|
||||
// back on. And a palette written before the switch existed must keep sending
|
||||
// everything — "no field" is not "the operator turned this off".
|
||||
func TestSpotColorHideSurvivesNormalisation(t *testing.T) {
|
||||
in := SpotColors{Enabled: true, Colors: map[string]SpotColor{
|
||||
"worked": {Hide: true}, // no colours, just the switch
|
||||
"new": {Text: "#FFFF3B30", Hide: true}, // both
|
||||
"none": {Text: "not a colour"}, // neither survives
|
||||
"new-band": {Text: "#FFFFCC00"}, // colour only
|
||||
}}
|
||||
out := normSpotColors(in)
|
||||
if c, ok := out.Colors["worked"]; !ok || !c.Hide {
|
||||
t.Error("a status hidden with no colour was dropped")
|
||||
}
|
||||
if c := out.Colors["new"]; !c.Hide || c.Text != "#FFFF3B30" {
|
||||
t.Errorf("hide and colour did not both survive: %+v", c)
|
||||
}
|
||||
if _, ok := out.Colors["none"]; ok {
|
||||
t.Error("an entry with nothing valid in it was kept")
|
||||
}
|
||||
if c := out.Colors["new-band"]; c.Hide {
|
||||
t.Error("a colour-only entry came back hidden")
|
||||
}
|
||||
// An older palette says nothing about hiding, and must send everything.
|
||||
old := normSpotColors(SpotColors{Enabled: true, Colors: map[string]SpotColor{"new": {Text: "#FFFF3B30"}}})
|
||||
if old.Colors["new"].Hide {
|
||||
t.Error("a palette from before the switch existed came back hidden")
|
||||
}
|
||||
}
|
||||
|
||||
// SmartSDR cuts a long comment mid-word — one came back from the radio as
|
||||
// "…[European Russia", losing its closing bracket and its status. What the
|
||||
// operator would keep must therefore survive: the spotter, the entity and the
|
||||
// status, with the cluster's own words trimmed to fit.
|
||||
func TestSpotCommentFitsTheRadio(t *testing.T) {
|
||||
long := "FT8 5 dB LN14 CQ DX FROM A VERY TALKATIVE SKIMMER NODE INDEED"
|
||||
got := plain(spotComment(long, "OH6BG-#", "European Russia", "new-band"))
|
||||
if len(got) > panCommentMax {
|
||||
t.Fatalf("comment is %d chars, over the %d the radio keeps: %q", len(got), panCommentMax, got)
|
||||
}
|
||||
for _, must := range []string{"[OH6BG-#]", "[European Russia]", "[New Band]"} {
|
||||
if !strings.Contains(got, must) {
|
||||
t.Errorf("%s was trimmed away — the cluster text should go first: %q", must, got)
|
||||
}
|
||||
}
|
||||
// A short comment is left exactly as it is.
|
||||
short := plain(spotComment("CQ", "K1ABC", "Spain", "new"))
|
||||
if short != "CQ [K1ABC] [Spain] [New DXCC]" {
|
||||
t.Fatalf("got %q", short)
|
||||
}
|
||||
// No room at all for the cluster's words: they go, the brackets stay.
|
||||
tight := plain(spotComment("CQ DX UP 2 LISTENING", "VERYLONGSPOTTER-#", "Democratic Republic of the Congo", "new"))
|
||||
if strings.Contains(tight, "LISTENING") {
|
||||
t.Errorf("kept the cluster text at the expense of the tags: %q", tight)
|
||||
}
|
||||
}
|
||||
|
||||
// RBN lines are column-aligned, so a comment arrives as "FT8 5 dB LN14
|
||||
// CQ". Preserved as non-breaking spaces, those runs rendered on the panadapter
|
||||
// as a gap wide enough to push the rest of the comment off the screen.
|
||||
func TestSpotCommentCollapsesClusterPadding(t *testing.T) {
|
||||
got := plain(spotComment("FT8 -13 dB CQ", "WC2L-#", "United States", "new"))
|
||||
want := "FT8 -13 dB CQ [WC2L-#] [United States] [New DXCC]"
|
||||
if got != want {
|
||||
t.Fatalf("got %q\nwant %q", got, want)
|
||||
}
|
||||
// Tabs and newlines are padding too.
|
||||
if p := plain(spotComment("CQ\t\tDX\n", "K1ABC", "", "")); p != "CQ DX [K1ABC]" {
|
||||
t.Fatalf("got %q", p)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
// appVersion is stamped on every heartbeat (and could feed the About box).
|
||||
appVersion = "0.26.5"
|
||||
appVersion = "0.26.7"
|
||||
|
||||
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
|
||||
// to https://us.i.posthog.com for a US project.
|
||||
|
||||
Reference in New Issue
Block a user