fix(cat): read MD6 back as DATA on an Elecraft, not RTTY

MD6 is FSK on a Kenwood and DATA on a K3/K4. kenwoodModeToADIF decoded the
digit unconditionally as RTTY, so OpsLog contradicted the mode it had just
set: SetMode writes MD6 for a digital mode on an Elecraft, then ReadState
parsed the IF frame back as RTTY.

A K3 running FT8 therefore showed RTTY in the status bar, logged its QSOs on
RTTY, and — through the shared CAT server — told WSJT-X/JTDX the rig sat in
RTTY while they had just asked for a data mode. Found in a K3 operator's log:
every cat:state line read mode=RTTY on 21.074 FT8, two lines after OpsLog's
own "MD6;".

The digit now resolves to the configured digital mode whenever MD6 means DATA
on this rig — the Elecraft backend, and the "DATA A - MD6" data-mode option
that exists for it. A plain Kenwood still reads MD6 as RTTY.
This commit is contained in:
2026-08-08 20:13:45 +02:00
parent 4d13cf7d15
commit 18f44a5aa3
3 changed files with 38 additions and 5 deletions
+18 -2
View File
@@ -291,7 +291,10 @@ func (k *Kenwood) ReadState() (RigState, error) {
s := RigState{Connected: true, Backend: "kenwood"}
k.curVFO = f.VFO
s.Vfo = f.VFO
s.Mode = kenwoodModeToADIF(f.Mode, k.digital)
// Both branches of SetMode that emit MD6 identify a K3/K4: the Elecraft
// backend, and the "MD6" data-mode option that exists for it. Decode the
// read-back the same way, or OpsLog contradicts the mode it just set.
s.Mode = kenwoodModeToADIF(f.Mode, k.digital, k.elecraft || k.dataMode == "data")
s.Rig = k.model
// IF reports the frequency of the VFO in USE (what the operator hears).
@@ -659,7 +662,11 @@ func kenwoodModeDigit(mode string, hz int64) byte {
// Digital modes are indistinguishable from SSB over CAT — the rig only knows
// it is on USB — so the operator's configured digital mode is used, exactly as
// the other backends do.
func kenwoodModeToADIF(d byte, digital string) string {
//
// md6IsData says whether MD6 means DATA on THIS rig — true for an Elecraft
// (the K3/K4 backend, and the "MD6" data-mode option that targets it), false
// for a plain Kenwood. See below.
func kenwoodModeToADIF(d byte, digital string, md6IsData bool) string {
switch d {
case '1':
return "LSB"
@@ -672,6 +679,15 @@ func kenwoodModeToADIF(d byte, digital string) string {
case '5':
return "AM"
case '6', '9':
// One digit, two meanings. On a Kenwood MD6/MD9 is FSK/FSK-R; on an
// Elecraft it is DATA / DATA-REV — and DATA is precisely what SetMode
// puts a K3/K4 into for FT8. Reading it straight back as RTTY meant a K3
// running FT8 reported RTTY: the QSO was logged on the wrong mode, and
// the shared CAT link told WSJT-X/JTDX the rig sat in RTTY while they had
// asked for a data mode.
if md6IsData {
return digital
}
return "RTTY"
}
return ""