Skip to content
Open
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
7 changes: 4 additions & 3 deletions cflib/crazyflie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,10 @@ def send_packet(self, pk, expected_reply=(), resend=False, timeout=0.2):
raise Exception('Data part of packet is too large')

self._send_lock.acquire()
if self.link is not None:
link = self.link
if link is not None:
if len(expected_reply) > 0 and not resend and \
self.link.needs_resending:
link.needs_resending:
pattern = (pk.header,) + expected_reply
logger.debug(
'Sending packet and expecting the %s pattern back',
Expand All @@ -387,7 +388,7 @@ def send_packet(self, pk, expected_reply=(), resend=False, timeout=0.2):
else:
logger.debug('Resend requested, but no pattern found: %s',
self._answer_patterns)
self.link.send_packet(pk)
link.send_packet(pk)
self.packet_sent.call(pk)
self._send_lock.release()

Expand Down
Loading