mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-16 20:39:12 +02:00
Update DOCS.md
This commit is contained in:
@@ -452,6 +452,7 @@ NOISE_THRESHOLD_LOW = 0.001
|
|||||||
# No-signal detection
|
# No-signal detection
|
||||||
NO_SIGNAL_THRESHOLD = 1e-6
|
NO_SIGNAL_THRESHOLD = 1e-6
|
||||||
NO_SIGNAL_COUNT_THRESHOLD = 3
|
NO_SIGNAL_COUNT_THRESHOLD = 3
|
||||||
|
NO_SIGNAL_ACTION = "scarlett2 reboot && sudo reboot"
|
||||||
|
|
||||||
SAMPLING_RATE = 48000 # 48 kHz
|
SAMPLING_RATE = 48000 # 48 kHz
|
||||||
LOWCUT = 2000
|
LOWCUT = 2000
|
||||||
@@ -674,7 +675,7 @@ def test_mode():
|
|||||||
# ---------------------- Dynamic Gain Control Loop ----------------------
|
# ---------------------- Dynamic Gain Control Loop ----------------------
|
||||||
|
|
||||||
def dynamic_gain_control():
|
def dynamic_gain_control():
|
||||||
debug_print("Starting dynamic gain controller...")
|
debug_print("Starting dynamic gain controller...", "info")
|
||||||
set_gain_db(MICROPHONE_NAME, (MIN_GAIN_DB + MAX_GAIN_DB) // 2)
|
set_gain_db(MICROPHONE_NAME, (MIN_GAIN_DB + MAX_GAIN_DB) // 2)
|
||||||
|
|
||||||
no_signal_count = 0
|
no_signal_count = 0
|
||||||
@@ -695,8 +696,8 @@ def dynamic_gain_control():
|
|||||||
no_signal_count += 1
|
no_signal_count += 1
|
||||||
debug_print(f"No signal detected ({no_signal_count}/{NO_SIGNAL_COUNT_THRESHOLD})", "warning")
|
debug_print(f"No signal detected ({no_signal_count}/{NO_SIGNAL_COUNT_THRESHOLD})", "warning")
|
||||||
if no_signal_count >= NO_SIGNAL_COUNT_THRESHOLD:
|
if no_signal_count >= NO_SIGNAL_COUNT_THRESHOLD:
|
||||||
debug_print("No signal for too long, rebooting Scarlett + system...", "error")
|
debug_print("No signal for too long, executing action...", "error")
|
||||||
subprocess.call("scarlett2 reboot && sudo reboot", shell=True)
|
subprocess.call(NO_SIGNAL_ACTION, shell=True)
|
||||||
else:
|
else:
|
||||||
no_signal_count = 0
|
no_signal_count = 0
|
||||||
|
|
||||||
@@ -737,6 +738,7 @@ def main():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
Reference in New Issue
Block a user