Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
284ee4ba7c | ||
|
|
10ef984962 | ||
|
|
bd8719ce99 | ||
|
|
5e38319379 | ||
|
|
7e7ad50f60 | ||
|
|
0f4e31853b | ||
|
|
c222468021 | ||
|
|
2fb4a4d0ce | ||
|
|
e4828482c4 | ||
|
|
8acfda4e42 |
@@ -6938,6 +6938,28 @@ func (a *App) BulkUpdateField(ids []int64, field, value string) (int64, error) {
|
||||
if field == "freq" {
|
||||
return a.bulkSetFrequency(ids, value)
|
||||
}
|
||||
// The station-side numbers. Bounded so a slip cannot stamp CQ zone 400 on a
|
||||
// thousand rows: DXCC entities stop short of 1000, CQ zones at 40, ITU at 90.
|
||||
// Empty clears (NULL).
|
||||
if field == "my_dxcc" || field == "my_cq_zone" || field == "my_itu_zone" {
|
||||
var vp *int
|
||||
if t := strings.TrimSpace(value); t != "" {
|
||||
v, err := strconv.Atoi(t)
|
||||
max := map[string]int{"my_dxcc": 999, "my_cq_zone": 40, "my_itu_zone": 90}[field]
|
||||
if err != nil || v < 1 || v > max {
|
||||
return 0, fmt.Errorf("%s must be a number between 1 and %d (empty to clear)", field, max)
|
||||
}
|
||||
vp = &v
|
||||
}
|
||||
n, err := a.qso.BulkSetIntField(a.ctx, ids, field, vp)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if n > 0 {
|
||||
a.invalidateAwardStats()
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
// Some ADIF fields have no promoted column and live in extras_json
|
||||
// (OWNER_CALLSIGN) — those take the JSON path so the rest of the extras on
|
||||
// each QSO survive the edit.
|
||||
|
||||
@@ -24,6 +24,17 @@ func (a *App) GetKenwoodState() cat.KenwoodTXState {
|
||||
return st
|
||||
}
|
||||
|
||||
// SetKenwoodPanelMode sets the operating mode from the panel's mode row —
|
||||
// CW / USB / LSB / DATA (soundcard, DT0) / RTTY (FSK D, DT2).
|
||||
func (a *App) SetKenwoodPanelMode(mode string) error {
|
||||
return a.kenwoodPanelDo(func(k cat.KenwoodPanelController) error { return k.SetKenwoodPanelMode(mode) })
|
||||
}
|
||||
|
||||
// SetKenwoodRITOffset sets the RIT/XIT offset to an absolute value in Hz.
|
||||
func (a *App) SetKenwoodRITOffset(hz int) error {
|
||||
return a.kenwoodPanelDo(func(k cat.KenwoodPanelController) error { return k.SetKenwoodRITOffset(hz) })
|
||||
}
|
||||
|
||||
func (a *App) SetKenwoodPower(w int) error {
|
||||
return a.kenwoodPanelDo(func(k cat.KenwoodPanelController) error { return k.SetKenwoodPower(w) })
|
||||
}
|
||||
|
||||
@@ -1,4 +1,26 @@
|
||||
[
|
||||
{
|
||||
"version": "0.26.24",
|
||||
"date": "",
|
||||
"en": [
|
||||
"TCI (SunSDR): the meter subscription is renewed when the radio announces it is ready — sent only at connect, it could fall inside the initial state dump and be ignored, which left the transmit power and SWR empty. The log now also records the subscription and the first sensor frames, so a report can tell “the radio never sends them” from “they arrived and were dropped”.",
|
||||
"Sending a spot while in split now pre-fills the RX frequency — where the station actually is — instead of the TX frequency, which spotted the pile-up five up from the DX.",
|
||||
"Cluster: NEW SLOT gets its own colour — the sky cyan the panadapter palette already uses for it, clearly apart from POTA green and the yellows. The NEW SLOT and NEW COUNTY filter chips now wear the same colours as the badges they select, and the NEW CALL filter works even when the slot-highlight display option is off.",
|
||||
"Elecraft console: a mode row — CW, USB, LSB, DATA and DATA RTTY. The two DATA buttons set the K3’s submode as well (DATA A for FT8/FT4, FSK D for RTTY): switching to DATA by mode alone kept whatever submode the last session left, which is how a K3 “in DATA” keys FT8 with no audio.",
|
||||
"DX Cluster settings: “I chase POTA” and “I chase SOTA”, on by default. Unticked, the NEW POTA badge, colour and filter disappear — a new-band + new-POTA spot reads NEW BAND alone — and the reference columns stay empty.",
|
||||
"Elecraft console: RIT and XIT use the same control as the Icom and TCI consoles — ± buttons, mouse wheel, typed value, Ctrl+←/→ — and the power slider moves in 1 W steps instead of 5.",
|
||||
"Bulk edit: My DXCC, My CQ zone and My ITU zone join the My-station fields — numbers checked against their real ranges, empty clears."
|
||||
],
|
||||
"fr": [
|
||||
"TCI (SunSDR) : l'abonnement aux mesures est renouvelé quand la radio annonce qu'elle est prête — envoyé seulement à la connexion, il pouvait tomber pendant l'envoi initial de l'état et être ignoré, laissant la puissance et le ROS vides en émission. Le journal enregistre aussi l'abonnement et les premières trames de mesure, pour distinguer « la radio ne les envoie jamais » de « elles arrivaient et étaient perdues ».",
|
||||
"Envoyer un spot en split préremplit désormais la fréquence RX — là où la station se trouve réellement — au lieu de la fréquence TX, qui spottait le pile-up cinq au-dessus du DX.",
|
||||
"Cluster : NOUVEAU SLOT reçoit sa propre couleur — le cyan ciel que la palette du panadapter lui donne déjà, bien distinct du vert POTA et des jaunes. Les puces de filtre NOUVEAU SLOT et NOUVEAU COMTÉ portent désormais les couleurs des badges qu'elles sélectionnent, et le filtre NOUVEAU CALL fonctionne même quand l'option de surlignage par slot est désactivée.",
|
||||
"Console Elecraft : une rangée de modes — CW, USB, LSB, DATA et DATA RTTY. Les deux boutons DATA règlent aussi le sous-mode du K3 (DATA A pour FT8/FT4, FSK D pour le RTTY) : passer en DATA par le seul mode gardait le sous-mode de la session précédente, et un K3 « en DATA » manipulait le FT8 sans audio.",
|
||||
"Réglages DX Cluster : « Je chasse le POTA » et « Je chasse le SOTA », cochés par défaut. Décochés, le badge, la couleur et le filtre NOUVEAU POTA disparaissent — un spot nouvelle bande + nouveau POTA affiche seulement NOUVELLE BANDE — et les colonnes de références restent vides.",
|
||||
"Console Elecraft : le RIT et le XIT utilisent la même commande que les consoles Icom et TCI — boutons ±, molette, valeur tapée, Ctrl+←/→ — et le curseur de puissance avance par pas de 1 W au lieu de 5.",
|
||||
"Édition groupée : My DXCC, My CQ zone et My ITU zone rejoignent les champs Ma station — valeurs vérifiées contre leurs bornes réelles, vide efface."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.26.23",
|
||||
"date": "",
|
||||
|
||||
+31
-10
@@ -98,7 +98,7 @@ import { ExportFieldsDialog } from '@/components/ExportFieldsDialog';
|
||||
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 { applySpotDisplay, chasePota, readSpotDisplayOptions, spotIsWorked, SPOT_DISPLAY_OPTIONS_EXPOSED } from '@/lib/spotDisplay';
|
||||
import { AnswerDecode, HaltDecodeTx, LogUIError, FlexTXOnBand, GetMatrixColors, GetRotorPresets, GetRowColors, GetSpotTTLMinutes, GetSpotMax, IsNewUSCounty } from '../wailsjs/go/main/App';
|
||||
import { applyMatrixColors } from '@/lib/matrixColors';
|
||||
import { WorkedBeforeGrid } from '@/components/WorkedBeforeGrid';
|
||||
@@ -5870,6 +5870,13 @@ export default function App() {
|
||||
// worked call still matches its own entity status too (new-band/new-slot),
|
||||
// so it stays visible under those chips.
|
||||
const matches = (st !== 'worked' && clusterStatusFilter.has(st))
|
||||
// NEW CALL is a FACT about the callsign (never worked on this band and
|
||||
// mode), surfaced as a status only by the slot-highlight option. The
|
||||
// chip filters on the fact itself, so it works whether or not that
|
||||
// display option is on — worked_slot is computed whenever either
|
||||
// slot option is enabled.
|
||||
|| (clusterStatusFilter.has('new-call') && e?.worked_slot === false
|
||||
&& (!e?.status || e?.status === 'worked' || e?.status === 'new-call'))
|
||||
|| (!!e?.worked_call && clusterStatusFilter.has('worked'))
|
||||
|| (!!e?.new_pota && clusterStatusFilter.has('new-pota'))
|
||||
|| (!!e?.new_county && clusterStatusFilter.has('new-county'))
|
||||
@@ -5976,12 +5983,20 @@ export default function App() {
|
||||
);
|
||||
|
||||
const F_CHIP = 'px-1.5 py-[3px] rounded-md border text-[10px] font-bold tracking-wider transition-opacity';
|
||||
const fChip = (key: string, label: string, cls: string, on: boolean, toggle: () => void) => (
|
||||
<button key={key} type="button" onClick={toggle}
|
||||
className={cn(F_CHIP, on ? cls : `${cls} opacity-40 hover:opacity-80`)}>
|
||||
const fChip = (key: string, label: string, cls: string, on: boolean, toggle: () => void, style?: React.CSSProperties, title?: string) => (
|
||||
<button key={key} type="button" onClick={toggle} title={title}
|
||||
className={cn(F_CHIP, on ? cls : `${cls} opacity-40 hover:opacity-80`)} style={style}>
|
||||
{label}
|
||||
</button>
|
||||
);
|
||||
// chipStyle builds a filter chip in an arbitrary colour — for the statuses
|
||||
// whose grid badge is not one of the semantic tokens the chip classes cover.
|
||||
// A filter that does not look like what it selects has to be learned twice.
|
||||
const chipStyle = (c: string): React.CSSProperties => ({
|
||||
color: c,
|
||||
borderColor: `color-mix(in srgb, ${c} 45%, transparent)`,
|
||||
background: `color-mix(in srgb, ${c} 14%, transparent)`,
|
||||
});
|
||||
|
||||
const renderClusterFilters = () => (
|
||||
<div className="w-56 shrink-0 border-l border-border/60 flex flex-col min-h-0 bg-muted/10">
|
||||
@@ -6097,14 +6112,14 @@ export default function App() {
|
||||
{ k: 'new-band-mode' as SpotFilterKey, label: 'NEW B+M', cls: 'bg-danger-muted text-danger-muted-foreground border-danger-border' },
|
||||
{ k: 'new-band' as SpotFilterKey, label: 'NEW BAND', cls: 'bg-warning-muted text-warning-muted-foreground border-warning-border' },
|
||||
{ k: 'new-mode' as SpotFilterKey, label: 'NEW MODE', cls: 'bg-caution-muted text-caution-muted-foreground border-caution-border' },
|
||||
{ k: 'new-slot' as SpotFilterKey, label: 'NEW SLOT', cls: 'bg-caution-muted text-caution-muted-foreground border-caution-border' },
|
||||
{ k: 'new-slot' as SpotFilterKey, label: 'NEW SLOT', cls: 'border', style: chipStyle('#5AC8FA') },
|
||||
// NEW CALL is about the CALLSIGN, not the entity: never worked on this
|
||||
// band and mode. Only appears when the slot-highlight option is on.
|
||||
{ k: 'new-call' as SpotFilterKey, label: 'NEW CALL', cls: 'bg-caution-muted text-caution-muted-foreground border-caution-border' },
|
||||
// Same colours as the badges in the grid — a filter that does not
|
||||
// look like what it selects has to be learned twice.
|
||||
{ k: 'new-pota' as SpotFilterKey, label: 'NEW POTA', cls: 'bg-success-muted text-success-muted-foreground border-success-border' },
|
||||
{ k: 'new-county' as SpotFilterKey, label: 'NEW COUNTY', cls: 'bg-success-muted text-success-muted-foreground border-success-border' },
|
||||
{ k: 'new-county' as SpotFilterKey, label: 'NEW COUNTY', cls: 'border', style: chipStyle('var(--chart-5)') },
|
||||
{ k: 'new-pfx' as SpotFilterKey, label: 'NEW PFX', cls: 'bg-caution-muted text-caution-muted-foreground border-caution-border' },
|
||||
// Only ever set for a station this receiver decoded over the UDP link.
|
||||
{ k: 'new-grid' as SpotFilterKey, label: 'NEW GRID', cls: 'bg-muted text-foreground border-border' },
|
||||
@@ -6112,8 +6127,9 @@ export default function App() {
|
||||
// worked spots; the separate "Hide worked" checkbox drops them — they
|
||||
// are opposite controls, so don't use both at once.
|
||||
{ k: 'worked' as SpotFilterKey, label: 'WORKED', cls: 'bg-info-muted text-info-muted-foreground border-info-border' },
|
||||
]).map((s) => fChip(s.k, s.label, s.cls, clusterStatusFilter.has(s.k),
|
||||
() => setClusterStatusFilter((cur) => { const n = new Set(cur); if (n.has(s.k)) n.delete(s.k); else n.add(s.k); return n; })))}
|
||||
]).filter((s: any) => s.k !== 'new-pota' || chasePota())
|
||||
.map((s: any) => fChip(s.k, s.label, s.cls, clusterStatusFilter.has(s.k),
|
||||
() => setClusterStatusFilter((cur) => { const n = new Set(cur); if (n.has(s.k)) n.delete(s.k); else n.add(s.k); return n; }), s.style))}
|
||||
</div>,
|
||||
clusterStatusFilter.size > 0 ? (
|
||||
<button type="button" onClick={() => setClusterStatusFilter(new Set())}
|
||||
@@ -8652,9 +8668,14 @@ export default function App() {
|
||||
// freqMhz display string, which the manual-edit freeze / field locks can
|
||||
// leave stale (that dropped the sub-kHz: on 14134.5 the frozen "14.134"
|
||||
// string spotted 14134). Fall back to the entry field, then the last QSO.
|
||||
//
|
||||
// The RX frequency when split, deliberately: a spot names where the
|
||||
// STATION is, and in split that is where we listen — freq_hz is where
|
||||
// we transmit, and spotting a 5-up pile-up's TX frequency sent the
|
||||
// whole cluster five kHz above the DX.
|
||||
defaultFreqKHz={
|
||||
catState.connected && (catState.freq_hz ?? 0) > 0
|
||||
? Math.round(((catState.freq_hz ?? 0) / 1000) * 10) / 10
|
||||
catState.connected && ((catState.split && (catState.freq_rx_hz ?? 0) > 0 ? catState.freq_rx_hz : catState.freq_hz) ?? 0) > 0
|
||||
? Math.round((((catState.split && (catState.freq_rx_hz ?? 0) > 0 ? catState.freq_rx_hz : catState.freq_hz) ?? 0) / 1000) * 10) / 10
|
||||
: parseFloat(freqMhz) > 0
|
||||
? Math.round(parseFloat(freqMhz) * 1000 * 10) / 10
|
||||
: (qsos[0]?.freq_hz ? Math.round((qsos[0].freq_hz / 1000) * 10) / 10 : 0)
|
||||
|
||||
@@ -272,11 +272,11 @@ export function BandMap({ band, spots, spotStatus: spotStatusRaw, currentFreqHz,
|
||||
// nothing until the next poll happened to hand over a fresh object.
|
||||
const dispOpts = readSpotDisplayOptions();
|
||||
const spotStatus = useMemo(() => {
|
||||
if (!dispOpts.muteWorked && !dispOpts.slotHighlight) return spotStatusRaw;
|
||||
if (!dispOpts.muteWorked && !dispOpts.slotHighlight && dispOpts.chasePota) return spotStatusRaw;
|
||||
const out: Record<string, SpotStatusEntry> = {};
|
||||
for (const k of Object.keys(spotStatusRaw)) out[k] = applySpotDisplay(spotStatusRaw[k], dispOpts) as SpotStatusEntry;
|
||||
return out;
|
||||
}, [spotStatusRaw, dispOpts.muteWorked, dispOpts.slotHighlight]);
|
||||
}, [spotStatusRaw, dispOpts.muteWorked, dispOpts.slotHighlight, dispOpts.chasePota]);
|
||||
// Re-render when the operator changes their IARU region in Settings.
|
||||
const [, setRegionTick] = useState(0);
|
||||
useEffect(() => subscribeIaruRegion(() => setRegionTick((n) => n + 1)), []);
|
||||
|
||||
@@ -60,6 +60,9 @@ const FIELDS: FieldDef[] = [
|
||||
// No promoted column: written into extras_json (see qso.bulkEditableExtras).
|
||||
{ id: 'owner_callsign', label: 'bulk.fOwnerCallsign', group: 'My station', kind: 'text', upper: true },
|
||||
{ id: 'my_grid', label: 'bulk.fMyGrid', group: 'My station', kind: 'text', upper: true },
|
||||
{ id: 'my_dxcc', label: 'bulk.fMyDxcc', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_cq_zone', label: 'bulk.fMyCqZone', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_itu_zone', label: 'bulk.fMyItuZone', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_antenna', label: 'bulk.fMyAntenna', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_rig', label: 'bulk.fMyRig', group: 'My station', kind: 'text' },
|
||||
{ id: 'my_street', label: 'bulk.fMyStreet', group: 'My station', kind: 'text' },
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { cleanSpotter, inferSpotMode, spotStatusKey } from '@/lib/spot';
|
||||
import { markerColour } from '@/lib/spotMarkers';
|
||||
import { applySpotDisplay, readSpotDisplayOptions } from '@/lib/spotDisplay';
|
||||
import { applySpotDisplay, chasePota, chaseSota, readSpotDisplayOptions } from '@/lib/spotDisplay';
|
||||
import { loadLocal, loadRemote, saveState, seedLocal, whenGridPrefsReady } from '@/lib/gridPrefs';
|
||||
import { distanceUnit, distanceValue, subscribeDistanceUnit } from '@/lib/units';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
@@ -148,6 +148,12 @@ function statusFor(p: any): SpotStatusEntry | undefined {
|
||||
// filled pfx → new prefix filled POTA → new park filled county → new county
|
||||
// blue call → already worked (not a novelty, so text only)
|
||||
const NEW = 'var(--warning)'; // yellow: something here is new
|
||||
// NEW SLOT gets its own hue. It shared the amber NEW family while the NEW PFX
|
||||
// marker sits in caution yellow — two different facts, two near-identical
|
||||
// colours in the same cell. Sky cyan, the exact colour the panadapter palette
|
||||
// ships for new-slot (#5AC8FA), so the two views tell one story — and clearly
|
||||
// apart from the POTA green the first attempt (aqua) sat next to.
|
||||
const NEWSLOT = '#5AC8FA';
|
||||
const WKD = 'var(--info)'; // blue: this callsign is already in the log
|
||||
|
||||
// FILLING the cell that carries the fact, rather than only tinting its text.
|
||||
@@ -190,9 +196,10 @@ function statusColor(s: SpotStatusEntry | undefined): string | null {
|
||||
case 'new-band-mode':
|
||||
case 'new-band':
|
||||
case 'new-mode':
|
||||
case 'new-slot':
|
||||
case 'new-call':
|
||||
return NEW;
|
||||
case 'new-slot':
|
||||
return NEWSLOT;
|
||||
default:
|
||||
return s?.worked_call ? WKD : null;
|
||||
}
|
||||
@@ -336,7 +343,9 @@ const makeColCatalog = (t: TFn): ColEntry[] => [
|
||||
},
|
||||
{
|
||||
group: 'Spot', label: t('clg2.c.pota'), colId: 'pota',
|
||||
headerName: t('clg2.c.pota'), field: 'pota_ref' as any, width: 92, cellClass: 'font-mono',
|
||||
headerName: t('clg2.c.pota'), width: 92, cellClass: 'font-mono',
|
||||
// Through a valueGetter so the chase switch empties the column live.
|
||||
valueGetter: (p: any) => (chasePota() ? p.data?.pota_ref ?? '' : ''),
|
||||
defaultVisible: true,
|
||||
cellStyle: (p: any) => (statusFor(p)?.new_pota
|
||||
? fillStyle(markerColour('new_pota'))
|
||||
@@ -349,7 +358,8 @@ const makeColCatalog = (t: TFn): ColEntry[] => [
|
||||
// which is why the column is off by default rather than an empty column for
|
||||
// everyone who does not watch summits.
|
||||
group: 'Spot', label: t('clg2.c.sota'), colId: 'sota',
|
||||
headerName: t('clg2.c.sota'), field: 'sota_ref' as any, width: 100, cellClass: 'font-mono',
|
||||
headerName: t('clg2.c.sota'), width: 100, cellClass: 'font-mono',
|
||||
valueGetter: (p: any) => (chaseSota() ? p.data?.sota_ref ?? '' : ''),
|
||||
defaultVisible: false,
|
||||
cellStyle: () => ({ color: 'var(--success)' }) as any,
|
||||
},
|
||||
|
||||
@@ -4,17 +4,18 @@ import {
|
||||
GetKenwoodState, RefreshKenwood, SetKenwoodPower, SetKenwoodAFGain, SetKenwoodTX, TuneKenwoodATU,
|
||||
SetKenwoodRFGain, SetKenwoodMicGain, SetKenwoodSquelch, SetKenwoodPreamp, SetKenwoodAtt,
|
||||
SetKenwoodNB, SetKenwoodNR, SetKenwoodAGC, SetKenwoodFilter, SetKenwoodAntenna,
|
||||
SetKenwoodRIT, SetKenwoodXIT, ClearKenwoodRIT, SetKenwoodKeySpeed, ToggleKenwoodATU, NudgeKenwoodRIT,
|
||||
SetKenwoodRIT, SetKenwoodXIT, ClearKenwoodRIT, SetKenwoodKeySpeed, ToggleKenwoodATU, SetKenwoodRITOffset, SetKenwoodPanelMode,
|
||||
GetCATState,
|
||||
} from '../../wailsjs/go/main/App';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { sMeterRST } from '@/lib/rst';
|
||||
import { ShiftRow } from '@/components/ShiftRow';
|
||||
import { MeterBar } from '@/components/MeterBar';
|
||||
import { WheelRange } from '@/components/WheelRange';
|
||||
|
||||
type KenwoodState = {
|
||||
available: boolean; model?: string; elecraft: boolean; mode?: string;
|
||||
available: boolean; model?: string; elecraft: boolean; mode?: string; data_sub?: string;
|
||||
transmitting: boolean; split: boolean; split_tx_hz?: number;
|
||||
s_meter: number; s_meter_raw: number;
|
||||
power_meter: number; swr: number; swr_raw: number;
|
||||
@@ -89,9 +90,34 @@ function Toggle({ label, on, off, onClick }: { label: string; on: boolean; off:
|
||||
);
|
||||
}
|
||||
|
||||
// isDataMode: what the rig reports for MD6 varies — "DATA", or the configured
|
||||
// digital default (FT8…) — so the DATA family is "not one of the native modes".
|
||||
function isDataMode(m?: string): boolean {
|
||||
switch ((m ?? '').toUpperCase()) {
|
||||
case '': case 'CW': case 'USB': case 'LSB': case 'SSB': case 'FM': case 'AM': case 'RTTY':
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) => void }) {
|
||||
const { t } = useI18n();
|
||||
const [st, setSt] = useState<KenwoodState>(ZERO);
|
||||
// Ctrl+Left/Right shifts the RIT by ±10 Hz while RIT is on — the same
|
||||
// keyboard clarifier the Icom and TCI consoles have, for zero-beating a
|
||||
// caller without touching the mouse.
|
||||
const stRef = useRef(st); stRef.current = st;
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (!e.ctrlKey || (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight')) return;
|
||||
const v = stRef.current;
|
||||
if (!v.available || !v.rit) return;
|
||||
e.preventDefault();
|
||||
SetKenwoodRITOffset((v.rit_offset || 0) + (e.key === 'ArrowRight' ? 10 : -10)).catch(() => {});
|
||||
};
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => window.removeEventListener('keydown', onKey);
|
||||
}, []);
|
||||
const [freqHz, setFreqHz] = useState(0);
|
||||
const [err, setErr] = useState('');
|
||||
// Optimistic overlay: a slider must follow the finger, not the poll. Dropped
|
||||
@@ -149,6 +175,28 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
||||
{freqHz > 0 ? (freqHz / 1e6).toFixed(6) : '—'}
|
||||
</div>
|
||||
</div>
|
||||
{/* Mode row. The two DATA buttons are why it exists: MD6 alone keeps
|
||||
whatever submode the last session left, and a K3 "in DATA" with FSK D
|
||||
still armed keys FT8 with no audio. DATA sends MD6+DT0 (DATA A, the
|
||||
soundcard path), RTTY sends MD6+DT2 (FSK D). The active DATA button
|
||||
follows the rig's own DT answer. */}
|
||||
<div className="inline-flex rounded-md border border-border overflow-hidden">
|
||||
{([
|
||||
['CW', 'CW', view.mode === 'CW'],
|
||||
['USB', 'USB', view.mode === 'USB'],
|
||||
['LSB', 'LSB', view.mode === 'LSB'],
|
||||
['DATA', t('k3.modeData'), isDataMode(view.mode) && view.data_sub !== 'FSK D' && view.data_sub !== 'PSK D'],
|
||||
['RTTY', t('k3.modeRtty'), (isDataMode(view.mode) && (view.data_sub === 'FSK D' || view.data_sub === 'PSK D')) || view.mode === 'RTTY'],
|
||||
] as [string, string, boolean][]).map(([cmd, label, on]) => (
|
||||
<button key={cmd} type="button" disabled={off}
|
||||
title={cmd === 'DATA' ? t('k3.modeDataHint') : cmd === 'RTTY' ? t('k3.modeRttyHint') : label}
|
||||
onClick={() => SetKenwoodPanelMode(cmd).catch((e: any) => setErr(String(e?.message ?? e)))}
|
||||
className={cn('px-2.5 py-1.5 text-xs font-bold border-l border-border first:border-l-0',
|
||||
on ? 'bg-primary text-primary-foreground' : 'bg-card text-muted-foreground hover:bg-muted')}>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<button type="button" className="text-[11px] text-muted-foreground hover:text-foreground flex items-center gap-1"
|
||||
onClick={() => RefreshKenwood().catch(() => {})} title={t('k3.refreshHint')}>
|
||||
<SlidersHorizontal className="size-3.5" />
|
||||
@@ -216,7 +264,7 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-6 gap-y-2">
|
||||
<label className="flex items-center gap-2 text-xs">
|
||||
<span className="w-16 shrink-0 text-muted-foreground">{t('k3.power')}</span>
|
||||
<WheelRange min={0} max={110} step={5} disabled={off}
|
||||
<WheelRange min={0} max={110} step={1} disabled={off}
|
||||
value={view.rf_power ?? 0}
|
||||
onChange={(n) => put({ rf_power: n }, () => SetKenwoodPower(n))} />
|
||||
<span className="w-12 text-right font-mono tabular-nums">{view.rf_power ?? 0} W</span>
|
||||
@@ -279,21 +327,18 @@ export function ElecraftPanel({ onReportRST }: { onReportRST?: (rst: string) =>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* RIT / XIT. Clear zeroes both offsets at once — the radio's own RC,
|
||||
and what an operator means by "clear it". */}
|
||||
{/* RIT / XIT — the shared ShiftRow, exactly as the Icom and TCI consoles
|
||||
drive theirs: ± / wheel / type, Ctrl+←/→ while RIT is on. The K3 has
|
||||
ONE offset for both, so both rows show it, like the Icom's. */}
|
||||
<div className="space-y-1.5">
|
||||
<ShiftRow label="RIT" accent="#8b5cf6" on={view.rit} hz={view.rit_offset || 0} disabled={off}
|
||||
onToggle={() => SetKenwoodRIT(!view.rit).catch(setErrMsg)}
|
||||
onSet={(hz) => SetKenwoodRITOffset(hz).catch(setErrMsg)} />
|
||||
<ShiftRow label="XIT" accent="#f59e0b" on={view.xit} hz={view.rit_offset || 0} disabled={off}
|
||||
onToggle={() => SetKenwoodXIT(!view.xit).catch(setErrMsg)}
|
||||
onSet={(hz) => SetKenwoodRITOffset(hz).catch(setErrMsg)} />
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<Toggle label="RIT" on={view.rit} off={off} onClick={() => SetKenwoodRIT(!view.rit).catch(setErrMsg)} />
|
||||
<Toggle label="XIT" on={view.xit} off={off} onClick={() => SetKenwoodXIT(!view.xit).catch(setErrMsg)} />
|
||||
{/* The offset itself. A lit RIT button says the feature is on and
|
||||
nothing about where it has put the receiver. */}
|
||||
{[-100, -10, 10, 100].map((d) => (
|
||||
<Toggle key={d} label={(d > 0 ? '+' : '') + d} on={false} off={off}
|
||||
onClick={() => NudgeKenwoodRIT(d).catch(setErrMsg)} />
|
||||
))}
|
||||
<span className="text-[11px] font-mono tabular-nums text-muted-foreground w-16">
|
||||
{view.rit_offset > 0 ? '+' : ''}{view.rit_offset || 0} Hz
|
||||
</span>
|
||||
<Toggle label={t('k3.clear')} on={false} off={off} onClick={() => ClearKenwoodRIT().catch(setErrMsg)} />
|
||||
{/* Antenna only when the radio answered AN — a K3 without the internal
|
||||
ATU has one socket and no switch to offer. */}
|
||||
{view.antenna > 0 && (<>
|
||||
|
||||
@@ -2068,6 +2068,8 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
try { await SaveGridScopeSettings(next); } catch { /* the panel keeps the choice either way */ }
|
||||
};
|
||||
const [chaseGrids, setChaseGrids] = useState(false);
|
||||
const [chasePotaOn, setChasePotaOn] = useState(() => localStorage.getItem('opslog.chasePota') !== '0');
|
||||
const [chaseSotaOn, setChaseSotaOn] = useState(() => localStorage.getItem('opslog.chaseSota') !== '0');
|
||||
const [chaseNew, setChaseNew] = useState(false);
|
||||
const [spotTTL, setSpotTTL] = useState(0);
|
||||
const [spotTTLText, setSpotTTLText] = useState('0');
|
||||
@@ -5314,11 +5316,6 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('clu.freeNodes')} <span className="font-mono">dxc.k0xm.net:7300</span>,{' '}
|
||||
<span className="font-mono">dx.maritimecontestclub.net:7300</span>,{' '}
|
||||
<span className="font-mono">w8avi.net:7300</span>.
|
||||
</p>
|
||||
<label className="flex items-start gap-2 text-sm cursor-pointer border-t border-border/60 pt-3">
|
||||
<Checkbox checked={clusterWorkedSameSlot} className="mt-0.5"
|
||||
onCheckedChange={(c) => { const v = !!c; setClusterWorkedSameSlot(v); writeUiPref('opslog.clusterWorkedSameSlot', v ? '1' : '0'); }} />
|
||||
@@ -5380,11 +5377,24 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
const n = parseInt(raw, 10);
|
||||
if (Number.isFinite(n) && n > 0) SetSpotMax(Math.min(10000, n)).catch(() => {});
|
||||
}} />
|
||||
<span className="text-xs text-muted-foreground">{t('clu.spotMaxHint')}</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="border-t border-border/60 pt-3 space-y-2">
|
||||
{/* Chase switches: off, the marker stops being TOLD, everywhere at
|
||||
once — badge, colour, filter chip, reference column. A "new band
|
||||
+ new POTA" spot then reads NEW BAND alone. */}
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer" title={t('clu.chasePotaHint')}>
|
||||
<Checkbox checked={chasePotaOn}
|
||||
onCheckedChange={(c) => { const v = !!c; setChasePotaOn(v); writeUiPref('opslog.chasePota', v ? '1' : '0'); }} />
|
||||
{t('clu.chasePota')}
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm cursor-pointer" title={t('clu.chaseSotaHint')}>
|
||||
<Checkbox checked={chaseSotaOn}
|
||||
onCheckedChange={(c) => { const v = !!c; setChaseSotaOn(v); writeUiPref('opslog.chaseSota', v ? '1' : '0'); }} />
|
||||
{t('clu.chaseSota')}
|
||||
</label>
|
||||
<label className="flex items-start gap-2 text-sm cursor-pointer">
|
||||
<Checkbox checked={chaseGrids} className="mt-0.5"
|
||||
onCheckedChange={(c) => { setChaseGrids(!!c); SetChaseNewGrids(!!c).catch(() => {}); }} />
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,7 +11,25 @@
|
||||
//
|
||||
// They compose deliberately: mute what is done, light up what is not.
|
||||
|
||||
export type SpotDisplayOptions = { muteWorked: boolean; slotHighlight: boolean };
|
||||
export type SpotDisplayOptions = {
|
||||
muteWorked: boolean; slotHighlight: boolean;
|
||||
// Chase switches (Settings → DX Cluster), ON by default. An operator who does
|
||||
// not chase parks does not want NEW POTA shouting from every activator spot:
|
||||
// off, the marker is withdrawn at the display layer — a "new band + new POTA"
|
||||
// spot simply reads NEW BAND — and the reference column goes quiet. The facts
|
||||
// keep being computed; only the telling stops, so ticking the box back on
|
||||
// needs no rescan.
|
||||
chasePota: boolean; chaseSota: boolean;
|
||||
};
|
||||
|
||||
// chasePota/chaseSota read the switches directly — for the places that show a
|
||||
// REFERENCE rather than a status (the POTA and SOTA columns).
|
||||
export function chasePota(): boolean {
|
||||
try { return localStorage.getItem('opslog.chasePota') !== '0'; } catch { return true; }
|
||||
}
|
||||
export function chaseSota(): boolean {
|
||||
try { return localStorage.getItem('opslog.chaseSota') !== '0'; } catch { return true; }
|
||||
}
|
||||
|
||||
// Both options are withdrawn from the filter panel for now. The machinery below
|
||||
// is deliberately kept whole — it is correct and hard-won — so putting the two
|
||||
@@ -23,14 +41,19 @@ export type SpotDisplayOptions = { muteWorked: boolean; slotHighlight: boolean }
|
||||
export const SPOT_DISPLAY_OPTIONS_EXPOSED = false;
|
||||
|
||||
export function readSpotDisplayOptions(): SpotDisplayOptions {
|
||||
if (!SPOT_DISPLAY_OPTIONS_EXPOSED) return { muteWorked: false, slotHighlight: false };
|
||||
// The EXPOSED flag only withdraws the two original switches; the chase
|
||||
// switches are live regardless.
|
||||
if (!SPOT_DISPLAY_OPTIONS_EXPOSED) {
|
||||
return { muteWorked: false, slotHighlight: false, chasePota: chasePota(), chaseSota: chaseSota() };
|
||||
}
|
||||
try {
|
||||
return {
|
||||
muteWorked: localStorage.getItem('opslog.clusterMuteWorked') === '1',
|
||||
slotHighlight: localStorage.getItem('opslog.clusterSlotHighlight') === '1',
|
||||
chasePota: chasePota(), chaseSota: chaseSota(),
|
||||
};
|
||||
} catch {
|
||||
return { muteWorked: false, slotHighlight: false };
|
||||
return { muteWorked: false, slotHighlight: false, chasePota: true, chaseSota: true };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +95,9 @@ export function applySpotDisplay<T extends Entry>(s: T, o: SpotDisplayOptions):
|
||||
if (o.muteWorked) {
|
||||
e = { ...e, worked_call: false } as NonNullable<T>;
|
||||
}
|
||||
if (!o.chasePota && e.new_pota) {
|
||||
e = { ...e, new_pota: false } as NonNullable<T>;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ const PORTABLE_KEYS = [
|
||||
'opslog.clusterModeFilter', 'opslog.clusterSearch', 'opslog.clusterHideWorked',
|
||||
'opslog.distanceMiles', // distances shown in statute miles rather than km
|
||||
'opslog.iaruRegion', // IARU region (1/2/3) — band edges and segments on the band maps
|
||||
'opslog.chasePota', // show POTA references and the NEW POTA marker on spots
|
||||
'opslog.chaseSota', // show SOTA references on spots
|
||||
'opslog.activeTab', // last selected tab
|
||||
'opslog.mainSplit', // Main tab: width share of the left pane (percent) — legacy, read once to seed mainShares
|
||||
'opslog.mainShares', // Main tab: column shares per column count, as {2:[..],3:[..],4:[..]}
|
||||
|
||||
Vendored
+4
@@ -1145,6 +1145,8 @@ export function SetKenwoodNB(arg1:boolean):Promise<void>;
|
||||
|
||||
export function SetKenwoodNR(arg1:boolean):Promise<void>;
|
||||
|
||||
export function SetKenwoodPanelMode(arg1:string):Promise<void>;
|
||||
|
||||
export function SetKenwoodPower(arg1:number):Promise<void>;
|
||||
|
||||
export function SetKenwoodPreamp(arg1:boolean):Promise<void>;
|
||||
@@ -1153,6 +1155,8 @@ export function SetKenwoodRFGain(arg1:number):Promise<void>;
|
||||
|
||||
export function SetKenwoodRIT(arg1:boolean):Promise<void>;
|
||||
|
||||
export function SetKenwoodRITOffset(arg1:number):Promise<void>;
|
||||
|
||||
export function SetKenwoodSquelch(arg1:number):Promise<void>;
|
||||
|
||||
export function SetKenwoodTX(arg1:boolean):Promise<void>;
|
||||
|
||||
@@ -2230,6 +2230,10 @@ export function SetKenwoodNR(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodNR'](arg1);
|
||||
}
|
||||
|
||||
export function SetKenwoodPanelMode(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodPanelMode'](arg1);
|
||||
}
|
||||
|
||||
export function SetKenwoodPower(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodPower'](arg1);
|
||||
}
|
||||
@@ -2246,6 +2250,10 @@ export function SetKenwoodRIT(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodRIT'](arg1);
|
||||
}
|
||||
|
||||
export function SetKenwoodRITOffset(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodRITOffset'](arg1);
|
||||
}
|
||||
|
||||
export function SetKenwoodSquelch(arg1) {
|
||||
return window['go']['main']['App']['SetKenwoodSquelch'](arg1);
|
||||
}
|
||||
|
||||
@@ -1072,6 +1072,7 @@ export namespace cat {
|
||||
model?: string;
|
||||
elecraft: boolean;
|
||||
mode?: string;
|
||||
data_sub?: string;
|
||||
transmitting: boolean;
|
||||
split: boolean;
|
||||
split_tx_hz: number;
|
||||
@@ -1108,6 +1109,7 @@ export namespace cat {
|
||||
this.model = source["model"];
|
||||
this.elecraft = source["elecraft"];
|
||||
this.mode = source["mode"];
|
||||
this.data_sub = source["data_sub"];
|
||||
this.transmitting = source["transmitting"];
|
||||
this.split = source["split"];
|
||||
this.split_tx_hz = source["split_tx_hz"];
|
||||
|
||||
@@ -35,6 +35,11 @@ type KenwoodTXState struct {
|
||||
Model string `json:"model,omitempty"`
|
||||
Elecraft bool `json:"elecraft"` // a K3/K4 rather than a Kenwood
|
||||
Mode string `json:"mode,omitempty"`
|
||||
// DataSub is the K3/K4 DATA submode while in DATA mode (DT): "DATA A",
|
||||
// "AFSK A", "FSK D" or "PSK D". Empty on a Kenwood, and outside DATA. The
|
||||
// panel's two DATA buttons need it to show WHICH data mode the rig is in —
|
||||
// FT8 wants DATA A, RTTY wants FSK D, and MD6 alone cannot say which.
|
||||
DataSub string `json:"data_sub,omitempty"`
|
||||
|
||||
Transmitting bool `json:"transmitting"`
|
||||
Split bool `json:"split"`
|
||||
@@ -107,10 +112,12 @@ type KenwoodPanelController interface {
|
||||
SetKenwoodRIT(bool) error
|
||||
SetKenwoodXIT(bool) error
|
||||
NudgeKenwoodRIT(int) error
|
||||
SetKenwoodRITOffset(int) error
|
||||
ClearKenwoodRIT() error
|
||||
SetKenwoodTX(bool) error
|
||||
TuneKenwoodATU() error
|
||||
ToggleKenwoodATU() error
|
||||
SetKenwoodPanelMode(string) error
|
||||
}
|
||||
|
||||
// kenwoodPanelSlowBeat is how many polls pass between full re-reads of the
|
||||
@@ -212,6 +219,14 @@ func (k *Kenwood) readPanelSettings() {
|
||||
if v, ok := k.askNum("NR;", "NR", 1); ok {
|
||||
k.panel.NR = v != 0
|
||||
}
|
||||
// The DATA submode, Elecraft only (a plain Kenwood has no DT and would "?;"
|
||||
// it). Read every settings beat: the operator changes it from the rig's own
|
||||
// front panel mid-session, and the two DATA buttons must follow.
|
||||
if k.elecraft {
|
||||
if v, ok := k.askNum("DT;", "DT", 1); ok {
|
||||
k.panel.DataSub = kenwoodDataSubName(v)
|
||||
}
|
||||
}
|
||||
if v, ok := k.askNum("GT;", "GT", 3); ok {
|
||||
k.panel.AGC = kenwoodAGCName(v)
|
||||
}
|
||||
@@ -564,6 +579,16 @@ func (k *Kenwood) SetKenwoodXIT(on bool) error {
|
||||
|
||||
// ClearKenwoodRIT zeroes the RIT/XIT offset, both at once — which is what RC
|
||||
// does and what the operator means by "clear it".
|
||||
// SetKenwoodRITOffset writes the offset as an ABSOLUTE value — what the shared
|
||||
// ShiftRow control speaks. Nudge stays for the keyboard clarifier; both funnel
|
||||
// into the same RO write.
|
||||
func (k *Kenwood) SetKenwoodRITOffset(hz int) error {
|
||||
k.mu.Lock()
|
||||
cur := k.panel.RITOffset
|
||||
k.mu.Unlock()
|
||||
return k.NudgeKenwoodRIT(hz - cur)
|
||||
}
|
||||
|
||||
func (k *Kenwood) ClearKenwoodRIT() error {
|
||||
return k.setPanel("RC;")
|
||||
}
|
||||
@@ -650,3 +675,58 @@ func (k *Kenwood) askNum(cmd, prefix string, digits int) (int, bool) {
|
||||
}
|
||||
return n, true
|
||||
}
|
||||
|
||||
// kenwoodDataSubName decodes DT (K3/K4 programmer's reference).
|
||||
func kenwoodDataSubName(v int) string {
|
||||
switch v {
|
||||
case 0:
|
||||
return "DATA A"
|
||||
case 1:
|
||||
return "AFSK A"
|
||||
case 2:
|
||||
return "FSK D"
|
||||
case 3:
|
||||
return "PSK D"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetKenwoodPanelMode is the panel's mode row: CW / USB / LSB / DATA / RTTY.
|
||||
//
|
||||
// It exists because SetMode is the LOGGER's path — it maps an ADIF mode and
|
||||
// honours the data-mode preference — while a panel button is the operator
|
||||
// saying exactly what the rig should do. The two DATA cases are the point:
|
||||
// "DATA" is MD6 + DT0 (DATA A, the soundcard submode FT8/FT4 modulate through)
|
||||
// and "RTTY" is MD6 + DT2 (FSK D, the K3's direct-keyed RTTY). MD6 alone keeps
|
||||
// whatever submode a prior session left, which is how a K3 "in DATA" transmits
|
||||
// FT8 with no audio — the report behind this row.
|
||||
func (k *Kenwood) SetKenwoodPanelMode(mode string) error {
|
||||
k.mu.Lock()
|
||||
defer k.mu.Unlock()
|
||||
if k.port == nil {
|
||||
return fmt.Errorf("kenwood: not connected")
|
||||
}
|
||||
var cmds []string
|
||||
switch strings.ToUpper(strings.TrimSpace(mode)) {
|
||||
case "CW":
|
||||
cmds = []string{"MD3;"}
|
||||
case "USB":
|
||||
cmds = []string{"MD2;"}
|
||||
case "LSB":
|
||||
cmds = []string{"MD1;"}
|
||||
case "DATA":
|
||||
cmds = []string{"MD6;", "DT0;"}
|
||||
case "RTTY":
|
||||
cmds = []string{"MD6;", "DT2;"}
|
||||
default:
|
||||
return fmt.Errorf("kenwood panel: unknown mode %q", mode)
|
||||
}
|
||||
for _, c := range cmds {
|
||||
if err := k.write(c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Re-read the settings on the next poll so Mode and DataSub confirm at once.
|
||||
k.panelCycle = kenwoodPanelSlowBeat
|
||||
return nil
|
||||
}
|
||||
|
||||
+26
-2
@@ -165,8 +165,7 @@ func (t *TCI) Connect() error {
|
||||
if t.spotsEnabled {
|
||||
debugLog.Printf("TCI: panorama spots are ON — spots will be sent to the radio")
|
||||
}
|
||||
_ = t.send("rx_sensors_enable:true,200;")
|
||||
_ = t.send("tx_sensors_enable:true,200;")
|
||||
t.subscribeSensors("connect")
|
||||
if t.spotsEnabled {
|
||||
// Forget what we thought was on the panorama at the same moment the radio
|
||||
// is told to drop it. Kept, the memory would suppress the next spot for
|
||||
@@ -461,6 +460,24 @@ func (t *TCI) SetTXAudioSource(src string) {
|
||||
}
|
||||
|
||||
// send writes a command to the WebSocket (one writer at a time).
|
||||
// subscribeSensors asks the radio to push its meters. Nothing measures anything
|
||||
// until this goes out — the S-meter, the transmit power and the SWR are all
|
||||
// subscription-only (TCI §4.4) — and it is sent at connect AND again at every
|
||||
// "ready", because a subscription sent during the server's initial dump can be
|
||||
// dropped. 200 ms is the rate the protocol's own examples use.
|
||||
func (t *TCI) subscribeSensors(when string) {
|
||||
// Both cases, deliberately. Every other command this backend sends works in
|
||||
// lower case, but the meters stayed silent on a real SunSDR through two
|
||||
// rounds of fixes — and the protocol document's own examples are upper case
|
||||
// (TX_SENSORS_ENABLE:true,200;). A server that is case-insensitive ignores
|
||||
// the duplicate; one that is not finally hears the subscription.
|
||||
e1 := t.send("rx_sensors_enable:true,200;")
|
||||
e2 := t.send("tx_sensors_enable:true,200;")
|
||||
_ = t.send("RX_SENSORS_ENABLE:true,200;")
|
||||
_ = t.send("TX_SENSORS_ENABLE:true,200;")
|
||||
debugLog.Printf("TCI: sensor subscription sent (%s, both cases): rx=%v tx=%v", when, e1, e2)
|
||||
}
|
||||
|
||||
func (t *TCI) send(cmd string) error {
|
||||
t.mu.Lock()
|
||||
c := t.conn
|
||||
@@ -567,6 +584,13 @@ func (t *TCI) handle(msg string) {
|
||||
}
|
||||
case "ready", "start":
|
||||
t.ready = true
|
||||
// (Re)subscribe to the meters HERE, not only at connect. ExpertSDR3
|
||||
// dumps its whole state and then says "ready"; a unidirectional control
|
||||
// command sent while that dump is still in flight can be ignored, and
|
||||
// the report from a real SunSDR — transmit meters still empty after the
|
||||
// connect-time subscription — has exactly that shape. From a goroutine:
|
||||
// send takes t.mu, which this handler holds.
|
||||
go t.subscribeSensors("ready")
|
||||
case "stop":
|
||||
t.ready = false
|
||||
case "vfo":
|
||||
|
||||
@@ -113,7 +113,8 @@ func (t *TCI) handlePanel(name string, get func(int) string, args string) bool {
|
||||
// it. What the radio actually announces after the command settles whether
|
||||
// this is our reading or its doing, and no amount of reasoning will.
|
||||
switch name {
|
||||
case "mute", "sql_enable", "sql_level", "tx_power", "tx_swr", "tune":
|
||||
case "mute", "sql_enable", "sql_level", "tx_power", "tx_swr", "tune",
|
||||
"tx_sensors", "rx_sensors", "rx_channel_sensors":
|
||||
// Logged on arrival so an ANSWER can be told from a SILENCE: the log
|
||||
// showed the transmit meters being asked for and nothing coming back,
|
||||
// which on its own proves nothing — a reply that arrived and failed to
|
||||
|
||||
@@ -868,6 +868,44 @@ var bulkEditableCols = map[string]bool{
|
||||
|
||||
// BulkSetField sets one whitelisted column to value on every listed QSO in a
|
||||
// single statement. value "" clears the field. Returns rows affected.
|
||||
// bulkEditableIntCols are the NUMERIC columns the bulk editor may touch. Their
|
||||
// own path, not the text one: the columns are nullable integers, and while
|
||||
// SQLite would coerce "14" quietly, a shared MySQL logbook would not — and an
|
||||
// empty string is NULL here, never "".
|
||||
var bulkEditableIntCols = map[string]bool{
|
||||
"my_dxcc": true,
|
||||
"my_cq_zone": true,
|
||||
"my_itu_zone": true,
|
||||
}
|
||||
|
||||
// BulkSetIntField sets one integer column across the ids; v nil clears it.
|
||||
func (r *Repo) BulkSetIntField(ctx context.Context, ids []int64, column string, v *int) (int64, error) {
|
||||
if !bulkEditableIntCols[column] {
|
||||
return 0, fmt.Errorf("field %q is not bulk-editable", column)
|
||||
}
|
||||
if len(ids) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
ph := make([]string, len(ids))
|
||||
args := make([]any, 0, len(ids)+2)
|
||||
var val any
|
||||
if v != nil {
|
||||
val = *v
|
||||
}
|
||||
args = append(args, val, db.NowISO())
|
||||
for i, id := range ids {
|
||||
ph[i] = "?"
|
||||
args = append(args, id)
|
||||
}
|
||||
res, err := r.db.ExecContext(ctx,
|
||||
"UPDATE qso SET "+column+" = ?, updated_at = ? WHERE id IN ("+strings.Join(ph, ",")+")", args...)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("bulk set %s: %w", column, err)
|
||||
}
|
||||
n, _ := res.RowsAffected()
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (r *Repo) BulkSetField(ctx context.Context, ids []int64, column, value string) (int64, error) {
|
||||
if !bulkEditableCols[column] {
|
||||
return 0, fmt.Errorf("field %q is not bulk-editable", column)
|
||||
|
||||
Reference in New Issue
Block a user