fix: read the real SWR on the Yaesu, and show the ratio
A second measurement at a known mismatch settled both the index and the scale. At SWR 1.1: RM6=0. At SWR 1.5: RM6=52, while RM4 kept tracking the power. 52/255 = 0.204, which is the reflection coefficient of a 1.5 SWR to three decimals. So the raw value is rho scaled to 255, and the ratio is (1+rho)/(1-rho) — physics, not a curve fitted through two points, which is why 2.0 and 3.0 fall out of it correctly without ever having been measured. The panel now shows that ratio, the number the operator reads on the rig, rather than a percentage of meter travel — and a dash while receiving, since a stale SWR from the last transmission reads as a live one. Both measurements are recorded in the code and in a test, so the mapping is evidence rather than a table borrowed from another model — which is exactly how it came to read 81 in the first place.
This commit is contained in:
@@ -19,7 +19,7 @@ type YaesuState = {
|
||||
rf_power: number; mic_gain: number; af_gain: number; rf_gain: number; squelch: number;
|
||||
agc?: string; preamp: number; att: number;
|
||||
nb: boolean; nr: boolean; nr_level: number; narrow: boolean; vox: boolean;
|
||||
split_tx_hz?: number; key_speed?: number; break_in?: boolean;
|
||||
split_tx_hz?: number; key_speed?: number; break_in?: boolean; swr?: number;
|
||||
};
|
||||
|
||||
const ZERO: YaesuState = {
|
||||
@@ -351,7 +351,10 @@ export function YaesuPanel({ onReportRST, onKeySpeed }: {
|
||||
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" />
|
||||
{/* The RATIO, as the rig shows it — a percentage of meter travel is
|
||||
not something an operator can act on. The bar keeps the travel. */}
|
||||
<MeterBar label="SWR" value={view.swr_meter} lo={0} hi={100} accent="#f59e0b"
|
||||
display={view.transmitting ? (view.swr && view.swr >= 1 ? view.swr.toFixed(1) : '1.0') : '—'} />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -1097,6 +1097,7 @@ export namespace cat {
|
||||
nr: boolean;
|
||||
nr_level: number;
|
||||
narrow: boolean;
|
||||
swr: number;
|
||||
vox: boolean;
|
||||
key_speed: number;
|
||||
break_in: boolean;
|
||||
@@ -1129,6 +1130,7 @@ export namespace cat {
|
||||
this.nr = source["nr"];
|
||||
this.nr_level = source["nr_level"];
|
||||
this.narrow = source["narrow"];
|
||||
this.swr = source["swr"];
|
||||
this.vox = source["vox"];
|
||||
this.key_speed = source["key_speed"];
|
||||
this.break_in = source["break_in"];
|
||||
|
||||
Reference in New Issue
Block a user