feat(cat): distinct Elecraft K3/K4 backend in the rig list

The Elecraft handling was buried in the Kenwood "data mode" option, so users
couldn't find it. Add "Elecraft K3/K4" as its own entry in the CAT backend
selector. It reuses the Kenwood-dialect transport and the Kenwood USB/network
settings (the K3 emulates the Kenwood command set — a separate transport would be
a near-total duplicate), with an `elecraft` flag on the client that forces
digital modes to DATA A (MD6+DT0) — no data-mode dropdown needed. RigState still
reports Backend "kenwood" so the CW-over-CAT keyer capability keeps working.
This commit is contained in:
2026-08-08 14:15:55 +02:00
parent 626edca8ba
commit 9c757e5175
5 changed files with 56 additions and 15 deletions
+20
View File
@@ -62,6 +62,10 @@ type Kenwood struct {
// leave the rig's current mode untouched (safest for a TS-590SG/TS-990S whose
// data mode is a USB modifier the operator sets on the rig). See SetMode.
dataMode string
// elecraft marks a K3/K4 (the "Elecraft" backend). It reuses this Kenwood-dialect
// client but, being an Elecraft, always drives digital modes to DATA A (MD6+DT0)
// — the sub-mode FT8 audio needs — instead of going through the dataMode option.
elecraft bool
mu sync.Mutex
port serial.Port
@@ -391,6 +395,14 @@ func (k *Kenwood) SetMode(mode string) error {
// mode digit fits every rig, so the operator picks: keep the rig's mode, use
// MD6 (K3/K4 DATA), or fall through to the default USB from kenwoodModeDigit.
if isKenwoodDataMode(mode) {
// An Elecraft always uses DATA A for a soundcard digital mode — that's what
// the "Elecraft" backend means, so the dataMode option doesn't apply.
if k.elecraft {
if err := k.write("MD6;"); err != nil {
return err
}
return k.write("DT0;")
}
switch k.dataMode {
case "keep":
return nil // leave whatever data mode the operator set on the rig
@@ -424,6 +436,14 @@ func (k *Kenwood) SetDataMode(m string) {
k.mu.Unlock()
}
// SetElecraft marks this client as driving a K3/K4 (the "Elecraft" backend), so
// digital modes always land in DATA A (MD6+DT0). Set before Start.
func (k *Kenwood) SetElecraft(v bool) {
k.mu.Lock()
k.elecraft = v
k.mu.Unlock()
}
// isKenwoodDataMode reports whether a mode name is a soundcard/data mode (FT8,
// PSK, JT…) rather than a voice/CW/RTTY mode the rig sets natively.
func isKenwoodDataMode(mode string) bool {