mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Improve modem audio device logging info
This commit is contained in:
parent
67a2bc8f98
commit
697cb7610a
2 changed files with 8 additions and 4 deletions
|
@ -106,6 +106,7 @@ def fetch_audio_devices(input_devices, output_devices):
|
|||
# FreeData uses the crc as id inside the configuration
|
||||
# SD lib uses a numerical id which is essentially an
|
||||
# index of the device within the list
|
||||
# returns (id, name)
|
||||
def get_device_index_from_crc(crc, isInput: bool):
|
||||
in_devices = []
|
||||
out_devices = []
|
||||
|
@ -119,6 +120,6 @@ def get_device_index_from_crc(crc, isInput: bool):
|
|||
|
||||
for i, dev in enumerate(detected_devices):
|
||||
if dev['id'] == crc:
|
||||
return i
|
||||
return (i, dev['name'])
|
||||
|
||||
raise Exception("Audio device %s not detected." % crc)
|
||||
|
|
|
@ -191,8 +191,10 @@ class RF:
|
|||
# --------------------------------------------CREATE PORTAUDIO INSTANCE
|
||||
if not TESTMODE and not HamlibParam.hamlib_radiocontrol in ["tci"]:
|
||||
try:
|
||||
in_dev_index = audio.get_device_index_from_crc(self.audio_input_device, True)
|
||||
out_dev_index = audio.get_device_index_from_crc(self.audio_output_device, False)
|
||||
(in_dev_index, in_dev_name) = audio.get_device_index_from_crc(
|
||||
self.audio_input_device, True)
|
||||
(out_dev_index, out_dev_name) = audio.get_device_index_from_crc(
|
||||
self.audio_output_device, False)
|
||||
|
||||
self.stream = sd.RawStream(
|
||||
channels=1,
|
||||
|
@ -203,7 +205,8 @@ class RF:
|
|||
blocksize=4800,
|
||||
)
|
||||
atexit.register(self.stream.stop)
|
||||
self.log.info("[MDM] init: opened audio devices")
|
||||
self.log.info("[MDM] init: receiving audio from '%s'" % in_dev_name)
|
||||
self.log.info("[MDM] init: transmiting audio on '%s'" % out_dev_name)
|
||||
except Exception as err:
|
||||
self.log.error("[MDM] init: can't open audio device. Exit", e=err)
|
||||
# TODO Disabled sys.exit in case of wrong audio devices. We need to ensure flask server is running.
|
||||
|
|
Loading…
Reference in a new issue