Set param updates - #1994
Conversation
Detect and report MAVLink-2 PARAM_ERROR responses from newer ArduPilot firmware when parameter writes are rejected. Keep compatibility with older firmware that does not acknowledge PARAM_SET requests, and add a local decoder for pymavlink 2.4.49. Add coverage for rejected and silently accepted parameter writes, and update the communication architecture documentation.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Updates flight-controller parameter write behavior to detect and surface MAVLink-2 PARAM_ERROR rejections (newer ArduPilot firmware), while keeping legacy “send-only” semantics when no acknowledgement is emitted.
Changes:
- Add a pymavlink compatibility layer to decode
PARAM_ERRORand map error codes to user-facing messages. - Update
FlightControllerParams.set_param()to poll briefly forPARAM_ERRORand return a meaningful failure when received. - Improve fakes/tests for MAVLink connection caching and message-type filtering; add tests for firmware-rejected vs legacy behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_frontend_tkinter_log_analysis.py | Minor formatting-only change in tests. |
| tests/test_backend_flightcontroller_params.py | Adds tests for PARAM_ERROR handling and legacy timeout behavior. |
| tests/test_backend_flightcontroller_factory_mavlink.py | Updates fake factory expectations and adds message-type filtering tests. |
| ardupilot_methodic_configurator/backend_mavlink_param_error.py | Introduces runtime registration/decoding helpers for MAVLink PARAM_ERROR. |
| ardupilot_methodic_configurator/backend_flightcontroller_params.py | Implements PARAM_ERROR polling and error mapping in set_param(). |
| ardupilot_methodic_configurator/backend_flightcontroller_factory_mavlink.py | Stores created fake connections and adds recv_match(type=...) filtering. |
| ARCHITECTURE_2_flight_controller_communication.md | Updates architecture/docs to reflect current synchronous behavior and PARAM_ERROR support. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ordered_fieldnames: ClassVar[list[str]] = ["param_index", "target_system", "target_component", "param_id", "error"] | ||
| fieldtypes: ClassVar[list[str]] = ["uint8_t", "uint8_t", "char", "int16_t", "uint8_t"] | ||
| orders: ClassVar[list[int]] = [1, 2, 3, 0, 4] | ||
| lengths: ClassVar[list[int]] = [1, 1, 1, 1, 1] |
| The definition matches MAVLink common.xml message 345. Re-registration is harmless | ||
| and also handles applications that change pymavlink's dialect at runtime. | ||
|
|
||
| """ | ||
| mavlink = mavutil.mavlink | ||
| if PARAM_ERROR_MESSAGE_ID in mavlink.mavlink_map: | ||
| return |
| while time_time() - start_time < self.PARAM_SET_PROPAGATION_DELAY: | ||
| message = self.master.recv_match(type="PARAM_ERROR", blocking=False) | ||
| if message is not None: | ||
| error_code = get_param_error_message(message, param_name) | ||
| if error_code is not None: | ||
| return error_code | ||
| # Test doubles or malformed data should not turn into a half-second | ||
| # busy wait. Real pymavlink filtering only returns PARAM_ERROR here. | ||
| if not isinstance(getattr(message, "param_id", None), (bytes, str)): | ||
| return None | ||
| time_sleep(self.PARAM_FETCH_POLL_DELAY) |
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Test Results 4 files ± 0 4 suites ±0 46m 43s ⏱️ + 1m 31s Results for commit 7dd746a. ± Comparison against base commit 5247ca9. This pull request removes 1 and adds 4 tests. Note that renamed tests count towards both. |
Description
Set param updates
Checklist
git commit --signoff)Testing
Describe how you tested these changes: