fix: SPLIT placed the transmitter on a stale VFO; share the meter widget

Reported on the FTDX10: listening on 14.244 with VFO B still holding 18.115 from
an earlier session, pressing SPLIT threw the transmitter onto another band. The
button only flipped the rig's split flag, and the other VFO is stale by nature —
the only transmit frequency that makes sense is one derived from where the
operator is listening NOW. SPLIT therefore places the TX VFO too: up 1 kHz on CW
and the data modes, up 5 kHz on phone, the offsets operators actually call. The
+1k / +5k buttons remain for anything else, and a test pins the mapping.

The panel also drew its own flat meters while the Flex and Icom consoles use the
shared LED-segment MeterBar. Two instrument styles in one application is just
inconsistency — it now uses the shared component, and the local one is gone.

And the three consoles are named alike: "Flex Console", "Icom Console", "Yaesu
Console", in the tabs and in the Main-view pane list, in both languages.
This commit is contained in:
2026-07-29 11:55:28 +02:00
parent 7153768579
commit 6d309cada1
6 changed files with 84 additions and 35 deletions
+11 -27
View File
@@ -10,6 +10,7 @@ import {
import { cn } from '@/lib/utils';
import { useI18n } from '@/lib/i18n';
import { sMeterRST } from '@/lib/rst';
import { MeterBar } from '@/components/MeterBar';
type YaesuState = {
available: boolean; model?: string; mode?: string; raw_mode?: string;
@@ -206,27 +207,6 @@ function Row({ label, children }: { label: string; children: React.ReactNode })
);
}
function Meter({ label, value, accent, text, onClick, title }: {
label: string; value: number; accent: string; text?: string; onClick?: () => void; title?: string;
}) {
const v = Math.max(0, Math.min(100, value));
const body = (
<>
<span className="w-9 shrink-0 text-[11px] font-bold uppercase tracking-wider text-muted-foreground">{label}</span>
<div className="flex-1 h-2.5 rounded-full bg-muted/60 overflow-hidden">
<div className="h-full rounded-full transition-[width] duration-150" style={{ width: `${v}%`, background: accent }} />
</div>
{/* The S meter reads in S UNITS, not a percentage — "57" told the operator
nothing, and it is the S number that goes into a report. */}
<span className="w-14 text-right text-xs font-mono tabular-nums text-muted-foreground">{text ?? v}</span>
</>
);
if (onClick) {
return <button type="button" onClick={onClick} title={title} className="flex items-center gap-2 w-full hover:opacity-80">{body}</button>;
}
return <div className="flex items-center gap-2">{body}</div>;
}
export function YaesuPanel({ onReportRST }: { onReportRST?: (rst: string) => void }) {
const { t } = useI18n();
const [st, setSt] = useState<YaesuState>(ZERO);
@@ -327,13 +307,17 @@ export function YaesuPanel({ onReportRST }: { onReportRST?: (rst: string) => voi
{err && <p className="text-xs text-destructive px-1">{err}</p>}
{/* Meters */}
{/* Meters — the SHARED MeterBar the Flex and Icom panels use, so the three
consoles read alike instead of each having its own instrument style. */}
<Card icon={Activity} title={t('yaesu.meters')}>
<Meter label="S" value={view.s_meter} accent="var(--chart-1, #2563eb)" text={sParts(view.s_meter).label}
onClick={onReportRST ? () => { const sp = sParts(view.s_meter); onReportRST(sMeterRST(sp.s, sp.over, view.mode)); } : undefined}
title={t('yaesu.sToRst')} />
<Meter label="PO" value={view.power_meter} accent="var(--success, #16a34a)" />
<Meter label="SWR" value={view.swr_meter} accent="var(--warning, #d97706)" />
<div className="grid grid-cols-1 sm:grid-cols-3 gap-2">
<MeterBar label="S-METER" value={view.s_meter} lo={0} hi={100} accent="#16a34a"
display={sParts(view.s_meter).label}
onClick={onReportRST ? () => { const sp = sParts(view.s_meter); onReportRST(sMeterRST(sp.s, sp.over, view.mode)); } : undefined}
title={onReportRST ? t('yaesu.sToRst') : undefined} />
<MeterBar label="PWR" value={view.rf_power * view.power_meter / 100} unit="W" lo={0} hi={100} accent="#0ea5e9" />
<MeterBar label="SWR" value={view.swr_meter} lo={0} hi={100} accent="#f59e0b" />
</div>
</Card>
{/* Bands + modes */}