feat(yaesu): eight-digit rigs — the width comes from the radio

An FTDX3000 rejects every FA command: the FTDX10 family writes a
frequency in nine digits and everything before it — FTDX3000, FTDX5000,
FTDX1200, FT-2000, FT-950, FT-450 — writes eight, answering the longer
form with "?;". The rig would not follow and nothing said why.

The width is LEARNED from the rig's own replies rather than tabulated: it
announces the format in every answer to FA;, so it comes from the radio
in front of the operator instead of from a model list that is always one
release behind — and a Yaesu this backend has never heard of is right on
the first read. Nine until the first reply lands, which is what the
modern rigs use and what this backend was written against.

The five older ID codes are named too, so the console says FTDX3000
rather than a bare number.
This commit is contained in:
2026-09-06 21:11:19 +02:00
parent 23f324e606
commit 3745d23339
3 changed files with 101 additions and 4 deletions
+38
View File
@@ -0,0 +1,38 @@
package cat
import "testing"
// The FTDX10 family writes a frequency in nine digits; everything before it —
// FTDX3000, FTDX5000, FTDX1200, FT-2000, FT-950, FT-450 — writes eight and
// answers a nine-digit SET with "?;". Reported from an FTDX3000: every FA
// command rejected, a radio that would not follow.
//
// The width is taken from the rig's own reply, so a model this backend has
// never heard of is right on the first read.
func TestYaesuFrequencyWidthIsLearnedFromTheRig(t *testing.T) {
y := &Yaesu{}
if got := y.freqWidth(); got != 9 {
t.Errorf("before any reply the width is %d, want the modern 9", got)
}
y.learnFreqWidth("FA14074000;", "FA") // an FTDX3000
if got := y.freqWidth(); got != 8 {
t.Errorf("width %d after an eight-digit reply, want 8", got)
}
y.learnFreqWidth("FA014074000;", "FA") // and an FTDX10 on the next session
if got := y.freqWidth(); got != 9 {
t.Errorf("width %d after a nine-digit reply, want 9", got)
}
// Nothing that is not a frequency teaches anything: a rejection, a stray
// frame or a reply from another command would otherwise set the format for
// every command that follows.
for _, junk := range []string{"?;", "FA;", "FB014074000;", "FA1407400X;", "FA1234567;", "FA123456789012;"} {
before := y.freqWidth()
y.learnFreqWidth(junk, "FA")
if after := y.freqWidth(); after != before {
t.Errorf("%q changed the width from %d to %d", junk, before, after)
}
}
}