Skip to content

Us the same link instance in send_packet() - #607

Open
ArisMorgens wants to merge 1 commit into
masterfrom
Aris/send_packet-link
Open

Us the same link instance in send_packet()#607
ArisMorgens wants to merge 1 commit into
masterfrom
Aris/send_packet-link

Conversation

@ArisMorgens

Copy link
Copy Markdown
Member

When flashing a Crazyflie 2.0 via cfclient, most of the times the process got stuck in "identifying decks to update", with this error:

crazyflie-lib-python/cflib/crazyflie/__init__.py", line 390, in send_packet
    self.link.send_packet(pk)
    ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send_packet'

This was caused by send_packet() reading self.link twice: first in if self.link is not None: , and then in elf.link.send_packet(pk). Between these reads, other threads (e.g. close_link()) can set the link to None.

This PR fixes that by reading self.link only once, so the commands in send_packet() will always agree.

@ArisMorgens
ArisMorgens requested a review from gemenerik August 26, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant