fix: release TX when the elements stop; WSJT-X colours, and worked beats the watch list

The motorised antenna gagged the transmitter for a second or two after it
had finished moving. Three delays were stacked: the antenna polled every
two seconds, the gag held for three after the command whatever the
antenna said, and the widget refreshed every three. The antenna is now
asked four times a second WHILE IT MOVES — an idle one has nothing to say
and stays at two seconds — the gag only bridges the command itself
(900 ms), and the widget follows at half a second while moving.

WSJT-X highlighting:

- A watch-list station already worked on this band and mode is no longer
  painted as one to call. The list is a statement of intent, not of what
  is left to do, and its pink outranked every other verdict including the
  log's, so a worked station stayed pink for the session with nothing to
  tell it from one still needed.
- The four colours are the operator's to choose (Settings → UDP). Only
  the background: the text colour is derived by luma, so a dark blue
  cannot come back as black-on-black in somebody else's window. Changing
  one clears the installed highlights, or the de-duplication would keep
  showing yesterday's colour until a callsign changed verdict.
This commit is contained in:
2026-09-06 18:43:08 +02:00
parent 07ee48e20c
commit d001616767
11 changed files with 306 additions and 31 deletions
+47
View File
@@ -0,0 +1,47 @@
package main
import (
"testing"
udp "hamlog/internal/integrations/udp"
)
// The text colour is derived from the background, never stored: an operator who
// picks a dark blue must not end up with black text on it in somebody else's
// window and conclude the feature is broken.
func TestHighlightForegroundFollowsTheBackground(t *testing.T) {
var a App
for _, tc := range []struct {
bg string
want udp.RGB
}{
{"#111827", hlWhite}, // near-black
{"#16823C", hlWhite}, // the new-DXCC green
{"#F472B6", hlBlack}, // the watchlist pink
{"#FFFFFF", hlBlack},
{"#E27A18", hlBlack}, // orange
} {
bg, fg := a.colourFor("", tc.bg)
if got, ok := parseHexRGB(tc.bg); !ok || got != bg {
t.Errorf("%s: background came back as %v", tc.bg, bg)
}
if fg != tc.want {
t.Errorf("%s: foreground %v, want %v", tc.bg, fg, tc.want)
}
}
}
// A colour that cannot be read is refused rather than half-read: silently
// becoming black is worse than keeping the default.
func TestHighlightColourParsing(t *testing.T) {
for _, s := range []string{"#F472B6", "f472b6", " #F472B6 "} {
if c, ok := parseHexRGB(s); !ok || c != (udp.RGB{R: 244, G: 114, B: 182}) {
t.Errorf("%q → %v ok=%v", s, c, ok)
}
}
for _, s := range []string{"", "#FFF", "pink", "#GGGGGG", "#F472B6F"} {
if _, ok := parseHexRGB(s); ok {
t.Errorf("%q was accepted", s)
}
}
}