Skip to content

Commit 3b81094

Browse files
committed
fix: hanging on begin waiting for 1st ack 0x00
1 parent 5281368 commit 3b81094

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arduino_alvik/arduino_alvik.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(self):
6767
self._bottom_tof = None
6868
self._linear_velocity = None
6969
self._angular_velocity = None
70-
self._last_ack = ''
70+
self._last_ack = None
7171
self._waiting_ack = None
7272
self._version = [None, None, None]
7373
self._touch_events = _ArduinoAlvikTouchEvents()
@@ -200,6 +200,7 @@ def _wait_for_ack(self) -> None:
200200
Waits until receives 0x00 ack from robot
201201
:return:
202202
"""
203+
self._waiting_ack = 0x00
203204
while self._last_ack != 0x00:
204205
sleep_ms(20)
205206

@@ -618,10 +619,10 @@ def _parse_message(self) -> int:
618619
_, self._linear_velocity, self._angular_velocity = self._packeter.unpacketC2F()
619620
elif code == ord('x'):
620621
# robot ack
621-
_, ack = self._packeter.unpacketC1B()
622622
if self._waiting_ack is not None:
623-
self._last_ack = ack
623+
_, self._last_ack = self._packeter.unpacketC1B()
624624
else:
625+
self._packeter.unpacketC1B()
625626
self._last_ack = 0x00
626627
elif code == ord('z'):
627628
# robot ack

0 commit comments

Comments
 (0)