Skip to content

Fetch all params on drone connect#1108

Merged
1Blademaster merged 12 commits intomainfrom
1086-task-refactor-fetch-all-params-to-run-on-connect
Mar 22, 2026
Merged

Fetch all params on drone connect#1108
1Blademaster merged 12 commits intomainfrom
1086-task-refactor-fetch-all-params-to-run-on-connect

Conversation

@1Blademaster
Copy link
Copy Markdown
Member

@1Blademaster 1Blademaster commented Mar 21, 2026

Also refactor controllers to use cached params, update tests

Copilot AI review requested due to automatic review settings March 21, 2026 17:57
@1Blademaster 1Blademaster linked an issue Mar 21, 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

This PR shifts the radio backend to fetch the full parameter set during drone connection, then refactors multiple controllers to use the cached parameter set (instead of on-demand param reads). It also updates/extends the radio test suite to validate the new cached-param behavior and the new blocking fetch path.

Changes:

  • Fetch all parameters as part of Drone initialization and expose progress updates during connect.
  • Replace various controllers’ “fetch from drone” param reads with cache-only reads via ParamsController.getSingleParam().
  • Update/add tests to reflect the new cache-first controller behavior and the new refresh/fetch flow.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
radio/app/drone.py Fetches params during connect; updates connection status/progress and controller initialization flow.
radio/app/controllers/paramsController.py Introduces blocking param fetch + refactors cached single-param access API.
radio/app/endpoints/params.py Refactors refresh flow to use blocking fetch with progress callback and emits errors on failure.
radio/app/controllers/flightModesController.py Switches flight mode reads to cached params.
radio/app/controllers/frameController.py Switches frame type/class reads to cached params.
radio/app/controllers/gripperController.py Switches gripper enable/config reads to cached params; removes fallback fetches.
radio/app/controllers/navController.py Switches loiter radius read to cached param only; removes “fetch from drone” path.
radio/app/controllers/rcController.py Switches RC param initialization to cached params.
radio/app/controllers/serialPortsController.py Switches serial port param initialization to cached params.
radio/app/controllers/servoController.py Switches servo param initialization to cached params.
radio/tests/test_params.py Updates refresh params test to validate “always fetch + progress emitted” behavior.
radio/tests/test_gripper.py Adjusts fixture to prime param cache without bulk param fetch/busy wait.
radio/tests/test_FlightModesController.py Updates fixture/tests to prime cache and simulate missing cache entries.
radio/tests/test_ParamsController.py Adds new unit/integration tests for caching + blocking fetch behaviors.
gcs/src/params.jsx Minor import ordering adjustment.

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

Comment thread radio/app/controllers/paramsController.py
Comment thread radio/app/controllers/paramsController.py
Comment thread radio/app/controllers/paramsController.py
Comment thread radio/app/drone.py
Comment thread radio/app/drone.py Outdated
Comment thread radio/app/drone.py Outdated
Comment thread radio/app/controllers/paramsController.py Outdated
@1Blademaster 1Blademaster changed the title Fetch all params on drone connect, refactor controllers to use cached… Fetch all params on drone connect Mar 22, 2026
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 24 out of 24 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

radio/app/controllers/paramsController.py:382

  • getSingleParam takes a single param id/name, but the argument is named params (plural) and the docstring says Optional[str] even though the function expects a str. Renaming the parameter to something like param_id (and updating the docstring accordingly) would make the cache-only semantics clearer and reduce confusion at call sites.
    def getSingleParam(self, params: str) -> Union[CachedParam, dict]:
        """
        Get a single parameter from the cached params.

        Args:
            params (Optional[str]): The name of the parameter to get
        """

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

Comment thread radio/app/drone.py
Comment thread radio/tests/test_gripper.py
@1Blademaster 1Blademaster requested a review from Turnlings March 22, 2026 15:08
Copy link
Copy Markdown
Contributor

@Turnlings Turnlings left a comment

Choose a reason for hiding this comment

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

This is so fast in comparison and proves it was so worth doing. Found a couple of things for you to look at though.

Comment thread radio/app/controllers/frameController.py Outdated
Comment thread radio/app/endpoints/params.py
Copy link
Copy Markdown
Contributor

@Turnlings Turnlings left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@1Blademaster 1Blademaster merged commit 512e4dd into main Mar 22, 2026
8 checks passed
@1Blademaster 1Blademaster deleted the 1086-task-refactor-fetch-all-params-to-run-on-connect branch March 22, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] Refactor fetch all params to run on connect

3 participants