Skip to content

Set param updates - #1994

Open
amilcarlucas wants to merge 4 commits into
masterfrom
set_param_updates
Open

Set param updates#1994
amilcarlucas wants to merge 4 commits into
masterfrom
set_param_updates

Conversation

@amilcarlucas

Copy link
Copy Markdown
Collaborator

Description

Set param updates

Checklist

  • Run pre-commit checks locally
  • Verified by a human programmer
  • All commits are signed off (use git commit --signoff)
  • Code follows our coding standards
  • Documentation updated if needed
  • No breaking changes or properly documented

Testing

Describe how you tested these changes:

  • Unit tests pass
  • Integration tests pass
  • Manual testing performed
  • Tested on flight controller hardware

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.
Copilot AI lite review requested due to automatic review settings August 28, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_ERROR and map error codes to user-facing messages.
  • Update FlightControllerParams.set_param() to poll briefly for PARAM_ERROR and 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]
Comment on lines +28 to +34
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
Comment on lines +355 to +365
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)
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
18825 16830 89% 89% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 7dd746a by action🐍

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

     4 files  ± 0       4 suites  ±0   46m 43s ⏱️ + 1m 31s
 4 891 tests + 3   4 884 ✅ + 3   7 💤 ±0  0 ❌ ±0 
19 346 runs  +12  19 301 ✅ +12  45 💤 ±0  0 ❌ ±0 

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.
tests.test_backend_flightcontroller_factory_mavlink.TestMavlinkConnectionFactoryService ‑ test_fake_mavlink_factory_get_connection_not_stored
tests.test_backend_flightcontroller_factory_mavlink.TestMavlinkConnectionFactoryService ‑ test_fake_mavlink_connection_filters_messages_by_type
tests.test_backend_flightcontroller_factory_mavlink.TestMavlinkConnectionFactoryService ‑ test_fake_mavlink_factory_get_connection_returns_created_connection
tests.test_backend_flightcontroller_params.TestFlightControllerParamsSetParameter ‑ test_legacy_firmware_without_parameter_error_keeps_send_only_behavior
tests.test_backend_flightcontroller_params.TestFlightControllerParamsSetParameter ‑ test_user_is_told_when_newer_firmware_rejects_parameter_write

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.

2 participants