Skip to content

Commit

Permalink
Disable socket timeouts while in the simulator to allow for pausing
Browse files Browse the repository at this point in the history
  • Loading branch information
WillB97 committed Jun 29, 2024
1 parent 9ce0649 commit e7b292b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions sbot/serial_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
RetType = TypeVar("RetType")

E = TypeVar("E", bound=BaseException)
BASE_TIMEOUT: float | None

if IN_SIMULATOR:
BASE_TIMEOUT = 5.0
BASE_TIMEOUT = None # Disable timeouts while in the simulator to allow for pausing
else:
BASE_TIMEOUT = 0.5

Expand Down Expand Up @@ -85,7 +86,7 @@ def __init__(
self,
port: str,
baud: int,
timeout: float = BASE_TIMEOUT,
timeout: float | None = BASE_TIMEOUT,
identity: BoardIdentity = BoardIdentity(),
delay_after_connect: float = 0,
):
Expand Down
2 changes: 1 addition & 1 deletion sbot/simulator/time_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
BAUDRATE,
identity=initial_identity,
# Disable the timeout so sleep works properly
timeout=None, # type: ignore[arg-type]
timeout=None,
)

self._identity = self.identify()
Expand Down

0 comments on commit e7b292b

Please sign in to comment.