1147 feature be able to cancel connection#1149
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds user-driven cancellation for in-progress drone connection attempts, spanning backend connection lifecycle, parameter fetching, and GCS UI behavior.
Changes:
- Backend: track in-progress connections and expose a
cancel_connect_to_droneSocket.IO event; propagate a cancellationEventintoDroneand parameter fetching. - Backend: make
DroneandParamsController.fetchAllParamsBlockingabort cleanly when cancellation is requested, returning a consistent cancellation message. - Frontend: treat “Disconnect/Close” during an active connection attempt as “Cancel” and emit the cancel event; add tests covering cancellation signaling and param-fetch pre-cancel.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| radio/app/endpoints/comPorts.py | Adds connection-in-progress tracking, cancellation event wiring, and Socket.IO cancel handler. |
| radio/app/droneStatus.py | Introduces global connection state (connection_in_progress, connect_cancel_event). |
| radio/app/drone.py | Accepts a cancel Event and checks it during connection phases and param fetch. |
| radio/app/controllers/paramsController.py | Adds optional cancellation callback to abort blocking param fetch. |
| radio/tests/test_connections.py | Adds unit test verifying cancel event sets the backend cancellation flag. |
| radio/tests/test_ParamsController.py | Adds unit test for cancellation before starting param fetch. |
| gcs/src/redux/middleware/emitters.js | Emits cancel_connect_to_drone when disconnect is requested during “connecting”. |
| gcs/src/components/navbar.jsx | Updates modal close behavior/button label to allow canceling an in-progress connection. |
Comments suppressed due to low confidence (1)
radio/app/drone.py:99
- The
Drone.__init__docstring lists constructor args but doesn’t mention the newly addedconnectionCancelEventparameter. Please update the docstring’s Args section to include this parameter (what it does and when it should be provided) so callers know how to use cancellation consistently.
"""
The drone class interfaces with the UAS via MavLink.
Args:
port (str): The port to connect to the drone.
baud (int, optional): The baud rate for the connection. Defaults to 57600.
droneErrorCb (Optional[Callable], optional): Callback function for drone errors. Defaults to None.
droneDisconnectCb (Optional[Callable], optional): Callback function for drone disconnection. Defaults to None.
droneConnectStatusCb (Optional[Callable], optional): Callback function for drone connection providing an update as the drone connects. Defaults to None.
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.