fix(catshare): echo PTT state so JTDX doesn't drop transmit

JTDX polls get_ptt DURING transmit to confirm the rig is keyed (WSJT-X does not,
which is why it worked and JTDX cut after ~2 s). We answered a blanket "0" (RX),
so JTDX concluded PTT had failed and dropped the over. get_ptt now echoes the
last PTT state commanded via set_ptt — always consistent with the client's own
command. Trace showed T 1 → three t→"0" polls → T 0.
This commit is contained in:
2026-08-05 09:55:27 +02:00
parent b9ea077a64
commit 9f5c482667
3 changed files with 39 additions and 6 deletions
+2 -2
View File
@@ -6,13 +6,13 @@
"Log viewer: the window now keeps twice as much history (512 KB instead of 256 KB, ~3200 lines). During a busy trace the oldest lines used to scroll out of the buffer while you were still reading them; the larger window holds them.", "Log viewer: the window now keeps twice as much history (512 KB instead of 256 KB, ~3200 lines). During a busy trace the oldest lines used to scroll out of the buffer while you were still reading them; the larger window holds them.",
"Ultrabeam over a remote link: fixed intermittent connection drops, phantom frequency jumps and wrong element-length readings. On a slow link a command that timed out left its late reply in the stream, and the next command read it as its own — crossing a status query with an element-length one, for instance. The stream is now flushed of any stale reply before each command, keeping the exchange in step.", "Ultrabeam over a remote link: fixed intermittent connection drops, phantom frequency jumps and wrong element-length readings. On a slow link a command that timed out left its late reply in the stream, and the next command read it as its own — crossing a status query with an element-length one, for instance. The stream is now flushed of any stale reply before each command, keeping the exchange in step.",
"Ultrabeam: the 'moving' indicator and the Flex TX-inhibit now react the instant you click a band or pattern, instead of up to a status poll (~2 s) later. A commanded move reports motion immediately; the real motor state takes over once the next poll reads it.", "Ultrabeam: the 'moving' indicator and the Flex TX-inhibit now react the instant you click a band or pattern, instead of up to a status poll (~2 s) later. A commanded move reports motion immediately; the real motor state takes over once the next poll reads it.",
"CAT sharing (FT8): reverted the 0.23.5 'Fake It' drift tweak — it stopped JTDX/WSJT-X from going into transmit. Shared frequency reads report the rig's live value again. The small dial creep in 'Fake It' split can return; switching JTDX to 'Split Operation: None' (or Rig) avoids it." "CAT sharing (FT8): JTDX/WSJT-X transmit correctly again through OpsLog's shared rig. get_ptt now echoes the PTT state the client last commanded — clients poll it DURING transmit to confirm the rig is keyed, and OpsLog always answering 'receiving' made them give up and drop the over after a second or two. The 0.23.5 'Fake It' anti-drift tweak was also reverted (it had made this total — no transmit at all); the small dial creep in 'Fake It' split can return, and JTDX's 'Split Operation: None' avoids it."
], ],
"fr": [ "fr": [
"Visionneuse de log : la fenêtre conserve deux fois plus d'historique (512 Ko au lieu de 256 Ko, ~3200 lignes). Lors d'une trace chargée, les plus vieilles lignes défilaient hors du buffer pendant qu'on les lisait encore ; la fenêtre agrandie les garde.", "Visionneuse de log : la fenêtre conserve deux fois plus d'historique (512 Ko au lieu de 256 Ko, ~3200 lignes). Lors d'une trace chargée, les plus vieilles lignes défilaient hors du buffer pendant qu'on les lisait encore ; la fenêtre agrandie les garde.",
"Ultrabeam en remote : coupures de connexion intermittentes, sauts de fréquence fantômes et longueurs d'éléments erronées corrigés. Sur un lien lent, une commande qui expirait laissait sa réponse tardive dans le flux, et la commande suivante la lisait comme la sienne — croisant par exemple une requête de statut avec une requête de longueurs d'éléments. Le flux est désormais vidé de toute réponse périmée avant chaque commande, gardant l'échange synchronisé.", "Ultrabeam en remote : coupures de connexion intermittentes, sauts de fréquence fantômes et longueurs d'éléments erronées corrigés. Sur un lien lent, une commande qui expirait laissait sa réponse tardive dans le flux, et la commande suivante la lisait comme la sienne — croisant par exemple une requête de statut avec une requête de longueurs d'éléments. Le flux est désormais vidé de toute réponse périmée avant chaque commande, gardant l'échange synchronisé.",
"Ultrabeam : l'indicateur « en mouvement » et l'inhibition d'émission Flex réagissent désormais dès que vous cliquez sur une bande ou un diagramme, au lieu d'attendre jusqu'à un poll de statut (~2 s). Un mouvement commandé signale le déplacement immédiatement ; l'état réel des moteurs prend le relais dès le poll suivant.", "Ultrabeam : l'indicateur « en mouvement » et l'inhibition d'émission Flex réagissent désormais dès que vous cliquez sur une bande ou un diagramme, au lieu d'attendre jusqu'à un poll de statut (~2 s). Un mouvement commandé signale le déplacement immédiatement ; l'état réel des moteurs prend le relais dès le poll suivant.",
"Partage CAT (FT8) : annulation de l'ajustement anti-drift « Fake It » de la 0.23.5 — il empêchait JTDX/WSJT-X de passer en émission. Les lectures de fréquence partagée renvoient de nouveau la valeur live de la radio. Le léger glissement du VFO en split « Fake It » peut réapparaître ; passer JTDX en « Split Operation : None » (ou Rig) l'évite." "Partage CAT (FT8) : JTDX/WSJT-X émettent de nouveau correctement via la radio partagée d'OpsLog. get_ptt renvoie désormais l'état PTT commandé en dernier par le client — les clients l'interrogent PENDANT l'émission pour confirmer que la radio est en émission, et comme OpsLog répondait toujours « réception », ils abandonnaient et coupaient l'émission au bout d'une seconde ou deux. L'ajustement anti-drift « Fake It » de la 0.23.5 a aussi été annulé (il rendait le problème total — aucune émission) ; le léger glissement du VFO en split « Fake It » peut réapparaître, et « Split Operation : None » dans JTDX l'évite."
] ]
}, },
{ {
+15 -4
View File
@@ -36,6 +36,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"sync/atomic"
"time" "time"
) )
@@ -59,6 +60,13 @@ type Server struct {
ln net.Listener ln net.Listener
conns map[net.Conn]struct{} conns map[net.Conn]struct{}
closed bool closed bool
// ptt mirrors the last PTT state a client commanded via set_ptt. WSJT-X/JTDX
// poll get_ptt DURING transmit to confirm the rig is keyed; if get_ptt reads
// RX they conclude PTT failed and abort the over after a second or two. We
// don't read PTT back from every backend, so echo what the client last set —
// always consistent with its own command, and enough to satisfy the check.
ptt atomic.Bool
} }
func New(port int, rig Rig, logf func(string, ...any)) *Server { func New(port int, rig Rig, logf func(string, ...any)) *Server {
@@ -228,10 +236,12 @@ func (s *Server) handle(line string) (resp string, quit bool) {
return rprt(0), false return rprt(0), false
case "t", "\\get_ptt": case "t", "\\get_ptt":
// We do not read PTT back from every backend, and answering "transmitting" // Echo the last commanded PTT state. WSJT-X/JTDX poll this WHILE
// wrongly would make a client hold off for ever. Reporting RX is the safe // transmitting to confirm the rig is keyed; answering a blanket "0" (RX)
// direction: the worst case is a client that transmits when we said it // made them decide PTT had failed and abort the over after ~1-2 s.
// could, which is what it was going to do anyway. if s.ptt.Load() {
return "1\n", false
}
return "0\n", false return "0\n", false
case "T", "\\set_ptt": case "T", "\\set_ptt":
if len(args) < 1 { if len(args) < 1 {
@@ -242,6 +252,7 @@ func (s *Server) handle(line string) (resp string, quit bool) {
s.log("rigctld: set_ptt %v failed: %v", on, err) s.log("rigctld: set_ptt %v failed: %v", on, err)
return rprt(-9), false return rprt(-9), false
} }
s.ptt.Store(on)
return rprt(0), false return rprt(0), false
case "v", "\\get_vfo": case "v", "\\get_vfo":
+22
View File
@@ -138,6 +138,28 @@ func TestHandleReportsBackendFailure(t *testing.T) {
} }
} }
// get_ptt must echo the last commanded PTT state. WSJT-X/JTDX poll get_ptt while
// transmitting to confirm the rig is keyed; a blanket "0" made them decide PTT
// had failed and abort the over after a second or two.
func TestGetPTTEchoesSetPTT(t *testing.T) {
s := New(0, &fakeRig{}, nil)
if got, _ := s.handle("t"); got != "0\n" {
t.Fatalf("initial get_ptt = %q, want 0", got)
}
if got, _ := s.handle("T 1"); got != "RPRT 0\n" {
t.Fatalf("set_ptt 1 = %q, want RPRT 0", got)
}
if got, _ := s.handle("t"); got != "1\n" {
t.Fatalf("get_ptt after T 1 = %q, want 1 — client would abort TX", got)
}
if got, _ := s.handle("T 0"); got != "RPRT 0\n" {
t.Fatalf("set_ptt 0 = %q, want RPRT 0", got)
}
if got, _ := s.handle("t"); got != "0\n" {
t.Fatalf("get_ptt after T 0 = %q, want 0", got)
}
}
// dump_state is parsed POSITIONALLY by Hamlib clients: WSJT-X reads the first // dump_state is parsed POSITIONALLY by Hamlib clients: WSJT-X reads the first
// line as the protocol version and refuses to continue if the block is short or // line as the protocol version and refuses to continue if the block is short or
// misshapen. Pinning its shape is what stops a well-meaning edit from silently // misshapen. Pinning its shape is what stops a well-meaning edit from silently