fix: Yaesu mode commands always addressed the main receiver

Reported, and reasoned out from the half that already worked: a spot click now
tunes the right VFO, but it set the mode with MD0 — main — whatever VFO the
operator was on. Working from SUB, the spot changed the mode of the VFO NOT in
use and left the one in use as it was. The author inferred the sub half from
seeing main change, and was right.

The read had the same fault, so the console displayed main's mode while showing
the sub VFO's frequency.

Mode now addresses the receiver in use — MD0 for main, MD1 for sub — in the poll
read, in SetMode, and in the console's raw-mode setter. A rig without a sub
receiver never sees MD1: curVFO only becomes B where the rig reports its receive
VFO in the first place.
This commit is contained in:
2026-07-30 10:10:43 +02:00
parent a8990ff29d
commit 7759e09b4e
4 changed files with 61 additions and 6 deletions
+33
View File
@@ -347,3 +347,36 @@ func TestYaesuSplitProbeOrder(t *testing.T) {
t.Error("ST1 is a flag and reads as split whatever the VFO — that is the trap")
}
}
// The mode commands address the receiver the operator is ON.
//
// Reported on an FTDX101 (F4NBZ, 2026-07-29): once a spot click tuned the right
// VFO, it still changed the mode of MAIN while the operator worked from SUB — so
// the VFO in use kept its old mode and the idle one was altered. The read had the
// same fault, so the panel showed main's mode as well.
func TestYaesuModeVFOSuffix(t *testing.T) {
cases := []struct{ vfo, want string }{
{"A", "0"}, // main
{"", "0"}, // not yet read — main is the safe assumption
{"B", "1"}, // sub
{"AB", "0"}, // pair enums start with the receive VFO
}
for _, c := range cases {
y := &Yaesu{}
y.curVFO = c.vfo
if got := y.modeVFOSuffix(); got != c.want {
t.Errorf("curVFO=%q → MD%s, want MD%s", c.vfo, got, c.want)
}
}
// Spelled out as the commands actually sent, which is what the rig sees.
y := &Yaesu{}
y.curVFO = "B"
if cmd := "MD" + y.modeVFOSuffix() + "3;"; cmd != "MD13;" {
t.Errorf("setting CW on the sub receiver sends %q, want MD13;", cmd)
}
y.curVFO = "A"
if cmd := "MD" + y.modeVFOSuffix() + "3;"; cmd != "MD03;" {
t.Errorf("setting CW on main sends %q, want MD03;", cmd)
}
}