Skip to content

m17-gateway: hold reflector voice while the gateway speaks - #12

Merged
jancona merged 1 commit into
jancona:masterfrom
turnrye:up/02-hold-voice-while-speaking
Oct 13, 2026
Merged

jancona merged 1 commit into
jancona:masterfrom
turnrye:up/02-hold-voice-while-speaking

Conversation

@turnrye

@turnrye turnrye commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

On a busy reflector module, the gateway's own voice (the INFO reply, an ECHO playback) fought incoming reflector voice for the transmitter, chopping both up. Now reflector voice waits while the gateway speaks, as it already does for a local radio, and rejoins with a fresh LSF afterwards.

Change

  • TransmitVoiceStream also holds reflector voice while ownTX > 0; playMessage and echoStreamEnd take the hold with defer g.holdVoice()().
  • ownTX is a counter, since holds can overlap. The hold log line names its reason.
  • Not covered: a reflector frame already inside the modem when a hold starts can still overlap the gateway's first frame, because the drivers don't serialize TransmitVoiceStream callers.

Testing

  • go test ./... and go test -race ./cmd/m17-gateway/ pass.
  • TestOwnVoiceNotInterrupted (announcement, echo) fails on master with interleaved frames ([0 256 1 257 …]) and passes here. TestNetVoiceWaitsForSpeaking covers overlapping holds.
  • To reproduce on master: on a busy module, key up to #INFO and unkey.
  • On air: Raspberry Pi Zero 2 W with a CC1200 HAT, simplex.
    • Before the same change on my fork, an announcement over a busy module caused 90 stream switches and CC1200 command timeouts.
    • After it, announcements went out whole and reflector voice resumed after them.

The gateway's own voice, an announcement such as the INFO reply or an
echo playback, went out while reflector voice did. The two streams took
the transmitter from each other frame by frame, each switch with an EOT
and a new LSF, and the audio of both was mixed. Reflector voice is now
held while the gateway speaks, as it already is for local RF, and joined
with a fresh LSF afterwards. Holds are counted, as they can overlap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jancona
jancona merged commit 2684e9f into jancona:master Oct 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants