Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use float seconds timeout #6

Merged
merged 1 commit into from Mar 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions adafruit_soundboard.py
Expand Up @@ -61,7 +61,7 @@
#: timeout in the |UART|_ class, which is 1000 (1 second). Setting a low
#: timeout greatly improves the performance in the absence of an ``any()``
#: method in |UART|_.
UART_TIMEOUT = 30
UART_TIMEOUT = 0.030


class Soundboard:
Expand Down Expand Up @@ -121,8 +121,8 @@ def __init__(self, uart_tx, uart_rx, rst_pin=None, *, vol=None, orig_get_files=F

if not isinstance(timeout, int):
timeout = UART_TIMEOUT
elif timeout > 1000 or timeout < 1:
timeout = 1000
elif timeout > 1 or timeout < 0.001:
timeout = 1

uart_kwargs['baudrate'] = SB_BAUD
uart_kwargs['timeout'] = timeout
Expand Down