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:
@@ -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
|
||||
// a stale transport fails fast on its closed done channel.
|
||||
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 {
|
||||
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.
|
||||
func (b *IcomSerial) TXAudioSender() (func([]byte) error, error) {
|
||||
port := b.port
|
||||
if port == nil {
|
||||
return nil, fmt.Errorf("not connected to the radio — check the CAT link")
|
||||
}
|
||||
type sender interface {
|
||||
TXAudioSender() (func([]byte) error, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user