Skip to content

Color LED tab#793

Open
ArisMorgens wants to merge 8 commits intocflib2from
Aris/cflib2/ColorLEDTab
Open

Color LED tab#793
ArisMorgens wants to merge 8 commits intocflib2from
Aris/cflib2/ColorLEDTab

Conversation

@ArisMorgens
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables the Color LED tab in the UI and migrates its Crazyflie interactions to the newer async cflib2-style APIs (async params + log streaming), aligning it with the newer connection model used by other tabs like ParamTab.

Changes:

  • Enabled ColorLEDTab in the tab loader (available list + import).
  • Reworked Color LED deck detection, param writes, and thermal throttling monitoring to use async cflib2 calls and create_task() scheduling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/cfclient/ui/tabs/__init__.py Uncomments/imports ColorLEDTab and adds it to the available tab list so it can be loaded.
src/cfclient/ui/tabs/ColorLEDTab.py Migrates to async cflib2 param/log APIs, adds async connection setup, and implements thermal log stream reading via background tasks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@ArisMorgens ArisMorgens changed the title Added a cflib2-based Color LED tab Color LED tab Mar 12, 2026
@gemenerik gemenerik requested a review from Copilot March 23, 2026 13:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gemenerik
Copy link
Copy Markdown
Member

image

Custom colors are not grayed out when disconnected. (They may not have been in the old client, but anyways)

@ArisMorgens
Copy link
Copy Markdown
Member Author

Nice catch! This issue exists in the old client as well. It is fixed for the new client in 0ae1059.

@ArisMorgens ArisMorgens force-pushed the Aris/cflib2/ColorLEDTab branch from 0ae1059 to caecf09 Compare March 25, 2026 12:31
@ArisMorgens ArisMorgens force-pushed the Aris/cflib2/ColorLEDTab branch from 7940a4e to 5b502d1 Compare March 25, 2026 12:53
Copy link
Copy Markdown
Member

@gemenerik gemenerik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several places replace specific exception types with bare except Exception. The risk here is that it hides; programming mistakes, unexpected runtime issues, new exception types from cflib2. They would all be silently logged as a debug message while the code moves on. It's better to catch only the exceptions you actually expect.

self._cf, present_decks
)
for position, stream in streams.items():
create_task(self._run_thermal_stream(position, stream))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thermal stream tasks created here aren't stored, so they can't be canceled on disconnect. Currently they only terminate because the Disconnected exception is caught by the general except Exception handler, but catching exceptions is meant to catch things going wrong, not to handle a normal disconnect. The disconnect path should use explicit cancellation of the task. Store the task references and cancel them in disconnected(), like with how _connected_task is handled.

style = button.styleSheet() # type: ignore
if "background-color:" not in style:
return
hex_color = style.split("background-color:")[-1].split(";")[0].strip()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not this pr but this feels fragile

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.

3 participants