Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
fix/deprecation_warnings
Browse files Browse the repository at this point in the history
silence a couple deprecation warning logs
  • Loading branch information
JarbasAl committed Sep 22, 2023
1 parent 7fb396a commit 645d7ba
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions ovos_listener/mic.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ def __init__(self, loop, watchdog=None):
listener_config = self.config.get('listener') or {}
self.instant_listen = listener_config.get("instant_listen", False)
self.listen_timeout = listener_config.get("listen_timeout", 45)

self.signals_enabled = listener_config.get("enable_signals", False)

self._listen_ts = 0

self.listen_state = ListenerState.WAKEWORD
Expand Down Expand Up @@ -331,7 +334,7 @@ def __init__(self, loop, watchdog=None):
self.recording_timeout_with_silence = listener_config.get('recording_timeout_with_silence', 3.0)
# mic meter settings, will write mic level to ipc, used by debug_cli
# NOTE: this writes a lot to disk, it can be problematic in a sd card if you don't use a tmpfs for ipc
ipc = get_ipc_directory()
ipc = get_ipc_directory(config=self.config)
os.makedirs(ipc, exist_ok=True)
self.mic_level_file = os.path.join(ipc, "mic_level")
self.mic_meter_ipc_enabled = listener_config.get("mic_meter_ipc", True)
Expand Down Expand Up @@ -626,17 +629,19 @@ def _skip_wake_word(self):
self._listen_triggered = False
return True

# Pressing the Mark 1 button can start recording (unless
# it is being used to mean 'stop' instead)
if check_for_signal('buttonPress', 1):
# give other processes time to consume this signal if
# it was meant to be a 'stop'
sleep(0.25)
if check_for_signal('buttonPress'):
# Signal is still here, assume it was intended to
# begin recording
LOG.debug("Button Pressed, wakeword not needed")
return True
# NOTE: signals deprecated in OVOS
if self.signals_enabled:
# Pressing the Mark 1 button can start recording (unless
# it is being used to mean 'stop' instead)
if check_for_signal('buttonPress', 1):
# give other processes time to consume this signal if
# it was meant to be a 'stop'
sleep(0.25)
if check_for_signal('buttonPress'):
# Signal is still here, assume it was intended to
# begin recording
LOG.debug("Button Pressed, wakeword not needed")
return True

return False

Expand Down

0 comments on commit 645d7ba

Please sign in to comment.