merge: Elecraft KPA500 and KPA1500 amplifiers

A fourth amplifier brand alongside the SPE, the Acom and the PowerGenius,
sharing the same multi-amplifier support: the linking, the fan-out and the
polling all work on it unchanged.

The protocol is the Elecraft one — a caret, letters, a semicolon — decoded
from the KPA1500 Programming Reference, with the document's own examples
kept as the test. ^WS gives forward power and SWR in one exchange, ^VI
gives volts in tenths and amps whole, and ^FL is HEX: read as decimal, the
'antenna not connected' fault matches nothing at all.

Three things this amplifier does that the others do not, each handled
where it shows: a KPA500 has no network side, the amplifier answers while
its main supplies are off, and going to OPERATE clears the current fault.

Nothing here has met real hardware yet.
This commit is contained in:
2026-08-26 18:09:39 +02:00
11 changed files with 972 additions and 30 deletions
+50 -3
View File
@@ -43,6 +43,7 @@ import (
"hamlog/internal/geo"
"hamlog/internal/gridcache"
"hamlog/internal/integrations/udp"
"hamlog/internal/kpa"
"hamlog/internal/lookup"
"hamlog/internal/lotwusers"
"hamlog/internal/netctl"
@@ -18075,6 +18076,7 @@ type ampInst struct {
pgxl *powergenius.Client
spe *spe.Client
acom *acom.Client
kpa *kpa.Client
catemu *catemu.Server // Kenwood-format responder for band-follow (ACOM)
}
@@ -18088,6 +18090,9 @@ func (i *ampInst) stopAll() {
if i.acom != nil {
i.acom.Stop()
}
if i.kpa != nil {
i.kpa.Stop()
}
if i.catemu != nil {
i.catemu.Stop()
}
@@ -18101,7 +18106,9 @@ func ampTypeLabel(t string) string {
case strings.HasPrefix(t, "spe"):
return "SPE " + map[string]string{"spe13": "1.3K-FA", "spe15": "1.5K-FA", "spe2k": "2K-FA"}[t]
case strings.HasPrefix(t, "acom"):
return "ACOM " + strings.TrimPrefix(t, "acom") + "S"
return "Acom " + strings.TrimPrefix(t, "acom") + "S"
case strings.HasPrefix(t, "kpa"):
return "Elecraft " + strings.ToUpper(t)
}
return t
}
@@ -18213,6 +18220,19 @@ func (a *App) startAmps() {
if a.acom == nil {
a.acom = inst.acom
}
case strings.HasPrefix(c.Type, "kpa"):
// A KPA500 has no network port at all, so a configuration asking for
// one is a mistake worth naming rather than a connection that never
// succeeds.
if strings.EqualFold(c.Type, "kpa500") && c.Transport == "tcp" {
applog.Printf("amp %s: a KPA500 has no network connection — use its serial port", c.Name)
continue
}
inst.kpa = kpa.New(kpa.Config{
Model: strings.ToUpper(c.Type), Transport: c.Transport,
ComPort: c.ComPort, Baud: c.Baud, Host: c.Host, Port: c.Port,
})
_ = inst.kpa.Start()
default: // spe*
inst.spe = spe.New(spe.Config{Transport: c.Transport, ComPort: c.ComPort, Baud: c.Baud, Host: c.Host, Port: c.Port})
_ = inst.spe.Start()
@@ -18258,6 +18278,22 @@ func (a *App) feedAmpBandFollow(s cat.RigState) {
inst.catemu.SetFrequency(s.FreqHz)
inst.catemu.SetMode(s.Mode)
}
// A KPA is TOLD its band, on the link it is already on.
//
// The emulator above exists because an Acom polls a transceiver and has
// no command to be given a band; the KPA has one (^BN), so it needs
// neither a second serial port nor a pretend rig. Sent from a goroutine
// because this runs on the CAT state-change path, and nothing about the
// rig should wait on an amplifier's link.
// Asked for, like every other write to somebody's station. The option is
// the same one an Acom uses — "keep the amplifier on the radio's band" is
// one idea to an operator, whatever it takes underneath — and it is off
// for the operator who has wired the amplifier straight to the rig and
// does not want a second voice telling it where to be.
if inst.kpa != nil && inst.cfg.FreqOut && s.Band != "" {
k, band := inst.kpa, s.Band
go func() { _ = k.SetBand(band) }()
}
}
}
@@ -18284,6 +18320,7 @@ type AmpStatus struct {
PGXL *powergenius.Status `json:"pgxl,omitempty"`
SPE *spe.Status `json:"spe,omitempty"`
ACOM *acom.Status `json:"acom,omitempty"`
KPA *kpa.Status `json:"kpa,omitempty"`
}
// GetAmpStatuses returns the live state of every ENABLED amplifier, in the
@@ -18310,6 +18347,9 @@ func (a *App) GetAmpStatuses() []AmpStatus {
case inst.acom != nil:
v := inst.acom.GetStatus()
st.ACOM = &v
case inst.kpa != nil:
v := inst.kpa.GetStatus()
st.KPA = &v
}
}
out = append(out, st)
@@ -18391,6 +18431,8 @@ func (a *App) ampOperateOne(id string, on bool) error {
return inst.spe.Operate(on)
case inst.acom != nil:
return inst.acom.Operate(on)
case inst.kpa != nil:
return inst.kpa.Operate(on)
}
return fmt.Errorf("amplifier not running")
}
@@ -18427,6 +18469,11 @@ func (a *App) ampPowerOne(id string, on, linked bool) error {
return inst.acom.PowerOn()
}
return inst.acom.PowerOff()
case inst.kpa != nil:
// OFF is a real power-down on a KPA1500: the main supplies drop and the
// way back on is the front panel or Wake-on-LAN. The button that reaches
// this asks first — see the UI — because "off" here is not standby.
return inst.kpa.PowerOn(on)
}
// Not an error worth surfacing when linked: a PGXL alongside two SPEs simply
// has no power command on its direct link, and reporting that as a failure
@@ -18522,7 +18569,7 @@ func (a *App) GetACOMStatus() acom.Status {
// protocol has explicit commands for each, unlike the SPE's toggle key.
func (a *App) ACOMSetOperate(on bool) error {
if a.acom == nil {
return fmt.Errorf("ACOM amplifier not connected — enable it in Settings → Amplifier")
return fmt.Errorf("Acom amplifier not connected — enable it in Settings → Amplifier")
}
return a.acom.Operate(on)
}
@@ -18531,7 +18578,7 @@ func (a *App) ACOMSetOperate(on bool) error {
// the power-on pins wired in the cable) or off (false, the OFF data command).
func (a *App) ACOMSetPower(on bool) error {
if a.acom == nil {
return fmt.Errorf("ACOM amplifier not connected — enable it in Settings → Amplifier")
return fmt.Errorf("Acom amplifier not connected — enable it in Settings → Amplifier")
}
if on {
return a.acom.PowerOn()
+1 -1
View File
@@ -1 +1 @@
f9b41e192918fa2511f68cd1b361fcd3
704fe1bf370b669665df0606fae8a69d
+50 -2
View File
@@ -47,7 +47,7 @@ function powerLevelLabel(pl?: string): string {
}
}
type Amp = { id: string; name: string; type?: string; spe?: any; acom?: any; pgxl?: any };
type Amp = { id: string; name: string; type?: string; spe?: any; acom?: any; kpa?: any; pgxl?: any };
export function AmpCard({ amp, flex, t }: { amp: Amp; flex: any; t: (k: string, v?: any) => string }) {
// Peak-hold so the jittery VITA-49 meters read steadily (own ref per card).
@@ -64,6 +64,7 @@ export function AmpCard({ amp, flex, t }: { amp: Amp; flex: any; t: (k: string,
const isSPE = !!amp.spe;
const isACOM = !!amp.acom;
const isKPA = !!amp.kpa;
if (isSPE) {
const spe = amp.spe;
@@ -127,7 +128,7 @@ export function AmpCard({ amp, flex, t }: { amp: Amp; flex: any; t: (k: string,
if (isACOM) {
const acom = amp.acom;
return (
<Card icon={Flame} ckey="amplifier" title={`${t('flxp.amplifier')} · ${amp.name || `ACOM${acom.model ? ' ' + acom.model : ''}`}`} accent="#ea580c">
<Card icon={Flame} ckey="amplifier" title={`${t('flxp.amplifier')} · ${amp.name || `Acom${acom.model ? ' ' + acom.model : ''}`}`} accent="#ea580c">
<div className="flex items-center gap-3 flex-wrap">
<button type="button" disabled={!acom.connected}
onClick={() => AmpOperate(amp.id, !acom.operate).catch(() => {})}
@@ -168,6 +169,53 @@ export function AmpCard({ amp, flex, t }: { amp: Amp; flex: any; t: (k: string,
);
}
if (isKPA) {
const kpa = amp.kpa;
return (
<Card icon={Flame} ckey="amplifier" title={`${t('flxp.amplifier')} · ${amp.name || kpa.model || 'Elecraft'}`} accent="#ea580c">
<div className="flex items-center gap-3 flex-wrap">
<button type="button" disabled={!kpa.connected}
onClick={() => AmpOperate(amp.id, !kpa.operate).catch(() => {})}
title={kpa.fault_text ? t('flxp.kpaClearsFault') : undefined}
className={cn('px-4 py-2 rounded-lg text-sm font-extrabold tracking-wide border-2 transition-all disabled:opacity-30',
kpa.operate ? 'bg-warning text-warning-foreground border-warning shadow-[0_0_14px] shadow-warning/50' : 'bg-card text-warning border-warning hover:bg-warning-muted')}>
{kpa.operate ? 'OPERATE' : 'STANDBY'}
</button>
{/* The amplifier answers while its main supplies are off — a sleeping
microcontroller stays awake for exactly that — so ON is offered
over the network as well, unlike the SPE and Acom. */}
<div className="inline-flex rounded-lg overflow-hidden border-2 border-success/70">
<button type="button" disabled={!kpa.connected}
onClick={() => AmpPower(amp.id, true).catch(() => {})}
className="px-3 py-2 text-sm font-bold bg-card text-success hover:bg-success/15 disabled:opacity-30">ON</button>
<button type="button" disabled={!kpa.connected}
onClick={() => AmpPower(amp.id, false).catch(() => {})}
className="px-3 py-2 text-sm font-bold bg-card text-danger border-l-2 border-success/70 hover:bg-danger/15 disabled:opacity-30">OFF</button>
</div>
<span className={cn('inline-flex items-center gap-1.5 text-sm', kpa.connected ? 'text-muted-foreground' : 'text-danger')}>
<span className={cn('size-2 rounded-full', kpa.connected ? 'bg-success' : 'bg-danger')} />
{kpa.connected ? (kpa.tuning ? t('flxp.kpaTuning') : (kpa.power_on ? 'ON' : 'OFF')) : t('flxp.acomOffline')}
</span>
{kpa.connected && (
<span className="text-sm font-mono text-muted-foreground tabular-nums">
{kpa.band ? `${kpa.band} · ` : ''}{kpa.fwd_w}W · SWR {Number(kpa.swr ?? 0).toFixed(1)} · {kpa.temp_c}°C · {kpa.volt_v}V {kpa.cur_a}A
</span>
)}
<div className="flex-1" />
{kpa.fault_text && (
<span className="px-2 py-1 rounded bg-danger-muted text-danger-muted-foreground text-xs font-bold"> {kpa.fault_text}</span>
)}
</div>
{kpa.connected && (
<MeterBar label={t('flxp.outputPower')} value={Number(kpa.fwd_w) || 0} unit="W"
lo={0} hi={String(kpa.model).includes('500') ? 500 : 1500}
display={`${Number(kpa.fwd_w) || 0} W`}
segColor={(f) => (f > 0.9 ? '#dc2626' : f > 0.75 ? '#f59e0b' : '#ea580c')} />
)}
</Card>
);
}
// PowerGenius XL — OPERATE + meters ride on the Flex; fan mode on the GSCP link.
const pg = amp.pgxl || {};
const viaFlex = !!flex?.amp_available;
+27 -9
View File
@@ -15,7 +15,7 @@ import { AmpOperate, AmpPower, AmpPowerLevel, AmpFanMode, FlexAmpOperate } from
// With several amplifiers configured the caller passes a selection ("all" or an
// amp id) chosen from the toolbar icon's dropdown.
type Amp = { id: string; name: string; type?: string; spe?: any; acom?: any; pgxl?: any };
type Amp = { id: string; name: string; type?: string; spe?: any; acom?: any; kpa?: any; pgxl?: any };
// Full-scale watts for the output bar, from the model string.
function maxW(model?: string, fallback = 1300): number {
@@ -92,27 +92,39 @@ function OperateButton({ operate, disabled, onClick, t }: {
function AmpBlock({ amp, flex, showName, t }: {
amp: Amp; flex: any; showName: boolean; t: (k: string, v?: any) => string;
}) {
const spe = amp.spe, acom = amp.acom;
const spe = amp.spe, acom = amp.acom, kpaAmp = amp.kpa;
const hold = usePeakHold();
if (spe || acom) {
const s = spe || acom;
// One block for the three amplifiers OpsLog drives over its own link. They
// report the same handful of things under different names, so the differences
// are named here rather than spread through the markup.
if (spe || acom || kpaAmp) {
const s = spe || acom || kpaAmp;
// The amp reports zero watts on receive, so its TX flag clears the meter as
// soon as the operator lets go — and the radio's own flag, when we have one,
// gets there first (the amp is polled on its own slower cycle).
const txing = typeof flex?.transmitting === 'boolean' ? flex.transmitting : s.tx !== false;
const w = hold('w', Number(spe ? s.output_w : s.fwd_w) || 0, txing);
const swr = Number(spe ? s.swr_ant : s.swr) || 0;
const hi = spe ? maxW(s.model) : (Number(s.max_w) || 800);
// The full-scale mark. A KPA500 reading against a 1500 W scale would look
// idle at full output, so the model decides it.
const hi = spe ? maxW(s.model)
: kpaAmp ? (String(s.model).includes('500') ? 500 : 1500)
: (Number(s.max_w) || 800);
// Power ON drives the remote-on control lines, so it stays available while
// the amplifier is off and reporting nothing — but only over a serial link.
const canPowerOn = spe ? (s.connected || s.transport === 'serial') : (s.port_open && s.transport === 'serial');
// A KPA answers ^ON while its main supplies are off — the sleeping
// microcontroller stays awake for exactly that — so power-on is available
// whenever the link itself is up, over serial and over the network alike.
const canPowerOn = spe ? (s.connected || s.transport === 'serial')
: kpaAmp ? !!s.connected
: (s.port_open && s.transport === 'serial');
return (
<div className="h-full flex flex-col gap-1.5">
{showName && (
<div className="flex items-center gap-1.5">
<span className={cn('size-1.5 rounded-full shrink-0', s.connected ? 'bg-success shadow-[0_0_6px_rgba(16,185,129,0.8)]' : 'bg-danger')} />
<span className="text-[10px] font-bold uppercase tracking-wider truncate">{amp.name || (spe ? 'SPE' : 'ACOM')}</span>
<span className="text-[10px] font-bold uppercase tracking-wider truncate">{amp.name || (spe ? 'SPE' : kpaAmp ? (s.model || 'KPA') : 'Acom')}</span>
{s.connected && s.band && <span className="ml-auto text-[9px] text-muted-foreground shrink-0">{s.band}</span>}
</div>
)}
@@ -155,11 +167,17 @@ function AmpBlock({ amp, flex, showName, t }: {
) : (
<div className="text-[10px] text-center text-muted-foreground italic py-1">{t('ampw.offline')}</div>
)}
{(s.warnings || s.alarms || s.err_text) && (
{(s.warnings || s.alarms || s.err_text || s.fault_text) && (
<div className="rounded-md border border-danger-border bg-danger-muted text-danger-muted-foreground text-[9px] px-1.5 py-0.5 text-center break-words">
{s.err_text || `${s.warnings || ''} ${s.alarms || ''}`.trim()}
{s.fault_text || s.err_text || `${s.warnings || ''} ${s.alarms || ''}`.trim()}
</div>
)}
{/* Said where the fault is read, because it is the way out of it: on a
KPA, going to OPERATE clears the current fault — everything except
temperature, which clears by cooling. */}
{kpaAmp && s.fault_text && (
<div className="text-[9px] text-center text-muted-foreground">{t('ampw.kpaClear')}</div>
)}
<PowerMeter label={t('flxp.outputPower')} watts={s.connected ? w : 0} maxWatts={hi} />
</div>
);
+58 -9
View File
@@ -905,9 +905,10 @@ function AmpStatusCard({ id }: { id: string }) {
const t = window.setInterval(tick, 1000);
return () => { alive = false; window.clearInterval(t); };
}, [id]);
const st: any = amp?.spe ?? amp?.acom ?? amp?.pgxl ?? { connected: false };
const st: any = amp?.spe ?? amp?.acom ?? amp?.kpa ?? amp?.pgxl ?? { connected: false };
const isSPE = !!amp?.spe;
const isACOM = !!amp?.acom;
const isKPA = !!amp?.kpa;
const operate = !!st.operate;
return (
<div className="rounded-md border border-border p-3 space-y-2 text-xs max-w-xl">
@@ -948,7 +949,23 @@ function AmpStatusCard({ id }: { id: string }) {
{st.err_text && <div className="col-span-4 text-warning"> {st.err_text} ({st.err_code})</div>}
</div>
)}
{st.connected && !isSPE && !isACOM && (
{st.connected && isKPA && (
<div className="grid grid-cols-4 gap-x-3 gap-y-1 font-mono text-[11px]">
<div>{st.power_on ? 'ON' : 'OFF'}</div>
<div>Band {st.band || '—'}</div>
<div>{st.fwd_w} W</div>
<div>SWR {Number(st.swr ?? 0).toFixed(1)}</div>
<div>{st.volt_v} V</div>
<div>{st.cur_a} A</div>
<div>{st.temp_c}°C</div>
<div>{st.tuning ? 'TUNING' : ''}</div>
{/* A fault has already put the amplifier in standby by itself, so it
is the one thing worth the width and OPERATE is the way out of
it, which the button above already is. */}
{st.fault_text && <div className="col-span-4 text-warning"> {st.fault_text}</div>}
</div>
)}
{st.connected && !isSPE && !isACOM && !isKPA && (
<div className="grid grid-cols-3 gap-x-3 gap-y-1 font-mono text-[11px]">
<div>{st.state || ''}</div>
<div>Fan {st.fan_mode || '—'}</div>
@@ -4142,15 +4159,28 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
{ value: 'acom1200', label: '1200S' },
{ value: 'acom2020', label: '2020S' },
],
kpa: [
{ value: 'kpa1500', label: 'KPA1500' },
{ value: 'kpa500', label: 'KPA500' },
],
};
const brandOf = (ty: string) => (!ty || ty === 'pgxl') ? 'pgxl' : ty.startsWith('acom') ? 'acom' : 'spe';
const brandOf = (ty: string) => (!ty || ty === 'pgxl') ? 'pgxl'
: ty.startsWith('acom') ? 'acom'
: ty.startsWith('kpa') ? 'kpa' : 'spe';
const patchAmp = (i: number, patch: Partial<AmpUI>) => setAmps((l) => l.map((a, j) => (j === i ? { ...a, ...patch } : a)));
// Each family has a fixed serial speed: SPE talks 115200, the ACOM S-series is
// 9600 8N1 — preset it so switching brand just works. PGXL is TCP-only.
// Each family has its own fixed serial speed and its own default port, so
// switching model leaves a working configuration rather than one the
// operator has to repair. A KPA500 has no network side at all — it is put
// on serial here rather than being allowed to sit on a TCP setting that
// could never connect.
const applyType = (i: number, v: string) => patchAmp(i, {
type: v,
transport: v === 'pgxl' ? 'tcp' : amps[i].transport,
baud: v.startsWith('acom') ? 9600 : v.startsWith('spe') ? 115200 : amps[i].baud,
freq_out: v.startsWith('kpa') ? true : amps[i].freq_out,
transport: v === 'pgxl' ? 'tcp' : v === 'kpa500' ? 'serial' : amps[i].transport,
baud: v.startsWith('acom') ? 9600 : v.startsWith('spe') ? 115200 : v.startsWith('kpa') ? 38400 : amps[i].baud,
port: v === 'kpa1500' ? 1500 : amps[i].port,
});
const addAmp = () => setAmps((l) => [...l, {
id: '', name: '', enabled: true, type: 'spe13', transport: 'tcp', host: '', port: 9008, com_port: '', baud: 115200,
@@ -4167,6 +4197,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
const brand = brandOf(amp.type);
const isPGXL = brand === 'pgxl';
const isACOM = brand === 'acom';
const isKPA = brand === 'kpa';
const isSerial = !isPGXL && amp.transport === 'serial';
return (
<div key={amp.id || `new-${i}`} className="rounded-lg border border-border p-3 space-y-3">
@@ -4194,7 +4225,8 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
<SelectContent>
<SelectItem value="pgxl">4O3A</SelectItem>
<SelectItem value="spe">SPE</SelectItem>
<SelectItem value="acom">ACOM</SelectItem>
<SelectItem value="acom">Acom</SelectItem>
<SelectItem value="kpa">Elecraft</SelectItem>
</SelectContent>
</Select>
</div>
@@ -4284,10 +4316,27 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
)}
{/* Band-follow, for any amp that takes its band from a transceiver
CAT link (ACOM and SPE both do) never PowerGenius, which is
CAT link (Acom and SPE both do) never PowerGenius, which is
driven over its network protocol. A SECOND serial port,
separate from the metering one above. */}
{!isPGXL && (
separate from the metering one above.
Never a KPA either: it has a band command of its own (^BN),
so OpsLog tells it directly on the link it is already using.
Offering a second serial port and a transceiver emulator for
that would be a workaround for a problem this amplifier does
not have. */}
{isKPA && (
<div className="border-t border-border/60 pt-3 space-y-1">
<label className="flex items-center gap-2 text-sm cursor-pointer">
<Checkbox
checked={!!amp.freq_out}
onCheckedChange={(c) => patchAmp(i, { freq_out: !!c })}
/>
{t('amp.kpaBandFollow')}
</label>
<p className="text-[11px] text-muted-foreground">{t('amp.kpaBandFollowHint')}</p>
</div>
)}
{!isPGXL && !isKPA && (
<div className="border-t border-border/60 pt-3 space-y-3">
<label className="flex items-center gap-2 text-sm cursor-pointer">
<Checkbox
+6 -6
View File
@@ -230,7 +230,7 @@ const en: Dict = {
'gen.showBeam': 'Show the antenna beam heading on the Main map',
'gen.startEqEnd': 'QSO start time = end time', 'gen.startEqEndHint': '(matches LoTW when you call a while)',
'gen.showQsoRate': 'Show QSO rate in the header', 'gen.showQsoRateHint': '(QSOs/hour, projected from the last 10 / 60 min)',
'gen.lookupOnBlur': 'Look up the callsign only after leaving the field', 'gen.lookupOnBlurHint': '(not while typing)', 'amp.hint': 'Configure one or several amplifiers — each panel card has a dropdown to pick which one it shows.', 'amp.linked': 'Amplifiers commanded together', 'amp.linkedHint': 'Tick the ones sharing a combiner: ON, OFF and OPERATE will act on all of them at once, since one left in STANDBY would feed power to a single input. Any amplifier left unticked keeps its own buttons. Each keeps its own meters.', 'amp.linkedSaveFirst': 'Save first — an amplifier needs an id before it can join a group.', 'amp.none': 'No amplifier configured yet.', 'amp.namePh': 'Name (e.g. SPE left)', 'amp.remove': 'Remove this amplifier', 'amp.add': 'Add amplifier', 'amp.password': 'Remote code', 'amp.passwordPh': 'blank on LAN', 'amp.passwordHint': 'PowerGenius XL only: needed when reaching the amp remotely — it then announces "AUTH" and rejects every command ("Unauthorized") until you log in. Leave blank on the local network.', 'amp.freqOut': 'Send the frequency to the amplifier (band follow)', 'amp.freqPort': 'CAT/AUX COM port', 'amp.freqBroadcast': 'Also send unprompted', 'amp.freqPollOnly': 'No — answer the amplifier only', 'amp.freqEvery': 'Yes, every {ms} ms', 'amp.freqHint': 'OpsLog pretends to be a transceiver on this second port, in Kenwood format: set the amplifier to that command set (set 5 on an ACOM) at the same baud rate, and put it in OPERATE — in standby it acknowledges but does not switch band. An amplifier that POLLS (ACOM) needs nothing more; one that only LISTENS to the CAT line of the radio hears nothing unless you also turn on the unprompted send.',
'gen.lookupOnBlur': 'Look up the callsign only after leaving the field', 'gen.lookupOnBlurHint': '(not while typing)', 'amp.hint': 'Configure one or several amplifiers — each panel card has a dropdown to pick which one it shows.', 'amp.linked': 'Amplifiers commanded together', 'amp.linkedHint': 'Tick the ones sharing a combiner: ON, OFF and OPERATE will act on all of them at once, since one left in STANDBY would feed power to a single input. Any amplifier left unticked keeps its own buttons. Each keeps its own meters.', 'amp.linkedSaveFirst': 'Save first — an amplifier needs an id before it can join a group.', 'amp.none': 'No amplifier configured yet.', 'amp.namePh': 'Name (e.g. SPE left)', 'amp.remove': 'Remove this amplifier', 'amp.add': 'Add amplifier', 'amp.password': 'Remote code', 'amp.passwordPh': 'blank on LAN', 'amp.passwordHint': 'PowerGenius XL only: needed when reaching the amp remotely — it then announces "AUTH" and rejects every command ("Unauthorized") until you log in. Leave blank on the local network.', 'amp.kpaBandFollow': 'Keep the amplifier on the radios band', 'amp.kpaBandFollowHint': 'Sends the band number when it changes, on the link already open — no second serial port. Turn it off if the amplifier is wired straight to the radio and takes its band from there.', 'amp.freqOut': 'Send the frequency to the amplifier (band follow)', 'amp.freqPort': 'CAT/AUX COM port', 'amp.freqBroadcast': 'Also send unprompted', 'amp.freqPollOnly': 'No — answer the amplifier only', 'amp.freqEvery': 'Yes, every {ms} ms', 'amp.freqHint': 'OpsLog pretends to be a transceiver on this second port, in Kenwood format: set the amplifier to that command set (set 5 on an Acom) at the same baud rate, and put it in OPERATE — in standby it acknowledges but does not switch band. An amplifier that POLLS (Acom) needs nothing more; one that only LISTENS to the CAT line of the radio hears nothing unless you also turn on the unprompted send.',
'gen.groupDigital': 'Group digital modes as one (DXCC-style)', 'gen.groupDigitalHint': '(matrix badges + cluster: FT8/FT4/RTTY… count as a single Digital mode; off = each digital mode is its own slot)',
// Password encryption
'gen.pwEnc': 'Password encryption',
@@ -419,7 +419,7 @@ const en: Dict = {
'agp.portDeselect': 'Port {letter} — click to deselect', 'agp.portSelect': 'Select on port {letter}', 'agp.online': 'online', 'agp.offline': 'offline', 'agp.close': 'Close', 'agp.connecting': 'Connecting…', 'agp.noAntennas': 'No antennas configured.', 'agp.filterOnHint': 'Showing antennas for {band} only — click to show all bands', 'agp.filterOffHint': 'Showing all antennas — click to show only the current band',
'ampw.title': 'Amplifier', 'ampw.all': 'All amplifiers', 'ampw.pick': 'Which amplifier the widget shows',
'ampw.showHint': 'Amplifier · click to show', 'ampw.hideHint': 'Amplifier — shown · click to hide',
'ampw.close': 'Close', 'ampw.offline': 'offline', 'ampw.none': 'No amplifier configured',
'ampw.close': 'Close', 'ampw.offline': 'offline', 'ampw.kpaClear': 'OPERATE clears this fault', 'ampw.none': 'No amplifier configured',
'ampw.operate': 'Operate', 'ampw.standby': 'Standby', 'ampw.on': 'ON', 'ampw.off': 'OFF',
'ampw.lvlL': 'Low', 'ampw.lvlM': 'Mid', 'ampw.lvlH': 'High',
'ampw.pwr': 'Watts', 'ampw.swr': 'SWR', 'ampw.temp': 'Temp', 'ampw.id': 'Id (A)', 'ampw.fan': 'Fan mode',
@@ -427,7 +427,7 @@ const en: Dict = {
'tgp.title': 'Tuner Genius', 'tgp.chActive': 'Channel {letter} — active', 'tgp.chSelect': 'Make channel {letter} active', 'tgp.chActiveTag': 'active', 'tgp.ant': 'Ant', 'tgp.bypassed': 'Bypassed', 'tgp.inLine': 'In line',
'flxp.ritHint': 'RIT — shifts your RECEIVE frequency only. Wheel, ± or arrow keys to adjust (Ctrl = 100 Hz). The offset is kept when you switch it off.', 'flxp.xitHint': 'XIT — shifts your TRANSMIT frequency only. Wheel, ± or arrow keys to adjust (Ctrl = 100 Hz). The offset is kept when you switch it off.',
'flxp.smartsdrRemote': 'SmartSDR remote control', 'flxp.offline': 'OFFLINE', 'flxp.waiting': 'Waiting for the FlexRadio… (set CAT to FlexRadio and connect)', 'flxp.transmit': 'Transmit', 'flxp.rfPower': 'RF Power', 'flxp.tunePwr': 'Tune Pwr', 'flxp.rstChaseHint': 'Chase the pile-up: when the CW skimmer marks a report ({m}) on the panadapter, move the TRANSMIT slice there — that is where the DX was listening a second ago. The receive slice never moves. Right-click to change the marker text.', 'flxp.rstChaseMarkerHint': 'The text the skimmer writes for a report — whatever SDC is set to send (599, 5NN…). Several can be given, separated by commas; add the old-report marker to chase those too.', 'flxp.rstChaseOffset': 'off', 'k3.console': 'Elecraft Console', 'k3.waiting': 'Waiting for the radio… (set CAT to Elecraft or Kenwood and connect)', 'k3.rfGain': 'RF gain', 'k3.micGain': 'Mic', 'k3.squelch': 'Squelch', 'k3.filter': 'Filter', 'k3.antenna': 'Antenna', 'k3.clear': 'CLEAR', 'k3.keySpeed': 'Keyer', 'k3.meters': 'Meters', 'k3.levels': 'Levels', 'k3.receive': 'Receive', 'k3.power': 'Power', 'k3.volume': 'Volume', 'k3.refreshHint': 'Re-read the settings from the radio — for when a knob was turned on the front panel.', 'k3.sMeterHint': 'Click to use this reading as the report sent. Raw value from the rig: {raw}.', 'k3.atuHint': 'Put the ATU in line or bypass it (a hold of the K3 ATU switch).', 'k3.tuneHint': 'Start an ATU tuning cycle (K3: a tap of the ATU TUNE button). The exact command sent is written to the log.', 'k3.provisional': 'Meter scaling is provisional: it has not yet been confirmed against a real K3, and the raw readings are written to the log so it can be.', 'flxp.splitHint': 'Split: RX/TX on separate slices. ON creates a TX slice +1 kHz (CW) / +5 kHz (SSB) up, like SmartSDR.', 'flxp.sliceHint': 'Click to make this the active slice — frequency, mode, DSP and spot-clicks all follow it.', 'flxp.txSlice': 'This slice transmits', 'flxp.setTxSlice': 'Move TX to this slice (transmit here)', 'flxp.voxDly': 'VOX Dly', 'flxp.speed': 'Speed', 'flxp.pitch': 'Pitch', 'flxp.delay': 'Delay',
'flxp.receiveActive': 'Receive (active slice)', 'flxp.muted': 'Muted — click to unmute', 'flxp.mute': 'Mute RX audio', 'flxp.filter': 'Filter', 'flxp.amplifier': 'Amplifier', 'flxp.atuTune': 'TUNE', 'flxp.atuTuneHint': 'Start a tuning cycle on the built-in ATU. The radio keys a carrier itself to measure the match.', 'flxp.atuBypass': 'BYPASS', 'flxp.atuBypassHint': 'Take the ATU out of line (straight through).', 'flxp.atuMem': 'MEM', 'flxp.atuMemHint': 'Reuse the stored tuning solution for this frequency instead of tuning again.', 'flxp.atuIdle': 'not tuned', 'flxp.atuTuning': 'tuning…', 'flxp.atuOk': 'tuned', 'flxp.atuFail': 'TUNE FAILED', 'flxp.atuBypassed': 'bypassed', 'flxp.atuAborted': 'aborted', 'flxp.ampInLine': 'Amplifier is in line (transmitting through PA).', 'flxp.ampBypassed': 'Amplifier bypassed (standby).', 'flxp.pgConnected': 'PowerGenius connected', 'flxp.pgOffline': 'PowerGenius offline', 'flxp.fan': 'Fan', 'flxp.fanStandard': 'Standard', 'flxp.fanContest': 'Contest', 'flxp.fanBroadcast': 'Broadcast', 'flxp.fault': 'FAULT', 'flxp.meters': 'Meters', 'flxp.voltage': 'VOLTAGE', 'flxp.paTemp': 'PA TEMP', 'flxp.txFilter': 'TX filter', 'flxp.micProfile': 'Mic profile', 'flxp.noMeters': "No meters yet — waiting for the radio's UDP stream…", 'flxp.amplifierHdr': 'AMPLIFIER', 'flxp.outputPower': 'OUTPUT POWER', 'flxp.speOffline': 'SPE offline', 'flxp.acomOffline': 'ACOM offline', 'flxp.ampPick': 'Choose which amplifier this card shows', 'flxp.dspV4Hint': 'SmartSDR v4 DSP (8000/Aurora series)', 'flxp.daxHint': 'DAX as the transmit audio source (SmartSDR transmit-bar DAX button) — for WSJT-X & co', 'flxp.rnnHint': 'RNN — AI noise reduction (on/off)', 'flxp.anftHint': 'ANFT — FFT-based automatic notch filter (on/off)', 'flxp.dspNoise': 'Noise', 'flxp.dspMore': 'Show/hide advanced DSP (WNB, v4 NR/notch)',
'flxp.receiveActive': 'Receive (active slice)', 'flxp.muted': 'Muted — click to unmute', 'flxp.mute': 'Mute RX audio', 'flxp.filter': 'Filter', 'flxp.amplifier': 'Amplifier', 'flxp.atuTune': 'TUNE', 'flxp.atuTuneHint': 'Start a tuning cycle on the built-in ATU. The radio keys a carrier itself to measure the match.', 'flxp.atuBypass': 'BYPASS', 'flxp.atuBypassHint': 'Take the ATU out of line (straight through).', 'flxp.atuMem': 'MEM', 'flxp.atuMemHint': 'Reuse the stored tuning solution for this frequency instead of tuning again.', 'flxp.atuIdle': 'not tuned', 'flxp.atuTuning': 'tuning…', 'flxp.atuOk': 'tuned', 'flxp.atuFail': 'TUNE FAILED', 'flxp.atuBypassed': 'bypassed', 'flxp.atuAborted': 'aborted', 'flxp.ampInLine': 'Amplifier is in line (transmitting through PA).', 'flxp.ampBypassed': 'Amplifier bypassed (standby).', 'flxp.pgConnected': 'PowerGenius connected', 'flxp.pgOffline': 'PowerGenius offline', 'flxp.fan': 'Fan', 'flxp.fanStandard': 'Standard', 'flxp.fanContest': 'Contest', 'flxp.fanBroadcast': 'Broadcast', 'flxp.fault': 'FAULT', 'flxp.meters': 'Meters', 'flxp.voltage': 'VOLTAGE', 'flxp.paTemp': 'PA TEMP', 'flxp.txFilter': 'TX filter', 'flxp.micProfile': 'Mic profile', 'flxp.noMeters': "No meters yet — waiting for the radio's UDP stream…", 'flxp.amplifierHdr': 'AMPLIFIER', 'flxp.outputPower': 'OUTPUT POWER', 'flxp.speOffline': 'SPE offline', 'flxp.acomOffline': 'Acom offline', 'flxp.kpaTuning': 'TUNING', 'flxp.kpaClearsFault': 'OPERATE also clears the current fault (except temperature, which clears as it cools)', 'flxp.ampPick': 'Choose which amplifier this card shows', 'flxp.dspV4Hint': 'SmartSDR v4 DSP (8000/Aurora series)', 'flxp.daxHint': 'DAX as the transmit audio source (SmartSDR transmit-bar DAX button) — for WSJT-X & co', 'flxp.rnnHint': 'RNN — AI noise reduction (on/off)', 'flxp.anftHint': 'ANFT — FFT-based automatic notch filter (on/off)', 'flxp.dspNoise': 'Noise', 'flxp.dspMore': 'Show/hide advanced DSP (WNB, v4 NR/notch)',
'icmp.spectrum': 'Spectrum', 'icmp.scopeFixed': 'Fixed — double-click / wheel to tune', 'icmp.scopeCenter': 'Center — follows VFO', 'icmp.scopeOff': 'Scope off', 'icmp.scopePanDown': 'Shift scope 50 kHz', 'icmp.scopePanUp': 'Shift scope +50 kHz', 'icmp.scopeCenterVfo': 'Center scope on the current frequency (±50 kHz)', 'icmp.notConnected': "Icom not connected. Enable the Icom CI-V backend in Settings → CAT and connect the radio's USB port.", 'icmp.refresh': 'Refresh', 'icmp.meters': 'Meters', 'icmp.transmit': 'Transmit', 'icmp.power': 'Power', 'icmp.mic': 'Mic', 'icmp.receive': 'Receive', 'icmp.preamp': 'Preamp', 'icmp.filter': 'Filter', 'icmp.noiseNotch': 'Noise / Notch', 'icmp.autoNotch': 'Auto notch filter', 'icmp.apf': 'Audio peak filter (CW)', 'icmp.clarifiers': 'RIT / ΔTX', 'icmp.ritHint': 'Wheel or ± to shift · Ctrl+←/→ shifts RIT when active', 'icmp.bandsAntenna': 'Bands & Antenna', 'icmp.bandCurrent': 'The rig is on {b} m', 'icmp.antenna': 'Antenna', 'icmp.passband': 'Passband / Notch', 'icmp.pbtCenter': 'Center PBT', 'icmp.manualNotch': 'Manual notch — MN on, then set position', 'icmp.squelch': 'Squelch', 'icmp.powerOnHint': 'Power the radio ON (boots ~15 s)', 'icmp.powerOffHint': 'Power the radio OFF', 'icmp.powerOffConfirm': 'Switch the radio OFF?',
'rst.clickToFill': 'Click to set RST tx from the signal',
'qrz.openTitle': 'Open {call} on QRZ.com',
@@ -716,7 +716,7 @@ const fr: Dict = {
'gen.showBeam': 'Afficher le cap de l\'antenne sur la carte principale',
'gen.startEqEnd': 'Heure de début du QSO = heure de fin', 'gen.startEqEndHint': '(correspond à LoTW quand tu appelles un moment)',
'gen.showQsoRate': 'Afficher le rythme QSO dans la barre du haut', 'gen.showQsoRateHint': '(QSO/heure, projeté sur les 10 / 60 dernières min)',
'gen.lookupOnBlur': 'Rechercher l\'indicatif seulement après avoir quitté le champ', 'gen.lookupOnBlurHint': '(pas pendant la saisie)', 'amp.hint': 'Configurez un ou plusieurs amplificateurs — chaque carte de panneau a une liste déroulante pour choisir lequel afficher.', 'amp.linked': 'Amplificateurs commandés ensemble', 'amp.linkedHint': "Coche ceux qui partagent un combiner : ON, OFF et OPERATE agiront sur tous à la fois, puisqu'un ampli resté en STANDBY n'alimenterait qu'une seule entrée. Un amplificateur non coché garde ses propres boutons. Chacun garde ses mesures.", 'amp.linkedSaveFirst': "Enregistre d'abord — un amplificateur a besoin d'un identifiant pour rejoindre un groupe.", 'amp.none': 'Aucun amplificateur configuré.', 'amp.namePh': 'Nom (p. ex. SPE gauche)', 'amp.remove': 'Supprimer cet amplificateur', 'amp.add': 'Ajouter un amplificateur', 'amp.password': 'Code distant', 'amp.passwordPh': 'vide en LAN', 'amp.passwordHint': "PowerGenius XL uniquement : nécessaire pour joindre l'ampli à distance — il annonce alors « AUTH » et refuse toute commande (« Unauthorized ») tant qu'on n'est pas identifié. Laisse vide sur le réseau local.", 'amp.freqOut': "Envoyer la fréquence à l'amplificateur (suivi de bande)", 'amp.freqPort': 'Port COM CAT/AUX', 'amp.freqBroadcast': 'Envoyer aussi sans être interrogé', 'amp.freqPollOnly': "Non — répondre seulement à l'amplificateur", 'amp.freqEvery': 'Oui, toutes les {ms} ms', 'amp.freqHint': "OpsLog se fait passer pour un transceiver sur ce second port, au format Kenwood : réglez l'amplificateur sur ce jeu de commandes (le jeu 5 sur un ACOM) à la même vitesse, et mettez-le en OPERATE — en veille il acquitte mais ne change pas de bande. Un amplificateur qui INTERROGE (ACOM) n'a besoin de rien de plus ; un amplificateur qui se contente d'ÉCOUTER la liaison CAT de la radio n'entendra rien tant que l'envoi spontané n'est pas activé.",
'gen.lookupOnBlur': 'Rechercher l\'indicatif seulement après avoir quitté le champ', 'gen.lookupOnBlurHint': '(pas pendant la saisie)', 'amp.hint': 'Configurez un ou plusieurs amplificateurs — chaque carte de panneau a une liste déroulante pour choisir lequel afficher.', 'amp.linked': 'Amplificateurs commandés ensemble', 'amp.linkedHint': "Coche ceux qui partagent un combiner : ON, OFF et OPERATE agiront sur tous à la fois, puisqu'un ampli resté en STANDBY n'alimenterait qu'une seule entrée. Un amplificateur non coché garde ses propres boutons. Chacun garde ses mesures.", 'amp.linkedSaveFirst': "Enregistre d'abord — un amplificateur a besoin d'un identifiant pour rejoindre un groupe.", 'amp.none': 'Aucun amplificateur configuré.', 'amp.namePh': 'Nom (p. ex. SPE gauche)', 'amp.remove': 'Supprimer cet amplificateur', 'amp.add': 'Ajouter un amplificateur', 'amp.password': 'Code distant', 'amp.passwordPh': 'vide en LAN', 'amp.passwordHint': "PowerGenius XL uniquement : nécessaire pour joindre l'ampli à distance — il annonce alors « AUTH » et refuse toute commande (« Unauthorized ») tant qu'on n'est pas identifié. Laisse vide sur le réseau local.", 'amp.kpaBandFollow': "Garder l'amplificateur sur la bande de la radio", 'amp.kpaBandFollowHint': "Envoie le numéro de bande quand elle change, sur la liaison déjà ouverte — pas de second port série. À désactiver si l'amplificateur est câblé directement à la radio et prend sa bande de là.", 'amp.freqOut': "Envoyer la fréquence à l'amplificateur (suivi de bande)", 'amp.freqPort': 'Port COM CAT/AUX', 'amp.freqBroadcast': 'Envoyer aussi sans être interrogé', 'amp.freqPollOnly': "Non — répondre seulement à l'amplificateur", 'amp.freqEvery': 'Oui, toutes les {ms} ms', 'amp.freqHint': "OpsLog se fait passer pour un transceiver sur ce second port, au format Kenwood : réglez l'amplificateur sur ce jeu de commandes (le jeu 5 sur un Acom) à la même vitesse, et mettez-le en OPERATE — en veille il acquitte mais ne change pas de bande. Un amplificateur qui INTERROGE (Acom) n'a besoin de rien de plus ; un amplificateur qui se contente d'ÉCOUTER la liaison CAT de la radio n'entendra rien tant que l'envoi spontané n'est pas activé.",
'gen.groupDigital': 'Regrouper les modes digitaux en un seul (style DXCC)', 'gen.groupDigitalHint': '(badges de la matrice + cluster : FT8/FT4/RTTY… comptent comme un seul mode Digital ; décoché = chaque mode digital est un slot distinct)',
// Chiffrement des mots de passe
'gen.pwEnc': 'Chiffrement des mots de passe',
@@ -891,7 +891,7 @@ const fr: Dict = {
'agp.portDeselect': 'Port {letter} — clic pour désélectionner', 'agp.portSelect': 'Sélectionner sur le port {letter}', 'agp.online': 'en ligne', 'agp.offline': 'hors ligne', 'agp.close': 'Fermer', 'agp.connecting': 'Connexion…', 'agp.noAntennas': 'Aucune antenne configurée.', 'agp.filterOnHint': 'Antennes du {band} uniquement — clic pour afficher toutes les bandes', 'agp.filterOffHint': 'Toutes les antennes affichées — clic pour nafficher que la bande courante',
'ampw.title': 'Amplificateur', 'ampw.all': 'Tous les amplis', 'ampw.pick': 'Ampli affiché par le widget',
'ampw.showHint': 'Amplificateur · cliquer pour afficher', 'ampw.hideHint': 'Amplificateur — affiché · cliquer pour masquer',
'ampw.close': 'Fermer', 'ampw.offline': 'hors ligne', 'ampw.none': 'Aucun amplificateur configuré',
'ampw.close': 'Fermer', 'ampw.offline': 'hors ligne', 'ampw.kpaClear': 'OPERATE efface ce défaut', 'ampw.none': 'Aucun amplificateur configuré',
'ampw.operate': 'Operate', 'ampw.standby': 'Standby', 'ampw.on': 'ON', 'ampw.off': 'OFF',
'ampw.lvlL': 'Low', 'ampw.lvlM': 'Mid', 'ampw.lvlH': 'High',
'ampw.pwr': 'Watts', 'ampw.swr': 'ROS', 'ampw.temp': 'Temp', 'ampw.id': 'Id (A)', 'ampw.fan': 'Mode ventil.',
@@ -899,7 +899,7 @@ const fr: Dict = {
'tgp.title': 'Tuner Genius', 'tgp.chActive': 'Canal {letter} — actif', 'tgp.chSelect': 'Activer le canal {letter}', 'tgp.chActiveTag': 'actif', 'tgp.ant': 'Ant', 'tgp.bypassed': 'Bypass', 'tgp.inLine': 'En ligne',
'flxp.ritHint': "RIT — décale uniquement ta fréquence de RÉCEPTION. Molette, ± ou flèches pour ajuster (Ctrl = 100 Hz). Le décalage est conservé quand tu l'éteins.", 'flxp.xitHint': "XIT — décale uniquement ta fréquence d'ÉMISSION. Molette, ± ou flèches pour ajuster (Ctrl = 100 Hz). Le décalage est conservé quand tu l'éteins.",
'flxp.smartsdrRemote': 'Contrôle à distance SmartSDR', 'flxp.offline': 'HORS LIGNE', 'flxp.waiting': 'En attente du FlexRadio… (règle le CAT sur FlexRadio et connecte)', 'flxp.transmit': 'Émission', 'flxp.rfPower': 'Puissance RF', 'flxp.tunePwr': 'Puiss. TUNE', 'flxp.rstChaseHint': "Chasser le pile-up : quand le skimmer CW marque un report ({m}) sur le panadapter, déplacer la slice d'ÉMISSION dessus — c'est là que le DX écoutait il y a une seconde. La slice de réception ne bouge jamais. Clic droit pour changer le texte du marqueur.", 'flxp.rstChaseMarkerHint': "Le texte que le skimmer écrit pour un report — ce que SDC est réglé à envoyer (599, 5NN…). On peut en mettre plusieurs, séparés par des virgules ; ajoute le marqueur des reports anciens pour les chasser aussi.", 'flxp.rstChaseOffset': 'off', 'k3.console': 'Console Elecraft', 'k3.waiting': 'En attente de la radio… (règle le CAT sur Elecraft ou Kenwood et connecte)', 'k3.rfGain': 'Gain HF', 'k3.micGain': 'Micro', 'k3.squelch': 'Squelch', 'k3.filter': 'Filtre', 'k3.antenna': 'Antenne', 'k3.clear': 'EFFACER', 'k3.keySpeed': 'Manip', 'k3.meters': 'Mesures', 'k3.levels': 'Niveaux', 'k3.receive': 'Réception', 'k3.power': 'Puissance', 'k3.volume': 'Volume', 'k3.refreshHint': "Relire les réglages depuis la radio — quand un bouton a été tourné en façade.", 'k3.sMeterHint': 'Cliquer pour utiliser cette lecture comme report envoyé. Valeur brute de la radio : {raw}.', 'k3.atuHint': "Mettre la boîte d'accord en ligne ou la contourner (maintien de la touche ATU du K3).", 'k3.tuneHint': "Lancer un cycle d'accord de l'ATU (K3 : appui sur la touche ATU TUNE). La commande exacte envoyée est écrite dans le journal.", 'k3.provisional': "L'échelle des mesures est provisoire : elle n'a pas encore été confirmée sur un vrai K3, et les valeurs brutes sont écrites dans le journal pour qu'elle puisse l'être.", 'flxp.splitHint': 'Split : RX/TX sur des slices séparées. ON crée une slice TX +1 kHz (CW) / +5 kHz (SSB) au-dessus, comme SmartSDR.', 'flxp.sliceHint': 'Cliquer pour rendre cette slice active — fréquence, mode, DSP et clics de spot la suivent tous.', 'flxp.txSlice': 'Cette slice émet', 'flxp.setTxSlice': 'Déplacer le TX sur cette slice (émettre ici)', 'flxp.voxDly': 'Délai VOX', 'flxp.speed': 'Vitesse', 'flxp.pitch': 'Tonalité', 'flxp.delay': 'Délai',
'flxp.receiveActive': 'Réception (slice active)', 'flxp.muted': 'Coupé — clic pour rétablir', 'flxp.mute': "Couper l'audio RX", 'flxp.filter': 'Filtre', 'flxp.amplifier': 'Amplificateur', 'flxp.atuTune': 'ACCORD', 'flxp.atuTuneHint': "Lance un cycle d'accord sur le coupleur intégré. La radio émet elle-même une porteuse pour mesurer l'adaptation.", 'flxp.atuBypass': 'BYPASS', 'flxp.atuBypassHint': 'Sort le coupleur de la ligne (passage direct).', 'flxp.atuMem': 'MEM', 'flxp.atuMemHint': "Réutilise l'accord mémorisé pour cette fréquence au lieu de refaire un cycle.", 'flxp.atuIdle': 'non accordé', 'flxp.atuTuning': 'accord en cours…', 'flxp.atuOk': 'accordé', 'flxp.atuFail': 'ÉCHEC ACCORD', 'flxp.atuBypassed': 'contourné', 'flxp.atuAborted': 'interrompu', 'flxp.ampInLine': 'Amplificateur en ligne (émission via le PA).', 'flxp.ampBypassed': 'Amplificateur en bypass (standby).', 'flxp.pgConnected': 'PowerGenius connecté', 'flxp.pgOffline': 'PowerGenius hors ligne', 'flxp.fan': 'Ventilo', 'flxp.fanStandard': 'Standard', 'flxp.fanContest': 'Contest', 'flxp.fanBroadcast': 'Diffusion', 'flxp.fault': 'DÉFAUT', 'flxp.meters': 'Mesures', 'flxp.voltage': 'TENSION', 'flxp.paTemp': 'TEMP PA', 'flxp.txFilter': 'Filtre TX', 'flxp.micProfile': 'Profil micro', 'flxp.noMeters': 'Aucune mesure — en attente du flux UDP de la radio…', 'flxp.amplifierHdr': 'AMPLIFICATEUR', 'flxp.outputPower': 'PUISSANCE DE SORTIE', 'flxp.speOffline': 'SPE hors ligne', 'flxp.acomOffline': 'ACOM hors ligne', 'flxp.ampPick': 'Choisir quel amplificateur cette carte affiche', 'flxp.dspV4Hint': 'DSP SmartSDR v4 (séries 8000/Aurora)', 'flxp.daxHint': "DAX comme source audio d'émission (bouton DAX du bandeau transmit de SmartSDR) — pour WSJT-X & co", 'flxp.rnnHint': 'RNN — réduction de bruit par IA (on/off)', 'flxp.anftHint': 'ANFT — filtre notch automatique FFT (on/off)', 'flxp.dspNoise': 'Bruit', 'flxp.dspMore': 'Afficher/masquer le DSP avancé (WNB, NR/notch v4)',
'flxp.receiveActive': 'Réception (slice active)', 'flxp.muted': 'Coupé — clic pour rétablir', 'flxp.mute': "Couper l'audio RX", 'flxp.filter': 'Filtre', 'flxp.amplifier': 'Amplificateur', 'flxp.atuTune': 'ACCORD', 'flxp.atuTuneHint': "Lance un cycle d'accord sur le coupleur intégré. La radio émet elle-même une porteuse pour mesurer l'adaptation.", 'flxp.atuBypass': 'BYPASS', 'flxp.atuBypassHint': 'Sort le coupleur de la ligne (passage direct).', 'flxp.atuMem': 'MEM', 'flxp.atuMemHint': "Réutilise l'accord mémorisé pour cette fréquence au lieu de refaire un cycle.", 'flxp.atuIdle': 'non accordé', 'flxp.atuTuning': 'accord en cours…', 'flxp.atuOk': 'accordé', 'flxp.atuFail': 'ÉCHEC ACCORD', 'flxp.atuBypassed': 'contourné', 'flxp.atuAborted': 'interrompu', 'flxp.ampInLine': 'Amplificateur en ligne (émission via le PA).', 'flxp.ampBypassed': 'Amplificateur en bypass (standby).', 'flxp.pgConnected': 'PowerGenius connecté', 'flxp.pgOffline': 'PowerGenius hors ligne', 'flxp.fan': 'Ventilo', 'flxp.fanStandard': 'Standard', 'flxp.fanContest': 'Contest', 'flxp.fanBroadcast': 'Diffusion', 'flxp.fault': 'DÉFAUT', 'flxp.meters': 'Mesures', 'flxp.voltage': 'TENSION', 'flxp.paTemp': 'TEMP PA', 'flxp.txFilter': 'Filtre TX', 'flxp.micProfile': 'Profil micro', 'flxp.noMeters': 'Aucune mesure — en attente du flux UDP de la radio…', 'flxp.amplifierHdr': 'AMPLIFICATEUR', 'flxp.outputPower': 'PUISSANCE DE SORTIE', 'flxp.speOffline': 'SPE hors ligne', 'flxp.acomOffline': 'Acom hors ligne', 'flxp.kpaTuning': 'ACCORD', 'flxp.kpaClearsFault': "OPERATE efface aussi le défaut courant (sauf la température, qui s'efface en refroidissant)", 'flxp.ampPick': 'Choisir quel amplificateur cette carte affiche', 'flxp.dspV4Hint': 'DSP SmartSDR v4 (séries 8000/Aurora)', 'flxp.daxHint': "DAX comme source audio d'émission (bouton DAX du bandeau transmit de SmartSDR) — pour WSJT-X & co", 'flxp.rnnHint': 'RNN — réduction de bruit par IA (on/off)', 'flxp.anftHint': 'ANFT — filtre notch automatique FFT (on/off)', 'flxp.dspNoise': 'Bruit', 'flxp.dspMore': 'Afficher/masquer le DSP avancé (WNB, NR/notch v4)',
'icmp.spectrum': 'Spectre', 'icmp.scopeFixed': 'Fixe — double-clic / molette pour accorder', 'icmp.scopeCenter': 'Centré — suit le VFO', 'icmp.scopeOff': 'Scope éteint', 'icmp.scopePanDown': 'Décaler le scope 50 kHz', 'icmp.scopePanUp': 'Décaler le scope +50 kHz', 'icmp.scopeCenterVfo': 'Centrer le scope sur la fréquence actuelle (±50 kHz)', 'icmp.notConnected': 'Icom non connecté. Active le backend CI-V Icom dans Réglages → CAT et connecte le port USB de la radio.', 'icmp.refresh': 'Rafraîchir', 'icmp.meters': 'Mesures', 'icmp.transmit': 'Émission', 'icmp.power': 'Puissance', 'icmp.mic': 'Micro', 'icmp.receive': 'Réception', 'icmp.preamp': 'Préampli', 'icmp.filter': 'Filtre', 'icmp.noiseNotch': 'Bruit / Notch', 'icmp.autoNotch': 'Filtre notch auto', 'icmp.apf': 'Filtre de pic audio (CW)', 'icmp.clarifiers': 'RIT / ΔTX', 'icmp.ritHint': 'Molette ou ± pour décaler · Ctrl+←/→ décale le RIT si actif', 'icmp.bandsAntenna': 'Bandes & Antenne', 'icmp.bandCurrent': 'Le poste est sur {b} m', 'icmp.antenna': 'Antenne', 'icmp.passband': 'Passe-bande / Notch', 'icmp.pbtCenter': 'Centrer PBT', 'icmp.manualNotch': 'Notch manuel — active MN, puis règle la position', 'icmp.squelch': 'Squelch', 'icmp.powerOnHint': 'Allumer la radio (démarre en ~15 s)', 'icmp.powerOffHint': 'Éteindre la radio', 'icmp.powerOffConfirm': 'Éteindre la radio ?',
'rst.clickToFill': 'Clic pour remplir le RST tx depuis le signal',
'qrz.openTitle': 'Ouvrir {call} sur QRZ.com',
+47
View File
@@ -1500,6 +1500,51 @@ export namespace extsvc {
}
export namespace kpa {
export class Status {
connected: boolean;
transport: string;
model?: string;
last_error?: string;
power_on: boolean;
operate: boolean;
fwd_w: number;
swr: number;
volt_v: number;
cur_a: number;
temp_c: number;
band?: string;
tuning: boolean;
fault_code: number;
fault_text?: string;
static createFrom(source: any = {}) {
return new Status(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.connected = source["connected"];
this.transport = source["transport"];
this.model = source["model"];
this.last_error = source["last_error"];
this.power_on = source["power_on"];
this.operate = source["operate"];
this.fwd_w = source["fwd_w"];
this.swr = source["swr"];
this.volt_v = source["volt_v"];
this.cur_a = source["cur_a"];
this.temp_c = source["temp_c"];
this.band = source["band"];
this.tuning = source["tuning"];
this.fault_code = source["fault_code"];
this.fault_text = source["fault_text"];
}
}
}
export namespace lookup {
export class Result {
@@ -1701,6 +1746,7 @@ export namespace main {
pgxl?: powergenius.Status;
spe?: spe.Status;
acom?: acom.Status;
kpa?: kpa.Status;
static createFrom(source: any = {}) {
return new AmpStatus(source);
@@ -1714,6 +1760,7 @@ export namespace main {
this.pgxl = this.convertValues(source["pgxl"], powergenius.Status);
this.spe = this.convertValues(source["spe"], spe.Status);
this.acom = this.convertValues(source["acom"], acom.Status);
this.kpa = this.convertValues(source["kpa"], kpa.Status);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
+60
View File
@@ -0,0 +1,60 @@
// Package kpa talks to the Elecraft KPA500 and KPA1500 amplifiers.
//
// One package for both: they share the Elecraft command set — ASCII, a caret
// prefix, a semicolon terminator, case-insensitive on the way in and upper case
// on the way back — which is the same family as the K3/K4 panel in
// internal/cat. What differs between the two models is the transport and which
// commands exist, not the grammar.
//
// # Transports
//
// KPA500: serial only.
//
// KPA1500: serial, and a network server. Four things may be connected AT ONCE,
// which is unusual enough to design around — the Host PC USB port, the XCVR
// SERIAL connector when repurposed as a second host, ONE TCP client, and any
// number of UDP clients:
//
// - TCP on port 1500 (changed with ^CP). Single client. If the operator
// already has the Elecraft utility or another program on TCP, OpsLog will
// not get in, and the failure is a refused connection rather than anything
// the amplifier says.
// - UDP on the same port. Many clients, one command per packet and at most
// one response, and packets may be dropped under congestion — so it is the
// right choice for sharing the amplifier and the wrong one for a command
// that must not be missed.
//
// # Pacing
//
// There is NO flow control. The reference is explicit: pace commands by waiting
// for the response to the previous one. So this client is strictly
// question-and-answer on one connection, like the ACOM and SPE clients, rather
// than firing a poll cycle and sorting out the replies afterwards.
//
// # Serial speed
//
// 4800 to 230400, 8N1, set on the amplifier (^BR / SERIAL SPEED HOST) and not
// negotiated. Elecraft's own utility finds it by sending bare semicolons at
// each speed until something answers — worth copying if operators turn up with
// amplifiers whose speed they do not know.
//
// # What is settled, and how
//
// From the KPA1500 Programming Reference:
//
// - ^SW is the SWR IN TENTHS. "123 is 12.3:1", so ^SW015 is 1.5:1. This was
// first taken from Hamlib's backend and is now confirmed by the document,
// which matters more than it sounds: a wrongly scaled SWR bar reports a
// good match on a bad antenna.
// - ^WS returns forward power AND SWR together, ^VI returns PA voltage AND
// current together. Two round trips instead of four on the link the display
// depends on while the operator is transmitting.
// - ^SF returns the fault log: index, fault code, a short name in quotes, a
// timestamp, and fault-specific values. ^FC describes the codes.
//
// # Not touched
//
// ^TX simulates a KEY IN — it makes the amplifier transmit from software — and
// ^ON0 switches the main supplies off. Neither belongs on a poll loop or behind
// a button that can be pressed by accident.
package kpa
+412
View File
@@ -0,0 +1,412 @@
package kpa
// The client: one connection, strict question-and-answer, a cached status.
//
// Shaped like internal/acom and internal/spe so a third amplifier is the same
// thing to read — but the traffic is the opposite kind. Those two are told to
// stream and are then listened to; this one is asked, and answers. The
// reference is explicit that there is no flow control and that commands are
// paced by waiting for the previous reply, so nothing here ever has two
// questions outstanding.
import (
"bufio"
"fmt"
"io"
"net"
"strings"
"sync"
"time"
"go.bug.st/serial"
"hamlog/internal/applog"
)
const (
dialTimeout = 5 * time.Second
ioTimeout = 2 * time.Second
// pollInterval is the fast cycle: forward power, SWR, and whether a fault has
// appeared. Four times a second is enough for a bar that is read while
// talking, and it is four round trips a second on a link with no flow
// control — faster buys nothing and costs the set commands their latency.
pollInterval = 250 * time.Millisecond
// slowEvery is how many fast cycles pass between the readings that do not
// move: mode, band, temperature, supply. Once a second.
slowEvery = 4
)
// Status is what the panel polls.
type Status struct {
Connected bool `json:"connected"`
Transport string `json:"transport"` // "serial" | "tcp"
Model string `json:"model,omitempty"`
LastError string `json:"last_error,omitempty"`
// PowerOn is the main supplies (^ON), Operate is OPERATE vs STANDBY (^OS).
// They are different questions: an amplifier can be switched on and in
// standby, which is the normal state between overs.
PowerOn bool `json:"power_on"`
Operate bool `json:"operate"`
FwdW int `json:"fwd_w"`
SWR float64 `json:"swr"`
VoltV float64 `json:"volt_v"`
CurA int `json:"cur_a"`
TempC int `json:"temp_c"`
Band string `json:"band,omitempty"`
// Tuning is the ATU mid-cycle (^TP), so a panel can say so rather than
// showing a wild SWR and a power reading nobody should act on.
Tuning bool `json:"tuning"`
// Fault is the current fault code and its meaning. A fault puts the
// amplifier in STANDBY by itself, so it is the first thing to show.
FaultCode int `json:"fault_code"`
FaultText string `json:"fault_text,omitempty"`
}
// Config selects the model and how to reach it.
type Config struct {
Model string // "KPA500" | "KPA1500"
Transport string // "serial" | "tcp"
ComPort string // serial
Baud int // serial: 4800…230400, set on the amplifier and not negotiated
Host string // tcp (KPA1500 only)
Port int // tcp, default 1500
}
type Client struct {
cfg Config
mu sync.Mutex // serialises the connection: one question at a time
conn io.ReadWriteCloser
rd *bufio.Reader
statusMu sync.RWMutex
status Status
stop chan struct{}
running bool
}
// New builds a client. Nothing is opened until Start.
func New(cfg Config) *Client {
if cfg.Baud <= 0 {
cfg.Baud = 38400
}
if cfg.Port <= 0 {
cfg.Port = 1500
}
if strings.TrimSpace(cfg.Model) == "" {
cfg.Model = "KPA1500"
}
c := &Client{cfg: cfg, stop: make(chan struct{})}
c.status.Transport = cfg.Transport
c.status.Model = strings.ToUpper(strings.TrimSpace(cfg.Model))
return c
}
func (c *Client) Start() error {
if c.running {
return nil
}
c.running = true
go c.pollLoop()
return nil
}
func (c *Client) Stop() {
if !c.running {
return
}
c.running = false
close(c.stop)
c.mu.Lock()
c.dropLocked()
c.mu.Unlock()
}
func (c *Client) GetStatus() Status {
c.statusMu.RLock()
defer c.statusMu.RUnlock()
return c.status
}
func (c *Client) setErr(msg string) {
c.statusMu.Lock()
was := c.status.LastError
c.status.Connected = false
c.status.LastError = msg
c.statusMu.Unlock()
// Logged on CHANGE only: a disconnected amplifier is polled four times a
// second, and the log is where a hardware problem is diagnosed hours later.
if msg != "" && msg != was {
applog.Printf("kpa: %s", msg)
}
}
// dropLocked closes the connection. Caller holds c.mu.
func (c *Client) dropLocked() {
if c.conn != nil {
_ = c.conn.Close()
c.conn = nil
c.rd = nil
}
}
// connectLocked opens the transport. Caller holds c.mu.
func (c *Client) connectLocked() error {
if c.conn != nil {
return nil
}
switch strings.ToLower(strings.TrimSpace(c.cfg.Transport)) {
case "tcp":
if strings.TrimSpace(c.cfg.Host) == "" {
return fmt.Errorf("no address configured for the amplifier")
}
addr := net.JoinHostPort(c.cfg.Host, fmt.Sprint(c.cfg.Port))
conn, err := net.DialTimeout("tcp", addr, dialTimeout)
if err != nil {
// Named for what it usually is. The KPA1500 accepts ONE TCP client,
// so the common failure is not a wrong address but the Elecraft
// utility already holding the socket — and "connection refused"
// sends an operator looking at their network instead.
return fmt.Errorf("cannot reach the amplifier on %s: %w (it accepts a single TCP connection — close the Elecraft utility or any other program using it)", addr, err)
}
c.conn = conn
default:
if strings.TrimSpace(c.cfg.ComPort) == "" {
return fmt.Errorf("no serial port configured for the amplifier")
}
p, err := serial.Open(c.cfg.ComPort, &serial.Mode{BaudRate: c.cfg.Baud})
if err != nil {
return fmt.Errorf("cannot open %s: %w", c.cfg.ComPort, err)
}
_ = p.SetReadTimeout(ioTimeout)
c.conn = p
}
c.rd = bufio.NewReader(c.conn)
applog.Printf("kpa: connected to the %s", c.status.Model)
return nil
}
// ask sends one command and reads its answer.
//
// The whole exchange is under the lock: with no flow control, two questions in
// flight means two answers to sort out, and the only thing distinguishing them
// is the prefix — which is exactly what payload() has to reject when it
// happens.
func (c *Client) ask(cmd string) (string, error) {
c.mu.Lock()
defer c.mu.Unlock()
if err := c.connectLocked(); err != nil {
return "", err
}
if tc, ok := c.conn.(net.Conn); ok {
_ = tc.SetDeadline(time.Now().Add(ioTimeout))
}
if _, err := c.conn.Write([]byte(cmd)); err != nil {
c.dropLocked()
return "", fmt.Errorf("writing %s: %w", cmd, err)
}
// Answers end with a semicolon and nothing else does, so the terminator is
// the frame.
line, err := c.rd.ReadString(';')
if err != nil {
c.dropLocked()
return "", fmt.Errorf("no answer to %s: %w", cmd, err)
}
return strings.TrimSpace(line), nil
}
// send is a SET: written, and not answered. The reference says SET commands do
// not generally produce a response, so waiting for one would stall the poll
// loop for a whole timeout every time the operator pressed a button.
func (c *Client) send(cmd string) error {
c.mu.Lock()
defer c.mu.Unlock()
if err := c.connectLocked(); err != nil {
return err
}
if tc, ok := c.conn.(net.Conn); ok {
_ = tc.SetDeadline(time.Now().Add(ioTimeout))
}
if _, err := c.conn.Write([]byte(cmd)); err != nil {
c.dropLocked()
return fmt.Errorf("writing %s: %w", cmd, err)
}
applog.Printf("kpa: → %s", cmd)
return nil
}
// Operate puts the amplifier in OPERATE (true) or STANDBY (false).
//
// Worth knowing, and worth saying in the UI: from firmware 01.41 onwards,
// going to OPERATE also CLEARS the current fault — every one except
// temperature, which clears by cooling. So this button is the way out of a
// fault as well as the way into transmit.
func (c *Client) Operate(on bool) error {
if on {
return c.send("^OS1;")
}
return c.send("^OS0;")
}
// ClearFault clears the current fault without changing mode (^FLC).
func (c *Client) ClearFault() error { return c.send("^FLC;") }
// PowerOn switches the main supplies on or off (^ON1 / ^ON0).
//
// Off is a real power-down, not standby, and the way back on over the network
// is Wake-on-LAN or the front panel — so a caller should be asking the operator
// first. The sleeping microcontroller does answer ^ON while the supplies are
// off, which is why "off" is a state this can report rather than a silence.
func (c *Client) PowerOn(on bool) error {
if on {
return c.send("^ON1;")
}
return c.send("^ON0;")
}
// Tune starts an ATU tune cycle (^FT). It needs drive from the transceiver.
func (c *Client) Tune() error { return c.send("^FT;") }
// pollLoop keeps the status fresh, reconnecting as needed.
func (c *Client) pollLoop() {
t := time.NewTicker(pollInterval)
defer t.Stop()
var n uint64
for {
select {
case <-c.stop:
return
case <-t.C:
c.pollOnce(n)
n++
}
}
}
func (c *Client) pollOnce(n uint64) {
// Forward power and SWR in ONE exchange (^WS), which is why that command
// exists and why the two are not asked separately.
reply, err := c.ask("^WS;")
if err != nil {
c.setErr(err.Error())
return
}
w, swr, err := parseWS(reply)
if err != nil {
c.setErr(err.Error())
return
}
c.statusMu.Lock()
c.status.Connected = true
c.status.LastError = ""
c.status.FwdW, c.status.SWR = w, swr
c.statusMu.Unlock()
// The fault, every cycle: it puts the amplifier in standby by itself, and an
// operator watching a power bar needs to know why it stopped moving.
if reply, err := c.ask("^FL;"); err == nil {
if code, err := parseFault(reply); err == nil {
c.statusMu.Lock()
was := c.status.FaultCode
c.status.FaultCode = code
c.status.FaultText = FaultName(code)
c.statusMu.Unlock()
if code != was && code != 0 {
applog.Printf("kpa: FAULT %02X — %s", code, FaultName(code))
}
}
}
if n%slowEvery != 0 {
return
}
// The readings that do not move fast. Each is optional: an older firmware or
// a KPA500 that does not know one of these must not take the rest down with
// it, so a failure here leaves the previous value standing.
if reply, err := c.ask("^OS;"); err == nil {
if v, err := parseInt(reply, "^OS"); err == nil {
c.statusMu.Lock()
c.status.Operate = v == 1
c.statusMu.Unlock()
}
}
if reply, err := c.ask("^ON;"); err == nil {
if v, err := parseInt(reply, "^ON"); err == nil {
c.statusMu.Lock()
c.status.PowerOn = v == 1
c.statusMu.Unlock()
}
}
if reply, err := c.ask("^VI;"); err == nil {
if v, a, err := parseVI(reply); err == nil {
c.statusMu.Lock()
c.status.VoltV, c.status.CurA = v, a
c.statusMu.Unlock()
}
}
if reply, err := c.ask("^TM;"); err == nil {
if v, err := parseInt(reply, "^TM"); err == nil {
c.statusMu.Lock()
c.status.TempC = v
c.statusMu.Unlock()
}
}
if reply, err := c.ask("^BN;"); err == nil {
if v, err := parseInt(reply, "^BN"); err == nil {
c.statusMu.Lock()
c.status.Band = BandName(v)
c.statusMu.Unlock()
}
}
if reply, err := c.ask("^TP;"); err == nil {
if v, err := parseInt(reply, "^TP"); err == nil {
c.statusMu.Lock()
c.status.Tuning = v == 1
c.statusMu.Unlock()
}
}
}
// SetBand puts the amplifier on a band by its ADIF name.
//
// The KPA takes its band from the transceiver on its own XCVR connector, but it
// also accepts ^BN — so OpsLog can simply say it on the link it is already
// using. That is worth knowing: an Acom has no such command, which is why
// following it needs a second serial port and a transceiver emulator answering
// its polls (internal/catemu). None of that applies here.
//
// Sent only when it CHANGES. Repeating the current band four times a second
// would be traffic on a link with no flow control, in exchange for nothing.
func (c *Client) SetBand(adifBand string) error {
n, ok := bandNumber(adifBand)
if !ok {
// Not an error the operator should see: the KPA covers 160-6 m, and
// tuning to 23 cm is not a fault, it is simply not this amplifier's
// business.
return nil
}
c.statusMu.Lock()
same := c.status.Band == adifBand
c.statusMu.Unlock()
if same {
return nil
}
return c.send(fmt.Sprintf("^BN%02d;", n))
}
// bandNumber is BandName backwards.
func bandNumber(adifBand string) (int, bool) {
b := strings.ToLower(strings.TrimSpace(adifBand))
for n, name := range bandNames {
if name == b {
return n, true
}
}
return 0, false
}
+157
View File
@@ -0,0 +1,157 @@
package kpa
// Decoding the amplifier's answers.
//
// Every format here is quoted from the KPA1500 Programming Reference, with the
// document's own example kept in the test next door. That is the whole
// discipline: a meter decoded from a guess reports a good match on a bad
// antenna, and nobody finds out until something is damaged.
import (
"fmt"
"strconv"
"strings"
)
// payload strips the leading "^", the command letters and the trailing ";",
// leaving the value. Returns false when the answer is not for this command —
// which happens on a shared serial line and on the first read after a
// reconnect, where a stale reply is still in flight.
func payload(reply, cmd string) (string, bool) {
r := strings.TrimSpace(reply)
r = strings.TrimSuffix(r, ";")
r = strings.TrimPrefix(r, "^")
cmd = strings.TrimSuffix(strings.TrimPrefix(cmd, "^"), ";")
if !strings.HasPrefix(strings.ToUpper(r), strings.ToUpper(cmd)) {
return "", false
}
return strings.TrimSpace(r[len(cmd):]), true
}
// parseWS reads forward power and SWR from one answer.
//
// ^WS1204 014; → 1204 W, SWR 1.4
//
// The watts field is FOUR digits on a KPA1500 and THREE on a KPA500 — the
// reference says so where it explains that ^WS exists for KPA500 compatibility
// — so the split is on the space and not on a width. The SWR is in tenths, the
// same units as everywhere else in this protocol.
func parseWS(reply string) (watts int, swr float64, err error) {
v, ok := payload(reply, "^WS")
if !ok {
return 0, 0, fmt.Errorf("not a ^WS answer: %q", reply)
}
f := strings.Fields(v)
if len(f) != 2 {
return 0, 0, fmt.Errorf("^WS wants two fields, got %q", v)
}
w, err1 := strconv.Atoi(f[0])
s, err2 := strconv.Atoi(f[1])
if err1 != nil || err2 != nil {
return 0, 0, fmt.Errorf("^WS not numeric: %q", v)
}
return w, float64(s) / 10, nil
}
// parseVI reads the PA supply voltage and current.
//
// ^VI513 061; → 51.3 V, 61 A
//
// Volts in TENTHS, amps whole. Two different scales in one answer, which is
// exactly the kind of detail that is wrong when it is assumed.
func parseVI(reply string) (volts float64, amps int, err error) {
v, ok := payload(reply, "^VI")
if !ok {
return 0, 0, fmt.Errorf("not a ^VI answer: %q", reply)
}
f := strings.Fields(v)
if len(f) != 2 {
return 0, 0, fmt.Errorf("^VI wants two fields, got %q", v)
}
dv, err1 := strconv.Atoi(f[0])
a, err2 := strconv.Atoi(f[1])
if err1 != nil || err2 != nil {
return 0, 0, fmt.Errorf("^VI not numeric: %q", v)
}
return float64(dv) / 10, a, nil
}
// parseInt reads the plain numeric answers: ^TMxxx (°C), ^PCnnn (A),
// ^BNbb (band number), ^OSx, ^ONx, ^TPx.
func parseInt(reply, cmd string) (int, error) {
v, ok := payload(reply, cmd)
if !ok {
return 0, fmt.Errorf("not a %s answer: %q", cmd, reply)
}
n, err := strconv.Atoi(strings.TrimSpace(v))
if err != nil {
return 0, fmt.Errorf("%s not numeric: %q", cmd, v)
}
return n, nil
}
// parseFault reads ^FLhh — TWO HEX DIGITS, not decimal. Fault 90 is reflected
// power and fault 91 is "antenna not connected"; read as decimal they would be
// 144 and 145 and match nothing in the table.
func parseFault(reply string) (int, error) {
v, ok := payload(reply, "^FL")
if !ok {
return 0, fmt.Errorf("not a ^FL answer: %q", reply)
}
n, err := strconv.ParseInt(strings.TrimSpace(v), 16, 32)
if err != nil {
return 0, fmt.Errorf("^FL not hex: %q", v)
}
return int(n), nil
}
// faultNames is the table from the reference, keyed by the hex code.
//
// Said in the operator's terms rather than the amplifier's: "the antenna is not
// connected" is a thing to go and fix, "fault 91" is a thing to go and look up.
var faultNames = map[int]string{
0x00: "no fault",
0x10: "watchdog timer reset",
0x20: "PA current too high",
0x40: "too hot — clears as it cools",
0x60: "drive power too high",
0x61: "gain too low for the drive",
0x70: "frequency outside a ham band",
0x80: "50 V supply out of range",
0x81: "5 V supply out of range",
0x82: "10 V supply out of range",
0x83: "12 V supply out of range",
0x84: "-12 V supply out of range",
0x85: "no LPF board supply detected",
0x90: "reflected power too high",
0x91: "SWR very high — antenna not connected?",
0x92: "the ATU found no match",
0xB0: "dissipated power too high",
0xC0: "forward power too high",
0xC1: "forward power too high for this ATU setting",
0xF0: "gain too high for the drive",
}
// FaultName describes a fault code, or says the code itself when the firmware
// reports one this table does not know — a newer amplifier must not be able to
// produce a blank explanation.
func FaultName(code int) string {
if code == 0 {
return ""
}
if s, ok := faultNames[code]; ok {
return s
}
return fmt.Sprintf("fault %02X", code)
}
// bandNames maps ^BN to the ADIF band. The numbering is the K3/K4 one, which is
// why it is worth writing down: it is not frequency order beyond 6 m and there
// is no arithmetic that produces it.
var bandNames = map[int]string{
0: "160m", 1: "80m", 2: "60m", 3: "40m", 4: "30m", 5: "20m",
6: "17m", 7: "15m", 8: "12m", 9: "10m", 10: "6m",
}
// BandName is the ADIF band for a ^BN number, or "" when unknown.
func BandName(n int) string { return bandNames[n] }
+104
View File
@@ -0,0 +1,104 @@
package kpa
import "testing"
// The reference's own examples, kept as the test. Every one of these strings is
// quoted from the KPA1500 Programming Reference rather than invented here, so a
// change that breaks the decoding fails against the document.
func TestParseTheDocumentedExamples(t *testing.T) {
t.Run("^WS — forward power and SWR", func(t *testing.T) {
w, swr, err := parseWS("^WS1204 014;")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if w != 1204 || swr != 1.4 {
t.Errorf("got %d W, SWR %.1f; want 1204 W, SWR 1.4", w, swr)
}
})
// A KPA500 sends three digits for the watts. The split is on the space, so
// the same code reads both amplifiers.
t.Run("^WS from a KPA500 — three digits", func(t *testing.T) {
w, swr, err := parseWS("^WS480 021;")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if w != 480 || swr != 2.1 {
t.Errorf("got %d W, SWR %.1f; want 480 W, SWR 2.1", w, swr)
}
})
t.Run("^VI — volts in tenths, amps whole", func(t *testing.T) {
v, a, err := parseVI("^VI513 061;")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if v != 51.3 || a != 61 {
t.Errorf("got %.1f V, %d A; want 51.3 V, 61 A", v, a)
}
})
t.Run("^TM — heat sink temperature", func(t *testing.T) {
c, err := parseInt("^TM045;", "^TM")
if err != nil || c != 45 {
t.Errorf("got %d, %v; want 45", c, err)
}
})
t.Run("^OS — operate or standby", func(t *testing.T) {
for reply, want := range map[string]int{"^OS0;": 0, "^OS1;": 1} {
got, err := parseInt(reply, "^OS")
if err != nil || got != want {
t.Errorf("%s → %d, %v; want %d", reply, got, err, want)
}
}
})
t.Run("^BN — the K3 band numbering", func(t *testing.T) {
n, err := parseInt("^BN05;", "^BN")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if got := BandName(n); got != "20m" {
t.Errorf("^BN05 → %q, want 20m", got)
}
if got := BandName(10); got != "6m" {
t.Errorf("^BN10 → %q, want 6m", got)
}
})
}
// ^FL is HEX. Read as decimal, 90 and 91 — reflected power and "antenna not
// connected" — become 144 and 145 and match nothing at all, so the amplifier
// would be shut down by a fault OpsLog could not name.
func TestFaultCodesAreHex(t *testing.T) {
code, err := parseFault("^FL91;")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if code != 0x91 {
t.Fatalf("^FL91 → %d, want %d (0x91)", code, 0x91)
}
if name := FaultName(code); name == "" || name == "fault 91" {
t.Errorf("0x91 should be named, got %q", name)
}
if got := FaultName(0); got != "" {
t.Errorf("no fault should be empty, got %q", got)
}
// A code from a firmware newer than this table still says something.
if got := FaultName(0xAB); got != "fault AB" {
t.Errorf("unknown code → %q, want \"fault AB\"", got)
}
}
// Answers to somebody else's question are refused rather than misread. On a
// serial line shared with the amplifier's own utility, or on the first read
// after a reconnect, a stale reply is still in flight.
func TestPayloadRefusesAnotherCommandsAnswer(t *testing.T) {
if _, _, err := parseWS("^VI513 061;"); err == nil {
t.Error("a ^VI answer was accepted as ^WS")
}
if _, err := parseInt("^TM045;", "^PC"); err == nil {
t.Error("a ^TM answer was accepted as ^PC")
}
}