Files
OpsLog/internal/cat/tci_test.go
T
rouggy 766b0f95a4 feat(tci): key CW through the radio's own macro keyer
The sixth CW engine, and the one the TCI backend was left without. A SunSDR
keys from the WebSocket that already carries the CAT: no WinKeyer, no second
serial port, nothing to wire.

    CW_MACROS:0,<text>;     send
    CW_MACROS_SPEED:<wpm>;  speed
    CW_MACROS_STOP;         abort

Confirmed against the TCI command table in ars-ka0s/eesdr-tci — the source that
settled SPOT. CW_MACROS rather than TCI 2.0's CW_MSG: it exists from 1.6, and
OpsLog resolves its own variables, so the before/after callsign fields have
nothing to carry.

Commas and semicolons are stripped before sending. They are the protocol's own
separators: a comma would become another argument, a semicolon would end the
command with the message half keyed and the rest parsed as a command.

Only the MACRO speed is set, not the paddle keyer's — an operator who set their
paddle to 28 wpm did not ask for it to change because a macro went out at 25.
And there is no backspace: TCI can stop a message but cannot un-type one, so the
type-ahead correction the Flex engine offers is absent rather than faked.
2026-08-28 13:01:55 +02:00

42 lines
1.2 KiB
Go

package cat
import "testing"
func TestTCISpotsUnsupported(t *testing.T) {
// SPOT arrived in TCI 1.5. The SunSDR2 PRO report that prompted this was an
// ExpertSDR announcing 1.3 — spots accepted and silently dropped.
for _, c := range []struct {
version string
old bool
}{
{"1.3", true},
{"1.4", true},
{"1.5", false},
{"1.9", false},
{"2.0", false},
{"", false}, // unparseable → assume it works
{"weird", false}, // refusing to draw on a doubt is the worse mistake
} {
if got := tciSpotsUnsupported(c.version); got != c.old {
t.Errorf("tciSpotsUnsupported(%q) = %v, want %v", c.version, got, c.old)
}
}
}
func TestSanitiseTCICW(t *testing.T) {
// The separators must never survive: a comma would become another argument
// and a semicolon would end the command with the message half sent.
for _, c := range []struct{ in, want string }{
{"cq cq de f4bpo", "CQ CQ DE F4BPO"},
{" tu 599 ", "TU 599"},
{"73, gl", "73 GL"},
{"test;cw_macros_stop", "TEST CW_MACROS_STOP"},
{"line\r\nbreak", "LINE BREAK"},
{" ", ""},
} {
if got := sanitiseTCICW(c.in); got != c.want {
t.Errorf("sanitiseTCICW(%q) = %q, want %q", c.in, got, c.want)
}
}
}