fix(icom): a disconnected radio says so, not 'use the USB sound card'

The TX-audio entry points type-assert the transport; a nil port failed the
assertion and produced the sound-card message, sending an operator whose
radio was simply off — or on a new DHCP address — hunting through audio
devices.
This commit is contained in:
2026-08-30 01:36:37 +02:00
parent da8f60a7b3
commit 77aba73096
+9
View File
@@ -2072,6 +2072,12 @@ func (b *IcomSerial) PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan str
// from (IcomDo); at worst a reconnect leaves this one connection stale, and // from (IcomDo); at worst a reconnect leaves this one connection stale, and
// a stale transport fails fast on its closed done channel. // a stale transport fails fast on its closed done channel.
port := b.port port := b.port
// A nil port fails the assertions below too — and used to fail them with
// the sound-card message, sending an operator whose radio was simply OFF
// hunting through their audio devices.
if port == nil {
return fmt.Errorf("not connected to the radio — check the CAT link")
}
type txPlayer interface { type txPlayer interface {
PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan struct{}) error PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan struct{}) error
} }
@@ -2085,6 +2091,9 @@ func (b *IcomSerial) PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan str
// rig is reached over one. // rig is reached over one.
func (b *IcomSerial) TXAudioSender() (func([]byte) error, error) { func (b *IcomSerial) TXAudioSender() (func([]byte) error, error) {
port := b.port port := b.port
if port == nil {
return nil, fmt.Errorf("not connected to the radio — check the CAT link")
}
type sender interface { type sender interface {
TXAudioSender() (func([]byte) error, error) TXAudioSender() (func([]byte) error, error)
} }