Skip to content

1147 feature be able to cancel connection#1149

Merged
1Blademaster merged 4 commits into
mainfrom
1147-feature-be-able-to-cancel-connection
Apr 1, 2026
Merged

1147 feature be able to cancel connection#1149
1Blademaster merged 4 commits into
mainfrom
1147-feature-be-able-to-cancel-connection

Conversation

@1Blademaster
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 31, 2026 20:29
@1Blademaster 1Blademaster linked an issue Mar 31, 2026 that may be closed by this pull request
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

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_drone Socket.IO event; propagate a cancellation Event into Drone and parameter fetching.
  • Backend: make Drone and ParamsController.fetchAllParamsBlocking abort 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 added connectionCancelEvent parameter. 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.

Comment thread radio/app/endpoints/comPorts.py Outdated
Comment thread radio/app/endpoints/comPorts.py Outdated
@1Blademaster 1Blademaster merged commit 0f7c331 into main Apr 1, 2026
8 checks passed
@1Blademaster 1Blademaster deleted the 1147-feature-be-able-to-cancel-connection branch April 1, 2026 19:16
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.

[FEATURE] Be able to cancel connection

2 participants