Alternate CQ between the two radios

Ctrl+B calls CQ on one radio, and when that message has gone out, moves to the
other and calls there. The keyboard, the entry window and the SO2R box follow
each turn. N1MM calls this dueling CQs and puts it on the same key.

The turn is taken when the keyer says the message has ended, not when a timer
guesses it has. So MessageSender grew a Finished event and a ReportsCompletion
flag, and both keyers fill them in: cwdaemon answers the <ESC>h reply request
that now goes out in front of every message, and a WinKeyer clears the busy bit
in the status bytes it sends of its own accord. The status-byte reading is in
WinkeyerStatus, away from the serial port, because that is the half that can be
tested without a keyer on the desk. A keyer that reports nothing refuses to
start alternating CQ rather than keying the second radio over the first.

AlternatingCq itself takes the keyer, a callback that calls CQ on a radio, the
gap and a wait function, so the alternation is tested without sleeping. The gap
is in Config ▸ Keyer and messages and will not go below 100 ms, which is N1MM's
floor too: an SO2R box works relays.

docs/keying.md writes down why cwdaemon does the timing and we do not. N1MM
keys DTR itself with a coarse sleep, a busy-wait and a margin that grows every
time the sleep overshoots, and it raises the thread to TIME_CRITICAL for the
length of the message. The busy-wait ports to Linux; the priority does not,
without CAP_SYS_NICE, and a garbage collection mid-element is audible. A direct
serial keyer stays a reasonable third option, to be taken knowingly.

Running it against a fake daemon that takes 1.5 seconds to play a message: six
CQs went out back to back and the keyboard moved between the two entry windows
each time. Escape stopped it, let the message in flight finish, and started
nothing further.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-27 23:28:57 +00:00
parent d084789ed2
commit ae48c04e71
17 changed files with 721 additions and 18 deletions

View File

@@ -208,7 +208,27 @@ out, so a message cannot go out of the radio you have just left. A command that
would change nothing is not sent, because the box works relays. Without a box
the logger just keeps track of which radio it is on and you switch by hand.
Not there yet: alternating CQ, and voice keying on the second radio.
Not there yet: voice keying on the second radio.
### Alternating CQ
**Ctrl+B** calls CQ on one radio, and when that message has gone out, moves to
the other radio and calls there, until Escape or another Ctrl+B. The keyboard,
the entry window and the SO2R box follow each turn. N1MM calls this dueling CQs
and puts it on the same key.
It runs off the keyer saying the message has gone out, not off a guess at how
long the text takes: `cwdaemon` answers the `<ESC>h` reply request, and a
WinKeyer clears the busy bit in its status byte. A keyer that cannot report this
cannot drive alternating CQ, and says so rather than keying the second radio
while the first is still sending. **Config → Keyer and messages** sets the gap
between the two, which is 100 ms by default because an SO2R box works relays.
CW only for now: it sends the F1 message, and there is no voice keyer.
Why the keying is `cwdaemon`'s job rather than the logger's, and what it would
take to key the port directly as N1MM does, is in
[`docs/keying.md`](docs/keying.md).
### The bandmap