Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a81125eab1 | ||
|
|
bbe1b3ce80 | ||
|
|
5e80c27f61 |
@@ -245,15 +245,16 @@ const (
|
||||
keyMotorBandFreqs = "motor.band_freqs" // per-band tune frequency: "40m=7100,20m=14150"
|
||||
keyChaseNewGrids = "cluster.chase_grids" // "1" → persist learnt locators across restarts
|
||||
keyRowColors = "appearance.row_colors"
|
||||
keyMotorType = "ultrabeam.type" // "ultrabeam" | "steppir" (default ultrabeam)
|
||||
keyMotorTransport = "ultrabeam.transport" // "tcp" | "serial" (default tcp)
|
||||
keyMotorCOM = "ultrabeam.com" // serial device name (COM3, /dev/ttyUSB0)
|
||||
keyMotorBaud = "ultrabeam.baud" // serial baud (SteppIR default 9600)
|
||||
keyMotorTXInhibit = "ultrabeam.tx_inhibit" // "1" → block Flex TX while the antenna is moving
|
||||
keyMotorFreqMin = "ultrabeam.freq_min" // SteppIR tunable range low edge (MHz); out-of-range = don't follow/inhibit
|
||||
keyMotorFreqMax = "ultrabeam.freq_max" // SteppIR tunable range high edge (MHz)
|
||||
keyMotorBands = "ultrabeam.bands" // CSV of bands the antenna covers (e.g. "40m,20m,17m,…"); the follow filter
|
||||
keyStationDevices = "station.devices" // JSON list of relay boards for the Station Control tab
|
||||
keyMatrixColors = "appearance.matrix_colors" // band/mode matrix palette overrides
|
||||
keyMotorType = "ultrabeam.type" // "ultrabeam" | "steppir" (default ultrabeam)
|
||||
keyMotorTransport = "ultrabeam.transport" // "tcp" | "serial" (default tcp)
|
||||
keyMotorCOM = "ultrabeam.com" // serial device name (COM3, /dev/ttyUSB0)
|
||||
keyMotorBaud = "ultrabeam.baud" // serial baud (SteppIR default 9600)
|
||||
keyMotorTXInhibit = "ultrabeam.tx_inhibit" // "1" → block Flex TX while the antenna is moving
|
||||
keyMotorFreqMin = "ultrabeam.freq_min" // SteppIR tunable range low edge (MHz); out-of-range = don't follow/inhibit
|
||||
keyMotorFreqMax = "ultrabeam.freq_max" // SteppIR tunable range high edge (MHz)
|
||||
keyMotorBands = "ultrabeam.bands" // CSV of bands the antenna covers (e.g. "40m,20m,17m,…"); the follow filter
|
||||
keyStationDevices = "station.devices" // JSON list of relay boards for the Station Control tab
|
||||
|
||||
// Antenna Genius (4O3A) antenna switch — Hardware → Antenna Genius. TCP
|
||||
// port is fixed at 9007, so only the IP is configurable.
|
||||
|
||||
@@ -138,6 +138,70 @@ func normRowColors(s RowColorSettings) RowColorSettings {
|
||||
return out
|
||||
}
|
||||
|
||||
// MatrixColors recolours the band/mode matrix — the PH/CW/DIG grid in the Stats
|
||||
// panel, whose five fills and current-entry ring are the fastest read in the
|
||||
// whole app and the one an operator is most likely to want in their own colours.
|
||||
//
|
||||
// Every colour is OPTIONAL and an empty one keeps whatever the active theme
|
||||
// paints. That is why this stores OVERRIDES rather than a palette: each of the
|
||||
// twelve themes ships a matrix ramp tuned to its own background, and an operator
|
||||
// who only wants a different green must not thereby freeze the other four to the
|
||||
// theme they happened to be using the day they picked it.
|
||||
type MatrixColors struct {
|
||||
// Enabled off leaves the theme's own ramp untouched, so switching it off is a
|
||||
// genuine revert and not "some other set of colours".
|
||||
Enabled bool `json:"enabled"`
|
||||
CallConfirmed string `json:"call_confirmed"`
|
||||
CallWorked string `json:"call_worked"`
|
||||
EntityConfirmed string `json:"entity_confirmed"`
|
||||
EntityWorked string `json:"entity_worked"`
|
||||
NotWorked string `json:"not_worked"`
|
||||
CurrentEntry string `json:"current_entry"`
|
||||
}
|
||||
|
||||
// normMatrixColors keeps only plain hex values. Anything else becomes "" — i.e.
|
||||
// "use the theme's" — because these are written straight into a CSS custom
|
||||
// property, and the same rule as hexColor's own comment applies: what cannot be
|
||||
// trusted into a stylesheet is refused rather than passed through.
|
||||
func normMatrixColors(c MatrixColors) MatrixColors {
|
||||
clean := func(s string) string {
|
||||
s = strings.TrimSpace(s)
|
||||
if hexColor.MatchString(s) {
|
||||
return strings.ToLower(s)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
return MatrixColors{
|
||||
Enabled: c.Enabled,
|
||||
CallConfirmed: clean(c.CallConfirmed),
|
||||
CallWorked: clean(c.CallWorked),
|
||||
EntityConfirmed: clean(c.EntityConfirmed),
|
||||
EntityWorked: clean(c.EntityWorked),
|
||||
NotWorked: clean(c.NotWorked),
|
||||
CurrentEntry: clean(c.CurrentEntry),
|
||||
}
|
||||
}
|
||||
|
||||
// GetMatrixColors returns the operator's matrix palette overrides. All-empty
|
||||
// (the default) means "whatever the theme says".
|
||||
func (a *App) GetMatrixColors() MatrixColors {
|
||||
var c MatrixColors
|
||||
if raw := a.settingOr(keyMatrixColors, ""); raw != "" {
|
||||
_ = json.Unmarshal([]byte(raw), &c)
|
||||
}
|
||||
return normMatrixColors(c)
|
||||
}
|
||||
|
||||
// SaveMatrixColors persists them.
|
||||
func (a *App) SaveMatrixColors(c MatrixColors) error {
|
||||
b, err := json.Marshal(normMatrixColors(c))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a.setSetting(keyMatrixColors, string(b))
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetRowColors returns the row-colouring configuration, defaults included so the
|
||||
// panel never has to invent one.
|
||||
func (a *App) GetRowColors() RowColorSettings {
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
[
|
||||
{
|
||||
"version": "0.25.9",
|
||||
"date": "",
|
||||
"en": [
|
||||
"The band/mode matrix colours can be chosen in Appearance, starting from the ones your theme already paints. Its legend is translated too.",
|
||||
"TCI sharing: a refused un-key no longer leaves the rig stuck transmitting, and PTT is dropped if the client dies mid-over.",
|
||||
"Icom: a frequency or mode change whose acknowledgement is lost is sent again, like PTT — losing one made JTDX drop the radio."
|
||||
],
|
||||
"fr": [
|
||||
"Les couleurs de la matrice bandes/modes se choisissent dans Apparence, à partir de celles du thème. Sa légende est traduite aussi.",
|
||||
"Partage TCI : un retour en réception refusé ne laisse plus le poste bloqué en émission, et le PTT retombe si le logiciel meurt.",
|
||||
"Icom : un changement de fréquence ou de mode dont l’accusé se perd est renvoyé, comme le PTT — en perdre un faisait lâcher JTDX."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.25.8",
|
||||
"date": "",
|
||||
|
||||
@@ -94,7 +94,8 @@ import { ShutdownProgress } from '@/components/ShutdownProgress';
|
||||
import { ClusterGrid } from '@/components/ClusterGrid';
|
||||
import { cleanSpotter, inferSpotMode, spotModeCategory, spotStatusKey } from '@/lib/spot';
|
||||
import { applySpotDisplay, readSpotDisplayOptions, spotIsWorked, SPOT_DISPLAY_OPTIONS_EXPOSED } from '@/lib/spotDisplay';
|
||||
import { GetRowColors, GetSpotTTLMinutes, IsNewUSCounty } from '../wailsjs/go/main/App';
|
||||
import { GetMatrixColors, GetRowColors, GetSpotTTLMinutes, IsNewUSCounty } from '../wailsjs/go/main/App';
|
||||
import { applyMatrixColors } from '@/lib/matrixColors';
|
||||
import { WorkedBeforeGrid } from '@/components/WorkedBeforeGrid';
|
||||
import { NetControlPanel } from '@/components/NetControlPanel';
|
||||
import { ContestPanel, CONTEST_DEFAULT, type ContestSession } from '@/components/ContestPanel';
|
||||
@@ -2017,6 +2018,12 @@ export default function App() {
|
||||
// settings dialog closes, which is the only place it changes.
|
||||
const [rowColors, setRowColors] = useState<any>(null);
|
||||
useEffect(() => { GetRowColors().then(setRowColors).catch(() => {}); }, [showSettings]);
|
||||
// Band/mode matrix palette overrides (Settings → Appearance). Stamped onto
|
||||
// <html> rather than held in state: the matrix reads CSS custom properties, so
|
||||
// nothing re-renders and no component has to be told about the colours. Same
|
||||
// reload trigger as the row colours — the settings dialog is where they change,
|
||||
// and the panel already previews live while it is open.
|
||||
useEffect(() => { GetMatrixColors().then((c) => applyMatrixColors(c as any)).catch(() => {}); }, [showSettings]);
|
||||
// Spot lifetime (Settings → DX Cluster). Spots are actually REMOVED rather
|
||||
// than filtered at render: the cluster list, every band map and the counts all
|
||||
// read the same array, so pruning it once is what makes the setting mean the
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { GetRowColors, SaveRowColors } from '../../wailsjs/go/main/App';
|
||||
import { GetMatrixColors, GetRowColors, SaveMatrixColors, SaveRowColors } from '../../wailsjs/go/main/App';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { RowColorSettings } from '@/lib/rowColors';
|
||||
import {
|
||||
MATRIX_VARS, applyMatrixColors, effectiveMatrixColor, emptyMatrixColors,
|
||||
type MatrixColors,
|
||||
} from '@/lib/matrixColors';
|
||||
|
||||
// A fixed palette plus a free picker. Muted values on purpose: they are
|
||||
// composited at low opacity over a dark grid, where a saturated colour reads as
|
||||
@@ -30,6 +34,111 @@ const CHANNEL_LABELS: Record<string, string> = {
|
||||
qsl: 'appr.chQsl', lotw: 'LoTW', eqsl: 'eQSL', qrz: 'QRZ.com',
|
||||
};
|
||||
|
||||
// MatrixColorsSection recolours the band/mode matrix — the PH/CW/DIG grid in the
|
||||
// Stats panel.
|
||||
//
|
||||
// The pickers are seeded from what the matrix is painting RIGHT NOW (the active
|
||||
// theme's ramp, or an existing override), not from a fixed palette: the operator
|
||||
// starts from the colours in front of them and moves one, instead of being
|
||||
// handed six values that may belong to a theme they stopped using. Every change
|
||||
// is applied to the live document at once, so the sample row below is the real
|
||||
// thing rather than a mock-up of it.
|
||||
function MatrixColorsSection() {
|
||||
const { t } = useI18n();
|
||||
const [cfg, setCfg] = useState<MatrixColors | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
setCfg((await GetMatrixColors()) as any);
|
||||
} catch {
|
||||
setCfg(emptyMatrixColors());
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
|
||||
const save = (next: MatrixColors) => {
|
||||
setCfg(next);
|
||||
applyMatrixColors(next); // live, before the round trip — the panel must not lag the choice
|
||||
SaveMatrixColors(next as any).catch(() => {});
|
||||
};
|
||||
|
||||
// Turning it ON with nothing stored would change nothing at all and read as a
|
||||
// broken switch, so the empty slots are filled from the theme's current ramp:
|
||||
// the operator sees six swatches that match the grid and edits from there.
|
||||
const enable = (on: boolean) => {
|
||||
if (!cfg) return;
|
||||
if (!on) {
|
||||
save({ ...cfg, enabled: false });
|
||||
return;
|
||||
}
|
||||
const seeded = { ...cfg, enabled: true };
|
||||
for (const { key, cssVar } of MATRIX_VARS) {
|
||||
if (!String(seeded[key] ?? '').trim()) seeded[key] = effectiveMatrixColor(cssVar);
|
||||
}
|
||||
save(seeded);
|
||||
};
|
||||
|
||||
// Reset clears the overrides but keeps the section switched on, then re-seeds
|
||||
// from the theme — "back to the theme's colours", which is what an operator
|
||||
// means by reset here, rather than "switch the whole feature off".
|
||||
const reset = () => {
|
||||
if (!cfg) return;
|
||||
applyMatrixColors({ ...emptyMatrixColors(), enabled: false });
|
||||
const seeded = { ...emptyMatrixColors(), enabled: true };
|
||||
for (const { key, cssVar } of MATRIX_VARS) seeded[key] = effectiveMatrixColor(cssVar);
|
||||
save(seeded);
|
||||
};
|
||||
|
||||
if (!cfg) return null;
|
||||
|
||||
return (
|
||||
<div className="space-y-3 border-t border-border/60 pt-4">
|
||||
<label className="flex items-start gap-2 text-sm cursor-pointer">
|
||||
<Checkbox checked={cfg.enabled} className="mt-0.5" onCheckedChange={(c) => enable(!!c)} />
|
||||
<span>
|
||||
{t('appr.matrixEnable')}{' '}
|
||||
<span className="text-xs text-muted-foreground">{t('appr.matrixHint')}</span>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
{cfg.enabled && (
|
||||
<div className="space-y-3">
|
||||
<div className="grid grid-cols-2 gap-x-4 gap-y-2">
|
||||
{MATRIX_VARS.map(({ key, cssVar, label }) => (
|
||||
<label key={key} className="flex items-center gap-2 text-sm cursor-pointer">
|
||||
<input
|
||||
type="color"
|
||||
value={String(cfg[key] || '').trim() || effectiveMatrixColor(cssVar)}
|
||||
onChange={(e) => save({ ...cfg, [key]: e.target.value })}
|
||||
className="size-6 rounded-md border border-border bg-transparent p-0 cursor-pointer shrink-0"
|
||||
/>
|
||||
{t(label)}
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* The matrix as it will actually look: same tokens, same shapes. */}
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="text-xs text-muted-foreground w-10 shrink-0">{t('appr.matrixSample')}</span>
|
||||
<span className="inline-block w-7 h-5 rounded bg-mx-call-conf" />
|
||||
<span className="inline-block w-7 h-5 rounded bg-mx-call-work" />
|
||||
<span className="inline-block w-7 h-5 rounded bg-mx-dx-conf" />
|
||||
<span className="inline-block w-7 h-5 rounded bg-mx-dx-work" />
|
||||
<span className="inline-block w-7 h-5 rounded bg-mx-none" />
|
||||
<span className="inline-block w-7 h-5 rounded bg-mx-none ring-2 ring-mx-cur ring-inset" />
|
||||
</div>
|
||||
|
||||
<button type="button" onClick={reset}
|
||||
className="text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground">
|
||||
{t('appr.matrixReset')}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function AppearancePanel() {
|
||||
const { t } = useI18n();
|
||||
const [cfg, setCfg] = useState<RowColorSettings | null>(null);
|
||||
@@ -148,6 +257,8 @@ export function AppearancePanel() {
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<MatrixColorsSection />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { sunTimes } from '@/lib/sun';
|
||||
import { isQSLConfirmed } from '@/lib/qsl';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { BandSlotQSOs } from '../../wailsjs/go/main/App';
|
||||
import type { WorkedBeforeView } from '@/types';
|
||||
|
||||
@@ -76,28 +77,31 @@ const STATUS_CLASSES: Record<string, string> = {
|
||||
dxcc_w: 'bg-mx-dx-work',
|
||||
};
|
||||
|
||||
// Legend entries, in the same colour order as the cells. swatch = the
|
||||
// background class (or a special ring marker for the current-entry cell).
|
||||
// Legend entries, in the same colour order as the cells — and the same order and
|
||||
// i18n keys the Appearance panel's colour pickers use, so the two can never
|
||||
// disagree about which green is which. swatch = the background class (or a
|
||||
// special ring marker for the current-entry cell).
|
||||
const LEGEND: { swatch: string; ring?: boolean; label: string }[] = [
|
||||
{ swatch: 'bg-mx-call-conf', label: 'Call confirmed' },
|
||||
{ swatch: 'bg-mx-call-work', label: 'Call worked' },
|
||||
{ swatch: 'bg-mx-dx-conf', label: 'Entity confirmed' },
|
||||
{ swatch: 'bg-mx-dx-work', label: 'Entity worked' },
|
||||
{ swatch: 'bg-mx-none', label: 'Not worked' },
|
||||
{ swatch: 'bg-mx-none', ring: true, label: 'Current entry' },
|
||||
{ swatch: 'bg-mx-call-conf', label: 'mx.callConf' },
|
||||
{ swatch: 'bg-mx-call-work', label: 'mx.callWork' },
|
||||
{ swatch: 'bg-mx-dx-conf', label: 'mx.dxConf' },
|
||||
{ swatch: 'bg-mx-dx-work', label: 'mx.dxWork' },
|
||||
{ swatch: 'bg-mx-none', label: 'mx.none' },
|
||||
{ swatch: 'bg-mx-none', ring: true, label: 'mx.current' },
|
||||
];
|
||||
|
||||
function cellTitle(band: string, cls: string, status: string, current: boolean): string {
|
||||
function cellTitle(t: (k: string) => string, band: string, cls: string, status: string, current: boolean): string {
|
||||
const desc =
|
||||
status === 'call_c' ? 'This callsign confirmed' :
|
||||
status === 'call_w' ? 'This callsign worked (not confirmed)' :
|
||||
status === 'dxcc_c' ? 'Entity confirmed (other callsign)' :
|
||||
status === 'dxcc_w' ? 'Entity worked (other callsign)' :
|
||||
'Never worked';
|
||||
return `${band} ${cls}: ${desc}${current ? ' — current entry' : ''}`;
|
||||
status === 'call_c' ? t('mx.tipCallConf') :
|
||||
status === 'call_w' ? t('mx.tipCallWork') :
|
||||
status === 'dxcc_c' ? t('mx.tipDxConf') :
|
||||
status === 'dxcc_w' ? t('mx.tipDxWork') :
|
||||
t('mx.tipNone');
|
||||
return `${band} ${cls}: ${desc}${current ? ' — ' + t('mx.current') : ''}`;
|
||||
}
|
||||
|
||||
export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCall = true, lat, lon, forCall, onEditQso }: Props) {
|
||||
const { t } = useI18n();
|
||||
// Cell drill-down: which band+class the operator clicked, or null.
|
||||
const [slot, setSlot] = useState<{ band: string; cls: string } | null>(null);
|
||||
// Columns from the operator's configured bands (so the matrix shows only the
|
||||
@@ -308,7 +312,7 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
||||
return (
|
||||
<td
|
||||
key={b.tag}
|
||||
title={cellTitle(b.tag, cls, st, isCurrent) + (st ? ' — click to list the QSOs' : '')}
|
||||
title={cellTitle(t, b.tag, cls, st, isCurrent) + (st ? ' — ' + t('mx.tipClick') : '')}
|
||||
onClick={st ? () => setSlot({ band: b.tag, cls }) : undefined}
|
||||
className={cn(
|
||||
'w-[28px] h-[24px] rounded transition-colors p-0',
|
||||
@@ -316,7 +320,7 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
||||
// Only a filled cell has anything to show — an empty one
|
||||
// stays inert rather than opening a "no QSOs" dialog.
|
||||
st && 'cursor-pointer hover:brightness-110',
|
||||
isCurrent && 'ring-2 ring-warning ring-inset',
|
||||
isCurrent && 'ring-2 ring-mx-cur ring-inset',
|
||||
)}
|
||||
/>
|
||||
);
|
||||
@@ -335,10 +339,10 @@ export function BandSlotGrid({ wb, busy, currentBand, currentMode, bands, hasCal
|
||||
className={cn(
|
||||
'inline-block size-3 rounded shrink-0',
|
||||
l.swatch,
|
||||
l.ring && 'ring-2 ring-warning ring-inset',
|
||||
l.ring && 'ring-2 ring-mx-cur ring-inset',
|
||||
)}
|
||||
/>
|
||||
{l.label}
|
||||
{t(l.label)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -114,7 +114,17 @@ const en: Dict = {
|
||||
'nav.user': 'User Configuration', 'nav.software': 'Software Configuration', 'nav.hardware': 'Hardware Configuration', 'nav.lists': 'Lists',
|
||||
'sec.station': 'Station Information', 'sec.profiles': 'Profiles', 'sec.operating': 'Operating conditions',
|
||||
'sec.confirmations': 'Confirmations', 'sec.external': 'External services',
|
||||
'sec.general': 'General', 'sec.appearance': 'Appearance', 'appr.enable': 'Colour whole rows by QSL status', 'appr.enableHint': '(in the log grid, like Logger32)', 'appr.orderHint': 'A contact is often several of these at once — the first rule that matches decides the colour.', 'appr.ruleToSend': 'To be sent', 'appr.ruleConfirmed': 'Confirmed', 'appr.ruleSent': 'QSL sent', 'appr.ruleWorked': 'Worked, nothing sent', 'appr.chQsl': 'Paper QSL', 'appr.custom': 'Pick any colour', 'appr.style': 'Style', 'appr.styleBar': 'Left stripe', 'appr.styleTint': 'Filled row', 'appr.styleBoth': 'Both', 'appr.intensity': 'Strength', 'appr.bandmapLotw': 'Mark LoTW users on the band map', 'appr.bandmapLotwHint': '(the same L badge the cluster list uses)', 'sec.email': 'E-mail (SMTP)', 'sec.lookup': 'Callsign Lookup',
|
||||
'sec.general': 'General', 'sec.appearance': 'Appearance', 'appr.enable': 'Colour whole rows by QSL status', 'appr.enableHint': '(in the log grid, like Logger32)', 'appr.orderHint': 'A contact is often several of these at once — the first rule that matches decides the colour.', 'appr.ruleToSend': 'To be sent', 'appr.ruleConfirmed': 'Confirmed', 'appr.ruleSent': 'QSL sent', 'appr.ruleWorked': 'Worked, nothing sent', 'appr.chQsl': 'Paper QSL', 'appr.custom': 'Pick any colour', 'appr.style': 'Style', 'appr.styleBar': 'Left stripe', 'appr.styleTint': 'Filled row', 'appr.styleBoth': 'Both', 'appr.intensity': 'Strength', 'appr.bandmapLotw': 'Mark LoTW users on the band map', 'appr.bandmapLotwHint': '(the same L badge the cluster list uses)',
|
||||
'appr.matrixEnable': 'Choose the band/mode matrix colours', 'appr.matrixHint': '(the PH/CW/DIG grid in Stats — off, each theme uses its own)',
|
||||
'appr.matrixSample': 'Sample', 'appr.matrixReset': 'Back to the theme’s colours',
|
||||
// Matrix legend + colour names. One set of labels for the grid's legend, its
|
||||
// cell tooltips and the colour pickers, so they can never drift apart.
|
||||
'mx.callConf': 'Call confirmed', 'mx.callWork': 'Call worked', 'mx.dxConf': 'Entity confirmed',
|
||||
'mx.dxWork': 'Entity worked', 'mx.none': 'Not worked', 'mx.current': 'Current entry',
|
||||
'mx.tipCallConf': 'This callsign confirmed', 'mx.tipCallWork': 'This callsign worked (not confirmed)',
|
||||
'mx.tipDxConf': 'Entity confirmed (other callsign)', 'mx.tipDxWork': 'Entity worked (other callsign)',
|
||||
'mx.tipNone': 'Never worked', 'mx.tipClick': 'click to list the QSOs',
|
||||
'sec.email': 'E-mail (SMTP)', 'sec.lookup': 'Callsign Lookup',
|
||||
'sec.bands': 'Bands', 'sec.modes': 'Modes & default RST', 'sec.cluster': 'DX Cluster',
|
||||
'sec.udp': 'Connections', 'sec.database': 'Database', 'sec.autostart': 'Autostart', 'sec.backup': 'Database backup', 'sec.uscounties': 'US Counties',
|
||||
'sec.webpublish': 'Web publishing', 'wpub.hint': 'Publishes your log as a file for a website: a standalone HTML page or a CSV, written locally and optionally uploaded by FTP. It is refreshed when you log a QSO and, if you set an interval, on a timer.', 'wpub.enable': 'Publish the log to a file', 'wpub.fileSection': 'The file', 'wpub.format': 'Format', 'wpub.formatHtml': 'HTML page', 'wpub.formatCsv': 'CSV', 'wpub.folder': 'Output folder', 'wpub.browse': 'Browse…', 'wpub.fileName': 'File name', 'wpub.title': 'Page title', 'wpub.titlePh': 'blank = your callsign', 'wpub.count': 'Last N QSOs', 'wpub.every': 'Refresh every', 'wpub.everyHint': 'minutes — 0 = only when a QSO is logged', 'wpub.columns': 'Columns', 'wpub.columnsCount': '{n} of {total} chosen', 'wpub.columnsPick': 'Choose columns…', 'wpub.columnsSearch': 'Search a field…', 'wpub.removeColumn': 'Click to remove', 'wpub.columnsHint': 'Click to add or remove. The order shown here is the order in the file.', 'wpub.ftpEnable': 'Upload by FTP', 'wpub.ftpHost': 'Server / port', 'wpub.ftpUser': 'User', 'wpub.ftpPassword': 'Password', 'wpub.ftpFolder': 'Remote folder', 'wpub.ftpFileName': 'Remote file name', 'wpub.ftpTls': 'Use TLS (FTPS)', 'wpub.publishNow': 'Publish now', 'wpub.testFtp': 'Test connection', 'wpub.lastRun': 'Last run:', 'sec.adifmon': 'ADIF monitor',
|
||||
@@ -552,7 +562,17 @@ const fr: Dict = {
|
||||
'nav.user': 'Configuration utilisateur', 'nav.software': 'Configuration logicielle', 'nav.hardware': 'Configuration matérielle', 'nav.lists': 'Listes',
|
||||
'sec.station': 'Informations station', 'sec.profiles': 'Profils', 'sec.operating': "Conditions d'opération",
|
||||
'sec.confirmations': 'Confirmations', 'sec.external': 'Services externes',
|
||||
'sec.general': 'Général', 'sec.appearance': 'Apparence', 'appr.enable': 'Colorer les lignes entières selon le statut QSL', 'appr.enableHint': '(dans le tableau du log, comme Logger32)', 'appr.orderHint': "Un contact est souvent plusieurs de ces états à la fois — la première règle qui correspond décide de la couleur.", 'appr.ruleToSend': 'À envoyer', 'appr.ruleConfirmed': 'Confirmé', 'appr.ruleSent': 'QSL envoyée', 'appr.ruleWorked': 'Contacté, rien envoyé', 'appr.chQsl': 'QSL papier', 'appr.custom': 'Choisir une couleur', 'appr.style': 'Style', 'appr.styleBar': 'Barre à gauche', 'appr.styleTint': 'Ligne remplie', 'appr.styleBoth': 'Les deux', 'appr.intensity': 'Intensité', 'appr.bandmapLotw': 'Marquer les utilisateurs LoTW sur la band map', 'appr.bandmapLotwHint': '(le même badge L que la liste du cluster)', 'sec.email': 'E-mail (SMTP)', 'sec.lookup': "Recherche d'indicatif",
|
||||
'sec.general': 'Général', 'sec.appearance': 'Apparence', 'appr.enable': 'Colorer les lignes entières selon le statut QSL', 'appr.enableHint': '(dans le tableau du log, comme Logger32)', 'appr.orderHint': "Un contact est souvent plusieurs de ces états à la fois — la première règle qui correspond décide de la couleur.", 'appr.ruleToSend': 'À envoyer', 'appr.ruleConfirmed': 'Confirmé', 'appr.ruleSent': 'QSL envoyée', 'appr.ruleWorked': 'Contacté, rien envoyé', 'appr.chQsl': 'QSL papier', 'appr.custom': 'Choisir une couleur', 'appr.style': 'Style', 'appr.styleBar': 'Barre à gauche', 'appr.styleTint': 'Ligne remplie', 'appr.styleBoth': 'Les deux', 'appr.intensity': 'Intensité', 'appr.bandmapLotw': 'Marquer les utilisateurs LoTW sur la band map', 'appr.bandmapLotwHint': '(le même badge L que la liste du cluster)',
|
||||
'appr.matrixEnable': 'Choisir les couleurs de la matrice bandes/modes', 'appr.matrixHint': '(la grille PH/CW/DIG des Stats — décoché, chaque thème garde les siennes)',
|
||||
'appr.matrixSample': 'Aperçu', 'appr.matrixReset': 'Revenir aux couleurs du thème',
|
||||
// Légende de la matrice + noms des couleurs. Un seul jeu de libellés pour la
|
||||
// légende, les infobulles des cases et les sélecteurs de couleur.
|
||||
'mx.callConf': 'Indicatif confirmé', 'mx.callWork': 'Indicatif contacté', 'mx.dxConf': 'Entité confirmée',
|
||||
'mx.dxWork': 'Entité contactée', 'mx.none': 'Jamais contacté', 'mx.current': 'Saisie en cours',
|
||||
'mx.tipCallConf': 'Cet indicatif est confirmé', 'mx.tipCallWork': 'Cet indicatif est contacté (non confirmé)',
|
||||
'mx.tipDxConf': 'Entité confirmée (autre indicatif)', 'mx.tipDxWork': 'Entité contactée (autre indicatif)',
|
||||
'mx.tipNone': 'Jamais contacté', 'mx.tipClick': 'cliquer pour lister les QSO',
|
||||
'sec.email': 'E-mail (SMTP)', 'sec.lookup': "Recherche d'indicatif",
|
||||
'sec.bands': 'Bandes', 'sec.modes': 'Modes & RST par défaut', 'sec.cluster': 'DX Cluster',
|
||||
'sec.udp': 'Connexions', 'sec.database': 'Base de données', 'sec.autostart': 'Démarrage auto', 'sec.backup': 'Sauvegarde base', 'sec.uscounties': 'Comtés US',
|
||||
'sec.webpublish': 'Publication web', 'wpub.hint': "Publie ton journal dans un fichier destiné à un site web : une page HTML autonome ou un CSV, écrit en local et envoyé par FTP si tu le souhaites. Il est rafraîchi à chaque QSO enregistré et, si tu règles un intervalle, périodiquement.", 'wpub.enable': 'Publier le journal dans un fichier', 'wpub.fileSection': 'Le fichier', 'wpub.format': 'Format', 'wpub.formatHtml': 'Page HTML', 'wpub.formatCsv': 'CSV', 'wpub.folder': 'Dossier de sortie', 'wpub.browse': 'Parcourir…', 'wpub.fileName': 'Nom du fichier', 'wpub.title': 'Titre de la page', 'wpub.titlePh': 'vide = ton indicatif', 'wpub.count': 'N derniers QSO', 'wpub.every': 'Rafraîchir toutes les', 'wpub.everyHint': 'minutes — 0 = seulement à chaque QSO', 'wpub.columns': 'Colonnes', 'wpub.columnsCount': '{n} sur {total} choisis', 'wpub.columnsPick': 'Choisir les colonnes…', 'wpub.columnsSearch': 'Chercher un champ…', 'wpub.removeColumn': 'Cliquer pour retirer', 'wpub.columnsHint': 'Clique pour ajouter ou retirer. L ordre affiché ici est celui du fichier.', 'wpub.ftpEnable': 'Envoyer par FTP', 'wpub.ftpHost': 'Serveur / port', 'wpub.ftpUser': 'Utilisateur', 'wpub.ftpPassword': 'Mot de passe', 'wpub.ftpFolder': 'Dossier distant', 'wpub.ftpFileName': 'Nom du fichier distant', 'wpub.ftpTls': 'Utiliser TLS (FTPS)', 'wpub.publishNow': 'Publier maintenant', 'wpub.testFtp': 'Tester la connexion', 'wpub.lastRun': 'Dernière exécution :', 'sec.adifmon': 'Moniteur ADIF',
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// Operator overrides for the band/mode matrix palette.
|
||||
//
|
||||
// Applied as inline custom properties on <html>, which is what lets them be
|
||||
// OVERRIDES rather than a palette: the twelve themes each define their own
|
||||
// --mx-* ramp in style.css, an inline value wins over all of them, and removing
|
||||
// it hands the colour straight back to the theme. Nothing has to know which
|
||||
// theme is active, and switching theme with overrides off is a clean revert.
|
||||
|
||||
export type MatrixColors = {
|
||||
enabled: boolean;
|
||||
call_confirmed: string;
|
||||
call_worked: string;
|
||||
entity_confirmed: string;
|
||||
entity_worked: string;
|
||||
not_worked: string;
|
||||
current_entry: string;
|
||||
};
|
||||
|
||||
// The six settings fields and the CSS custom property each one drives. Also the
|
||||
// display order — the same order the legend under the matrix reads in, so the
|
||||
// settings panel and the grid can never disagree about which green is which.
|
||||
export const MATRIX_VARS: { key: keyof Omit<MatrixColors, 'enabled'>; cssVar: string; label: string }[] = [
|
||||
{ key: 'call_confirmed', cssVar: '--mx-call-conf', label: 'mx.callConf' },
|
||||
{ key: 'call_worked', cssVar: '--mx-call-work', label: 'mx.callWork' },
|
||||
{ key: 'entity_confirmed', cssVar: '--mx-dx-conf', label: 'mx.dxConf' },
|
||||
{ key: 'entity_worked', cssVar: '--mx-dx-work', label: 'mx.dxWork' },
|
||||
{ key: 'not_worked', cssVar: '--mx-none', label: 'mx.none' },
|
||||
{ key: 'current_entry', cssVar: '--mx-cur', label: 'mx.current' },
|
||||
];
|
||||
|
||||
export const emptyMatrixColors = (): MatrixColors => ({
|
||||
enabled: false,
|
||||
call_confirmed: '', call_worked: '', entity_confirmed: '',
|
||||
entity_worked: '', not_worked: '', current_entry: '',
|
||||
});
|
||||
|
||||
// applyMatrixColors stamps (or clears) the overrides on <html>. Safe to call as
|
||||
// often as you like — it is the whole rendering path, so the settings panel uses
|
||||
// it for a live preview and the app uses it once at startup.
|
||||
export function applyMatrixColors(c?: MatrixColors | null): void {
|
||||
const root = document.documentElement;
|
||||
for (const { key, cssVar } of MATRIX_VARS) {
|
||||
const v = c?.enabled ? String(c[key] ?? '').trim() : '';
|
||||
if (v) root.style.setProperty(cssVar, v);
|
||||
else root.style.removeProperty(cssVar);
|
||||
}
|
||||
}
|
||||
|
||||
// effectiveMatrixColor reads what the matrix is ACTUALLY painting right now —
|
||||
// the override if there is one, else the active theme's value. It is what seeds
|
||||
// the colour pickers, so the operator starts from the colours in front of them
|
||||
// instead of from a hardcoded palette that may belong to a different theme.
|
||||
//
|
||||
// A custom property's computed value has its var() references substituted, so
|
||||
// --mx-cur resolves to the theme's --warning rather than to the literal text.
|
||||
export function effectiveMatrixColor(cssVar: string): string {
|
||||
try {
|
||||
const v = getComputedStyle(document.documentElement).getPropertyValue(cssVar).trim();
|
||||
// <input type="color"> only accepts #rrggbb. Anything else (a theme that
|
||||
// ever moves to oklch, an empty read during boot) falls back to mid grey
|
||||
// rather than silently resetting the picker to black.
|
||||
return /^#[0-9a-f]{6}$/i.test(v) ? v.toLowerCase() : '#808080';
|
||||
} catch {
|
||||
return '#808080';
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,12 @@
|
||||
--mx-dx-conf: #3730a3; /* entity confirmed*/
|
||||
--mx-dx-work: #a5b4fc; /* entity worked */
|
||||
--mx-none: #e7e5e4; /* never worked */
|
||||
/* Ring on the cell the operator is entering. Declared ONCE, on :root, and
|
||||
deliberately not repeated per theme: it follows --warning, which every theme
|
||||
already tunes to its own background. The token exists so the matrix ring can
|
||||
be recoloured on its own without dragging every other warning in the app
|
||||
with it (Appearance → matrix colours). */
|
||||
--mx-cur: var(--warning);
|
||||
|
||||
--scrollbar-thumb: #b8a880;
|
||||
--scrollbar-thumb-hover: #968455;
|
||||
@@ -974,6 +980,7 @@
|
||||
--color-mx-dx-conf: var(--mx-dx-conf);
|
||||
--color-mx-dx-work: var(--mx-dx-work);
|
||||
--color-mx-none: var(--mx-none);
|
||||
--color-mx-cur: var(--mx-cur);
|
||||
|
||||
--radius: 0.5rem;
|
||||
|
||||
|
||||
Vendored
+4
@@ -477,6 +477,8 @@ export function GetLogbookRevision():Promise<string>;
|
||||
|
||||
export function GetLookupSettings():Promise<main.LookupSettings>;
|
||||
|
||||
export function GetMatrixColors():Promise<main.MatrixColors>;
|
||||
|
||||
export function GetMySQLSettings():Promise<main.MySQLSettings>;
|
||||
|
||||
export function GetOfflineStatus():Promise<main.OfflineStatus>;
|
||||
@@ -949,6 +951,8 @@ export function SaveListsSettings(arg1:main.ListsSettings):Promise<void>;
|
||||
|
||||
export function SaveLookupSettings(arg1:main.LookupSettings):Promise<void>;
|
||||
|
||||
export function SaveMatrixColors(arg1:main.MatrixColors):Promise<void>;
|
||||
|
||||
export function SaveMySQLSettings(arg1:main.MySQLSettings):Promise<void>;
|
||||
|
||||
export function SaveOperatingAntenna(arg1:operating.Antenna):Promise<operating.Antenna>;
|
||||
|
||||
@@ -894,6 +894,10 @@ export function GetLookupSettings() {
|
||||
return window['go']['main']['App']['GetLookupSettings']();
|
||||
}
|
||||
|
||||
export function GetMatrixColors() {
|
||||
return window['go']['main']['App']['GetMatrixColors']();
|
||||
}
|
||||
|
||||
export function GetMySQLSettings() {
|
||||
return window['go']['main']['App']['GetMySQLSettings']();
|
||||
}
|
||||
@@ -1838,6 +1842,10 @@ export function SaveLookupSettings(arg1) {
|
||||
return window['go']['main']['App']['SaveLookupSettings'](arg1);
|
||||
}
|
||||
|
||||
export function SaveMatrixColors(arg1) {
|
||||
return window['go']['main']['App']['SaveMatrixColors'](arg1);
|
||||
}
|
||||
|
||||
export function SaveMySQLSettings(arg1) {
|
||||
return window['go']['main']['App']['SaveMySQLSettings'](arg1);
|
||||
}
|
||||
|
||||
@@ -2683,6 +2683,30 @@ export namespace main {
|
||||
this.cache_ttl_days = source["cache_ttl_days"];
|
||||
}
|
||||
}
|
||||
export class MatrixColors {
|
||||
enabled: boolean;
|
||||
call_confirmed: string;
|
||||
call_worked: string;
|
||||
entity_confirmed: string;
|
||||
entity_worked: string;
|
||||
not_worked: string;
|
||||
current_entry: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new MatrixColors(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.enabled = source["enabled"];
|
||||
this.call_confirmed = source["call_confirmed"];
|
||||
this.call_worked = source["call_worked"];
|
||||
this.entity_confirmed = source["entity_confirmed"];
|
||||
this.entity_worked = source["entity_worked"];
|
||||
this.not_worked = source["not_worked"];
|
||||
this.current_entry = source["current_entry"];
|
||||
}
|
||||
}
|
||||
|
||||
export class MySQLSettings {
|
||||
enabled: boolean;
|
||||
|
||||
+25
-17
@@ -514,7 +514,8 @@ func (b *IcomSerial) SetFrequency(hz int64) error {
|
||||
return fmt.Errorf("invalid frequency")
|
||||
}
|
||||
b.lastSetFreq, b.lastSetFreqAt = hz, time.Now()
|
||||
return b.exec(append([]byte{civ.CmdSetFreq}, civ.FreqToBCD(hz)...)...)
|
||||
return b.execIdempotent(fmt.Sprintf("set frequency %d Hz", hz),
|
||||
append([]byte{civ.CmdSetFreq}, civ.FreqToBCD(hz)...)...)
|
||||
}
|
||||
|
||||
func (b *IcomSerial) SetMode(mode string) error {
|
||||
@@ -524,7 +525,7 @@ 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.exec(civ.CmdSetMode, code); err != nil {
|
||||
if err := b.execIdempotent("set mode "+mode, civ.CmdSetMode, code); err != nil {
|
||||
return err
|
||||
}
|
||||
dataByte := byte(0)
|
||||
@@ -532,7 +533,7 @@ func (b *IcomSerial) SetMode(mode string) error {
|
||||
dataByte = 1
|
||||
}
|
||||
// Filter 0x01 (FIL1) is the conventional default for the data-mode set.
|
||||
_ = b.exec(civ.CmdExtra, civ.SubDataMode, dataByte, 0x01)
|
||||
_ = b.execIdempotent("set data mode", civ.CmdExtra, civ.SubDataMode, dataByte, 0x01)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -542,31 +543,38 @@ func (b *IcomSerial) SetMode(mode string) error {
|
||||
// a formatted string so callers can tell the two apart.
|
||||
var errIcomAckLost = errors.New("icom: timeout waiting for response")
|
||||
|
||||
// SetPTT keys or unkeys the transmitter (CI-V 0x1C 0x00), retrying ONCE when the
|
||||
// execIdempotent runs a SET command and sends it ONCE MORE if the
|
||||
// acknowledgement is lost.
|
||||
//
|
||||
// A missing FB is not a missing command — the rig acts on the frame as soon as it
|
||||
// decodes it, and what expires is our wait for the answer on a bus shared with
|
||||
// the rig's own transceive updates. JTDX in "Split Operating: Fake It" moves the
|
||||
// dial immediately before every key-down, so the PTT ack queues behind that
|
||||
// traffic, and one lost ack was fatal: rigctld answered RPRT -9, JTDX read that
|
||||
// as losing rig control and tore the connection down mid-over, reopening it a
|
||||
// moment later (an operator's log shows exactly that, twice, a new rigctld client
|
||||
// within 300 ms of each failure). The same session over TCI never failed, because
|
||||
// TCI carries no CI-V and needs no Fake It.
|
||||
// dial and the mode immediately before every key-down, so those acks queue behind
|
||||
// each other, and losing one was fatal: rigctld answers RPRT -9, JTDX reads that
|
||||
// as losing rig control and tears the connection down mid-over. An operator's log
|
||||
// shows it happening on set_ptt, on set_freq and on set_mode alike, each failure
|
||||
// followed within 300 ms by a fresh rigctld client — and shows this resend
|
||||
// rescuing a PTT that would otherwise have ended the over.
|
||||
//
|
||||
// Re-sending is safe: asking for a state the rig is already in changes nothing.
|
||||
// Only for commands that say "be in this state": re-sending one changes nothing
|
||||
// if the first arrived. A relative or incremental command must not come through
|
||||
// here, which is why this is opt-in per caller rather than folded into exec.
|
||||
func (b *IcomSerial) execIdempotent(what string, payload ...byte) error {
|
||||
err := b.exec(payload...)
|
||||
if err == nil || !errors.Is(err, errIcomAckLost) {
|
||||
return err
|
||||
}
|
||||
applog.Printf("icom: %s — no acknowledgement in %s, sending it once more", what, icomCmdTimeout)
|
||||
return b.exec(payload...)
|
||||
}
|
||||
|
||||
// SetPTT keys or unkeys the transmitter (CI-V 0x1C 0x00).
|
||||
func (b *IcomSerial) SetPTT(on bool) error {
|
||||
state := byte(0)
|
||||
if on {
|
||||
state = 1
|
||||
}
|
||||
err := b.exec(civ.CmdPTT, civ.SubPTT, state)
|
||||
if err == nil || !errors.Is(err, errIcomAckLost) {
|
||||
return err
|
||||
}
|
||||
applog.Printf("icom: PTT %v — no acknowledgement in %s, sending it once more", on, icomCmdTimeout)
|
||||
return b.exec(civ.CmdPTT, civ.SubPTT, state)
|
||||
return b.execIdempotent(fmt.Sprintf("PTT %v", on), civ.CmdPTT, civ.SubPTT, state)
|
||||
}
|
||||
|
||||
// SetPower turns the transceiver on or off (CI-V 0x18). Power-ON is prefixed with
|
||||
|
||||
@@ -178,7 +178,41 @@ func (s *Server) Start() error {
|
||||
}
|
||||
|
||||
// Stop closes the listener and every client.
|
||||
// releasePTT drops a PTT this server asserted, and does it once.
|
||||
//
|
||||
// A client that dies mid-over — or a settings save that closes the server —
|
||||
// leaves the rig keyed with nobody left to un-key it, into an amplifier that has
|
||||
// no idea the transmission ended. rigctld has had this guard for a while (a K3
|
||||
// once sat in transmit for 29 s until the CAT link happened to be rebuilt); the
|
||||
// TCI server was written without it, so an operator who moved from Hamlib to TCI
|
||||
// silently lost the protection.
|
||||
//
|
||||
// pttKnown is cleared whatever happens: after an emergency unkey the radio's
|
||||
// state is a guess, and the next command must reach it rather than be dismissed
|
||||
// as a repeat.
|
||||
func (s *Server) releasePTT(why string) {
|
||||
s.mu.Lock()
|
||||
keyed := s.ptt
|
||||
s.ptt, s.pttKnown = false, false
|
||||
s.mu.Unlock()
|
||||
if !keyed {
|
||||
return
|
||||
}
|
||||
s.log("tci server: %s while the rig was keyed — dropping PTT", why)
|
||||
if err := s.rig.SetPTT(false); err != nil {
|
||||
s.log("tci server: emergency unkey FAILED: %v", err)
|
||||
return
|
||||
}
|
||||
// Any client still attached is told, so a second logger's transmit indicator
|
||||
// does not stay lit over a rig that is back in receive.
|
||||
s.broadcast("trx:0,false;")
|
||||
}
|
||||
|
||||
func (s *Server) Stop() {
|
||||
// Before anything is torn down: the CAT backend is still up here, so an unkey
|
||||
// still lands. Same ordering as rigctld.Stop for the same reason.
|
||||
s.releasePTT("TCI server stopped")
|
||||
|
||||
s.mu.Lock()
|
||||
if s.closed {
|
||||
s.mu.Unlock()
|
||||
@@ -266,6 +300,8 @@ func (s *Server) serve(c *client, remote string) {
|
||||
s.mu.Unlock()
|
||||
_ = c.conn.Close()
|
||||
s.log("tci server: %s disconnected", remote)
|
||||
// A client that walks away mid-over must not leave the rig transmitting.
|
||||
s.releasePTT("client " + remote + " left")
|
||||
}
|
||||
|
||||
// initBlock is the initialisation set from §4.1 of the protocol document, in
|
||||
@@ -484,16 +520,33 @@ func (s *Server) handle(c *client, cmd string) string {
|
||||
// knowing how the radio was left.
|
||||
s.mu.Lock()
|
||||
known, prev := s.pttKnown, s.ptt
|
||||
s.ptt, s.pttKnown = on, true
|
||||
s.mu.Unlock()
|
||||
if known && prev == on {
|
||||
s.broadcast(fmt.Sprintf("trx:0,%t;", on))
|
||||
return ""
|
||||
}
|
||||
if err := s.rig.SetPTT(on); err != nil {
|
||||
// The cache is stamped ONLY on success, and a failure clears "known"
|
||||
// outright so the NEXT command — whatever it is — reaches the radio.
|
||||
//
|
||||
// It used to be written before the radio was commanded and left in
|
||||
// place when the command failed. That is how a rig got stuck keyed for
|
||||
// good: the un-key failed on a lost CI-V acknowledgement, the cache
|
||||
// recorded "off" regardless, and from then on every trx:0,false was
|
||||
// dismissed as a repeat of a state the radio had never reached. Not
|
||||
// even reconnecting the client cleared it — this cache is per-server,
|
||||
// not per-connection — so the transmitter stayed keyed into the
|
||||
// amplifier until the operator switched the radio off. A cache must
|
||||
// never claim something the radio refused.
|
||||
s.mu.Lock()
|
||||
s.pttKnown = false
|
||||
s.mu.Unlock()
|
||||
s.log("tci server: PTT %v refused: %v", on, err)
|
||||
return ""
|
||||
}
|
||||
s.mu.Lock()
|
||||
s.ptt, s.pttKnown = on, true
|
||||
s.mu.Unlock()
|
||||
s.log("tci server: PTT %s", map[bool]string{true: "ON", false: "off"}[on])
|
||||
s.broadcast(fmt.Sprintf("trx:0,%t;", on))
|
||||
return ""
|
||||
|
||||
@@ -16,6 +16,7 @@ type fakeRig struct {
|
||||
txHz int64
|
||||
ptt bool
|
||||
splitErr error
|
||||
pttErr error
|
||||
calls []string
|
||||
}
|
||||
|
||||
@@ -34,6 +35,10 @@ func (r *fakeRig) SetMode(m string) error {
|
||||
return nil
|
||||
}
|
||||
func (r *fakeRig) SetPTT(on bool) error {
|
||||
// Refused BEFORE the state moves, like a radio that never got the frame.
|
||||
if r.pttErr != nil {
|
||||
return r.pttErr
|
||||
}
|
||||
r.calls = append(r.calls, fmt.Sprintf("ptt=%v", on))
|
||||
r.ptt = on
|
||||
return nil
|
||||
@@ -328,3 +333,54 @@ func TestRepeatedPTTIsNotResentToTheRadio(t *testing.T) {
|
||||
t.Errorf("the radio was told %v, want the change through and the repeat dropped", r.calls)
|
||||
}
|
||||
}
|
||||
|
||||
// A refused un-key must never be remembered as done.
|
||||
//
|
||||
// The failure an operator hit running JTDX over TCI with an Icom on CI-V: the
|
||||
// rig went to transmit, the un-key was refused on a lost acknowledgement, and
|
||||
// from then on NOTHING could take it out of transmit. The cache had stamped
|
||||
// "off" before the radio was even commanded and kept it after the refusal, so
|
||||
// every later trx:0,false was dismissed as a repeat of a state the radio had
|
||||
// never reached. It is per-server, not per-connection, so reconnecting the
|
||||
// client changed nothing either — the transmitter stayed keyed into the
|
||||
// amplifier, with no drive, until the radio was switched off by hand.
|
||||
func TestARefusedUnkeyIsNotRememberedAsDone(t *testing.T) {
|
||||
r := &fakeRig{freq: 14074000, rxFreq: 14074000, mode: "USB"}
|
||||
s := srv(r)
|
||||
ask(t, s, "trx:0,true")
|
||||
if !r.ptt {
|
||||
t.Fatal("the rig was never keyed — the test would prove nothing")
|
||||
}
|
||||
|
||||
r.pttErr = fmt.Errorf("icom: timeout waiting for response")
|
||||
ask(t, s, "trx:0,false")
|
||||
if !r.ptt {
|
||||
t.Fatal("the fake rig un-keyed on a refusal — the test would prove nothing")
|
||||
}
|
||||
|
||||
// The client asks again, and this time the radio answers. It MUST be told.
|
||||
r.pttErr = nil
|
||||
ask(t, s, "trx:0,false")
|
||||
if r.ptt {
|
||||
t.Error("still keyed: the refused un-key was cached as done and the retry was dropped as a repeat")
|
||||
}
|
||||
}
|
||||
|
||||
// A client that walks away mid-over must not leave the rig transmitting, and
|
||||
// the release must be once-only — a second call has nothing to un-key and must
|
||||
// not re-command a radio that is already receiving.
|
||||
func TestReleasePTTUnkeysOnceWhenTheClientLeaves(t *testing.T) {
|
||||
r := &fakeRig{freq: 14074000, rxFreq: 14074000, mode: "USB"}
|
||||
s := srv(r)
|
||||
ask(t, s, "trx:0,true")
|
||||
|
||||
s.releasePTT("client left")
|
||||
if r.ptt {
|
||||
t.Error("the rig is still keyed after the client left")
|
||||
}
|
||||
n := len(r.calls)
|
||||
s.releasePTT("client left")
|
||||
if len(r.calls) != n {
|
||||
t.Errorf("released twice — the radio was told %v", r.calls)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user