Fetch all params on drone connect#1108
Conversation
… params, update tests
There was a problem hiding this comment.
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
Droneinitialization 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.
There was a problem hiding this comment.
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
getSingleParamtakes a single param id/name, but the argument is namedparams(plural) and the docstring saysOptional[str]even though the function expects astr. Renaming the parameter to something likeparam_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.
Turnlings
left a comment
There was a problem hiding this comment.
This is so fast in comparison and proves it was so worth doing. Found a couple of things for you to look at though.
Also refactor controllers to use cached params, update tests