fix: split read (and set) backwards on a Yaesu reporting the TX VFO
Reported on an FTDX101: the panel showed split ON with the radio OFF, and the reverse — while the same model behaved correctly for another operator, and an FTDX10 was fine throughout. That pattern is the clue: one operator was on MAIN, the other on SUB. The two commands say different things and were read alike: ST is a split FLAG — ST1 means split, whatever VFO is in use. FT names the TX VFO — FT0 = transmit on A, FT1 = transmit on B. Split is on when the rig transmits on a DIFFERENT VFO from the one it listens to. Reading FT1 as "split" is therefore correct only on VFO A, and exactly inverted on SUB. It is now compared with the current VFO. Writing had the identical fault, and it was worse: sending FT1 for "split on" while the operator listened on SUB CLEARED the split it was asked to set. Both directions are pinned by tests over each VFO state.
This commit is contained in:
@@ -397,12 +397,12 @@ func (y *Yaesu) SetYaesuSplit(on bool) error {
|
||||
return y.SetYaesuSplitOffset(y.defaultSplitOffset())
|
||||
}
|
||||
y.mu.Lock()
|
||||
cmd := y.splitCmd
|
||||
cmd, vfo := y.splitCmd, y.curVFO
|
||||
y.mu.Unlock()
|
||||
if cmd == "" {
|
||||
return fmt.Errorf("yaesu: this rig answered neither ST; nor FT; — split cannot be set")
|
||||
}
|
||||
return y.setAndRefresh(fmt.Sprintf("%s0;", cmd))
|
||||
return y.setAndRefresh(yaesuSplitCommand(cmd, vfo, false))
|
||||
}
|
||||
|
||||
// defaultSplitOffset is what SPLIT means on this mode: up 1 kHz on CW and the
|
||||
@@ -662,7 +662,7 @@ func (y *Yaesu) SetYaesuSplitOffset(offsetHz int64) error {
|
||||
return fmt.Errorf("yaesu: this rig answered neither ST; nor FT; — split cannot be set")
|
||||
}
|
||||
time.Sleep(30 * time.Millisecond)
|
||||
if err := y.write(fmt.Sprintf("%s1;", y.splitCmd)); err != nil {
|
||||
if err := y.write(yaesuSplitCommand(y.splitCmd, y.curVFO, true)); err != nil {
|
||||
return err
|
||||
}
|
||||
y.panel.Split = true
|
||||
@@ -808,3 +808,28 @@ func (m *meterPeak) update(sample int, now time.Time) int {
|
||||
}
|
||||
return m.val
|
||||
}
|
||||
|
||||
// yaesuSplitCommand builds the command that turns split on or off.
|
||||
//
|
||||
// Writing is as asymmetric as reading. ST takes the state directly — ST1 is
|
||||
// split on. FT sets which VFO TRANSMITS, so "split on" means transmit on the
|
||||
// OTHER VFO from the one being listened to, and "split off" means transmit on
|
||||
// the same one. Sending FT1 for "on" regardless is right only for an operator on
|
||||
// VFO A; on SUB it would clear the split it was asked to set.
|
||||
func yaesuSplitCommand(cmd, vfo string, on bool) string {
|
||||
if cmd == "ST" {
|
||||
if on {
|
||||
return "ST1;"
|
||||
}
|
||||
return "ST0;"
|
||||
}
|
||||
onSub := strings.HasPrefix(strings.ToUpper(vfo), "B")
|
||||
txOnB := onSub // split off = transmit where we listen
|
||||
if on {
|
||||
txOnB = !onSub
|
||||
}
|
||||
if txOnB {
|
||||
return cmd + "1;"
|
||||
}
|
||||
return cmd + "0;"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user