feat: a typed watering hole carries its mode; Yaesu RTTY sideband

His log settles the 28.074 case: "SetCATFrequency 28.074 MHz" and the
state still reads mode=USB — nothing sent a mode, so the rig simply
stayed where it was. A spot click has always carried one; a frequency
typed by hand carried none. It now uses the same table and the same
tolerance as a spot (±3 kHz of a known FT8/FT4/JS8 frequency), and only
towards the digital modes: tuning AWAY from one leaves the mode alone,
because there the frequency says nothing about what the operator means.

RTTY on Yaesu is a choice the log cannot make: ADIF records "RTTY" and
the rig has MD06 (RTTY-L) and MD09 (RTTY-U). The older lower sideband
stays the default and a station whose FSK controller wants the upper one
says so once in Settings → CAT.
This commit is contained in:
2026-09-06 23:01:08 +02:00
parent 3745d23339
commit 9ce7cf3b69
8 changed files with 97 additions and 13 deletions
+21 -4
View File
@@ -108,8 +108,10 @@ type Yaesu struct {
// and VS is used — see ReadState.
rxVFOCmd string
// freqDigits is how many digits this rig writes a frequency in, LEARNED from
// its own replies. See setFreqWidth.
// its own replies. See learnFreqWidth.
freqDigits int
// rttyUpper picks RTTY-U over RTTY-L — see SetRTTYUpper.
rttyUpper bool
curFreq int64
curRXFreq int64
@@ -140,6 +142,18 @@ func NewYaesu(portName string, baud int, digital string) *Yaesu {
return &Yaesu{portName: strings.TrimSpace(portName), baud: baud, digital: digital, curVFO: "A"}
}
// SetRTTYUpper chooses which sideband RTTY is set on.
//
// Yaesu has both — MD06 is RTTY-L, MD09 is RTTY-U — and ADIF has neither: it
// says "RTTY" and stops there, so the rig cannot be driven from the logged mode
// alone. LSB is the older convention and stays the default; an operator whose
// FSK controller or decoder wants the other one says so once here.
func (y *Yaesu) SetRTTYUpper(v bool) {
y.mu.Lock()
defer y.mu.Unlock()
y.rttyUpper = v
}
// SetLowerLines chooses whether DTR and RTS are deasserted on connect. Set
// before Connect.
func (y *Yaesu) SetLowerLines(v bool) {
@@ -375,7 +389,7 @@ func (y *Yaesu) SetMode(mode string) error {
if y.port == nil {
return fmt.Errorf("yaesu: not connected")
}
d := yaesuModeDigit(mode, y.curFreq)
d := yaesuModeDigit(mode, y.curFreq, y.rttyUpper)
if d == 0 {
return fmt.Errorf("yaesu: no CAT mode for %q", mode)
}
@@ -608,7 +622,7 @@ func resolveYaesuVFOs(freqA, freqB int64, vfo string, split bool) (tx, rx int64,
// yaesuModeDigit maps an ADIF mode to the MD digit. SSB has no single digit —
// the sideband follows the worldwide convention (LSB below 10 MHz, USB above),
// which is why the current frequency is part of the decision.
func yaesuModeDigit(mode string, freqHz int64) byte {
func yaesuModeDigit(mode string, freqHz int64, rttyUpper bool) byte {
switch strings.ToUpper(strings.TrimSpace(mode)) {
case "SSB":
if freqHz > 0 && freqHz < 10_000_000 {
@@ -626,7 +640,10 @@ func yaesuModeDigit(mode string, freqHz int64) byte {
case "AM":
return '5'
case "RTTY":
return '6'
if rttyUpper {
return '9' // RTTY-U
}
return '6' // RTTY-L, the older convention
case "":
return 0
default: