Skip to content

Commit

Permalink
FIX: Reboot should not throw error
Browse files Browse the repository at this point in the history
  • Loading branch information
pe1obw committed May 20, 2024
1 parent d60b9e7 commit 841cef4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions baseband/baseband.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,17 @@ def reboot(self) -> None:
"""
Reboot the Baseband
"""
self._send_command(I2C_ACCESS_COMMAND_REBOOT)
self._send_command(I2C_ACCESS_COMMAND_REBOOT, nowait=True)

def _send_command(self, command: int, param: int = 1) -> None:
def _send_command(self, command: int, param: int = 1, nowait: bool = False) -> None:
"""
Send a command to the baseband and wait until it's executed
"""
POLL_TIMEOUT = 5
POLL_REPEAT_INTERVAL = 0.01
result = self._slave.exchange(command + bytearray([param]), 1)
timeeout = POLL_TIMEOUT
while not result[0] == 0x00 and timeeout > 0:
while (not nowait) and (not result[0] == 0x00) and timeeout > 0:
result = self._slave.exchange(command, 1)
time.sleep(POLL_REPEAT_INTERVAL)
timeeout -= POLL_REPEAT_INTERVAL
Expand Down

0 comments on commit 841cef4

Please sign in to comment.