Skip to content

feat: _wait_for_fw_check timeout on unavailable FW version #32

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

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion arduino_alvik/arduino_alvik.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,19 @@ def _wait_for_ack(self) -> None:
sleep_ms(20)
self._waiting_ack = None

def _wait_for_fw_check(self) -> bool:
def _wait_for_fw_check(self, timeout=5) -> bool:
"""
Waits until receives version from robot, check required version and return true if everything is ok
:param timeout: wait for fw timeout in seconds
:return:
"""
start = ticks_ms()
while self._fw_version == [None, None, None]:
sleep_ms(20)
if ticks_diff(ticks_ms(), start) < timeout * 1000:
print("Could not get FW version")
return False

if self.check_firmware_compatibility():
return True
else:
Expand Down