feat(cat): per-rig Kenwood/Elecraft data-mode choice (USB / MD6 / keep)
No single Kenwood mode digit fits every rig for a data mode: a K3/K4 wants DATA (MD6), a TS-590SG/TS-990S data mode is a USB modifier set on the rig, and MD6 on a plain Kenwood is FSK/RTTY. So the operator now chooses in Settings → CAT: USB (default), DATA (MD6), or leave the rig's mode unchanged. Only soundcard/data modes (FT8, PSK, JT…) follow this; RTTY/FSK stays its own native mode, and voice/CW are untouched (isKenwoodDataMode + test).
This commit is contained in:
@@ -126,6 +126,7 @@ const (
|
||||
// backend's setting.
|
||||
keyCATYaesuLowLines = "cat.yaesu.low_dtr_rts" // deassert DTR/RTS on connect
|
||||
keyCATKenwoodLowLines = "cat.kenwood.low_dtr_rts" // deassert DTR/RTS on connect
|
||||
keyCATKenwoodDataMode = "cat.kenwood.data_mode" // data modes → "usb" | "data" (MD6) | "keep"
|
||||
keyCATIcomPort = "cat.icom.port" // Icom USB CI-V serial port (e.g. COM5)
|
||||
keyCATIcomBaud = "cat.icom.baud" // Icom CI-V baud (default 115200)
|
||||
keyCATIcomAddr = "cat.icom.addr" // Icom CI-V address, decimal (IC-7610 = 152 / 0x98)
|
||||
@@ -403,6 +404,10 @@ type CATSettings struct {
|
||||
// adapter). NOT the radio’s own RJ45, which speaks Kenwood’s KNS/ARCP.
|
||||
KenwoodPort string `json:"kenwood_port"` // Kenwood CAT serial port (TS-590/890/2000, Elecraft)
|
||||
KenwoodBaud int `json:"kenwood_baud"` // Kenwood CAT baud (TS-590 default 9600)
|
||||
// What a DATA/digital mode (FT8, PSK…) sets on the rig: "usb" (default), "data"
|
||||
// (MD6 — Elecraft K3/K4 DATA mode) or "keep" (leave the rig's mode untouched,
|
||||
// for a TS-590SG/TS-990S whose data mode is a USB modifier set on the rig).
|
||||
KenwoodDataMode string `json:"kenwood_data_mode"`
|
||||
// Per-backend: deassert DTR and RTS after opening the CAT port, for
|
||||
// interfaces that read either line as PTT. Off by default: lowering them
|
||||
// stops some USB-serial interfaces transmitting at all.
|
||||
@@ -6855,7 +6860,7 @@ func (a *App) GetCATSettings() (CATSettings, error) {
|
||||
if a.settings == nil {
|
||||
return CATSettings{Backend: "omnirig", OmniRigNum: 1, PollMs: 250}, fmt.Errorf("db not initialized")
|
||||
}
|
||||
m, err := a.settings.GetMany(a.ctx, keyCATEnabled, keyCATBackend, keyCATOmniRigNum, keyCATOmniRigVFO, keyCATFlexHost, keyCATFlexPort, keyCATFlexSpots, keyCATFlexDecodeSpots, keyCATFlexDecodeSecs, keyCATXieguPort, keyCATXieguBaud, keyCATXieguAddr, keyCATXieguPTTLine, keyCATYaesuPort, keyCATYaesuBaud, keyCATKenwoodPort, keyCATKenwoodBaud, keyCATKenwoodHost, keyCATYaesuLowLines, keyCATKenwoodLowLines, keyCATIcomPort, keyCATIcomBaud, keyCATIcomAddr, keyCATIcomNetHost, keyCATIcomNetUser, keyCATIcomNetPass, keyCATIcomNetAudio, keyCATTCIHost, keyCATTCIPort, keyCATTCISpots, keyCATPttHotkeyEnabled, keyCATPttHotkey, keyCATPttHotkeyToggle, keyCATPollMs, keyCATDelayMs, keyCATDigitalDefault, keyCATShareEnabled, keyCATSharePort)
|
||||
m, err := a.settings.GetMany(a.ctx, keyCATEnabled, keyCATBackend, keyCATOmniRigNum, keyCATOmniRigVFO, keyCATFlexHost, keyCATFlexPort, keyCATFlexSpots, keyCATFlexDecodeSpots, keyCATFlexDecodeSecs, keyCATXieguPort, keyCATXieguBaud, keyCATXieguAddr, keyCATXieguPTTLine, keyCATYaesuPort, keyCATYaesuBaud, keyCATKenwoodPort, keyCATKenwoodBaud, keyCATKenwoodHost, keyCATYaesuLowLines, keyCATKenwoodLowLines, keyCATKenwoodDataMode, keyCATIcomPort, keyCATIcomBaud, keyCATIcomAddr, keyCATIcomNetHost, keyCATIcomNetUser, keyCATIcomNetPass, keyCATIcomNetAudio, keyCATTCIHost, keyCATTCIPort, keyCATTCISpots, keyCATPttHotkeyEnabled, keyCATPttHotkey, keyCATPttHotkeyToggle, keyCATPollMs, keyCATDelayMs, keyCATDigitalDefault, keyCATShareEnabled, keyCATSharePort)
|
||||
if err != nil {
|
||||
return CATSettings{}, err
|
||||
}
|
||||
@@ -6878,6 +6883,7 @@ func (a *App) GetCATSettings() (CATSettings, error) {
|
||||
KenwoodBaud: 9600,
|
||||
YaesuLowLines: m[keyCATYaesuLowLines] == "1",
|
||||
KenwoodLowLines: m[keyCATKenwoodLowLines] == "1",
|
||||
KenwoodDataMode: m[keyCATKenwoodDataMode],
|
||||
IcomPort: m[keyCATIcomPort],
|
||||
IcomBaud: 115200,
|
||||
IcomAddr: 0x98, // IC-7610 default
|
||||
@@ -7047,6 +7053,7 @@ func (a *App) SaveCATSettings(s CATSettings) error {
|
||||
keyCATKenwoodBaud: strconv.Itoa(s.KenwoodBaud),
|
||||
keyCATYaesuLowLines: b01(s.YaesuLowLines),
|
||||
keyCATKenwoodLowLines: b01(s.KenwoodLowLines),
|
||||
keyCATKenwoodDataMode: strings.ToLower(strings.TrimSpace(s.KenwoodDataMode)),
|
||||
keyCATIcomPort: strings.TrimSpace(s.IcomPort),
|
||||
keyCATIcomBaud: strconv.Itoa(s.IcomBaud),
|
||||
keyCATIcomAddr: strconv.Itoa(s.IcomAddr),
|
||||
@@ -12965,10 +12972,13 @@ func (a *App) reloadCAT() {
|
||||
// more deliberate setting, and silently preferring the wire would leave an
|
||||
// operator staring at a host they typed and a radio that never answers.
|
||||
if h := strings.TrimSpace(s.KenwoodHost); h != "" {
|
||||
a.cat.Start(cat.NewKenwoodTCP(h, s.DigitalDefault))
|
||||
kw := cat.NewKenwoodTCP(h, s.DigitalDefault)
|
||||
kw.SetDataMode(s.KenwoodDataMode)
|
||||
a.cat.Start(kw)
|
||||
} else {
|
||||
kw := cat.NewKenwood(s.KenwoodPort, s.KenwoodBaud, s.DigitalDefault)
|
||||
kw.SetLowerLines(s.KenwoodLowLines)
|
||||
kw.SetDataMode(s.KenwoodDataMode)
|
||||
a.cat.Start(kw)
|
||||
}
|
||||
case "icom":
|
||||
|
||||
Reference in New Issue
Block a user