Repository navigation
feat(motor-test): log all firmware status messages to the console - #2181
amilcarlucas wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Constructor-time hook acquisition can leak monitoring, and the new translatable messages are missing from locale catalogs.
Review effort: Balanced
Findings: 2
Open (4)
What changed in this PR
Adds motor-test firmware STATUSTEXT monitoring across backend, model, and view layers.
Changes:
- Adds receive-hook logging, bounded polling, and failed-ACK diagnostics.
- Manages monitoring across plugin lifecycle and reconnects.
- Adds regression tests and architecture documentation.
| File | Description |
|---|---|
ardupilot_methodic_configurator/backend_flightcontroller_commands.py |
Implements monitoring and polling. |
ardupilot_methodic_configurator/backend_flightcontroller.py |
Exposes facade methods. |
ardupilot_methodic_configurator/backend_flightcontroller_protocols.py |
Extends the flight-controller protocol. |
ardupilot_methodic_configurator/plugins/data_model_motor_test.py |
Delegates monitoring operations. |
ardupilot_methodic_configurator/plugins/frontend_tkinter_motor_test.py |
Integrates monitoring with view lifecycle. |
tests/test_backend_flightcontroller.py |
Tests facade delegation. |
tests/test_backend_flightcontroller_commands.py |
Tests parsing, logging, polling, and reconnects. |
tests/plugins/test_data_model_motor_test.py |
Tests model delegation. |
tests/plugins/test_frontend_tkinter_motor_test.py |
Tests view polling and cleanup. |
ARCHITECTURE_motor_test.md |
Documents firmware feedback monitoring. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| self._create_widgets() | ||
| self.model.set_status_text_logging(True) |
| commands.poll_motor_test_status_text() | ||
| records = [record for record in caplog.records if "Unrelated sensor diagnostic" in record.getMessage()] | ||
| assert len(records) == 1 | ||
| assert records[0].levelno >= logging.INFO |
| severity = int(getattr(msg, "severity", 6)) | ||
| # Keep even firmware DEBUG messages visible at normal console verbosity. | ||
| log = logging_error if severity <= 3 else logging_warning if severity == 4 else logging_info | ||
| log(_("Flight controller STATUSTEXT (%(severity)d): %(text)s"), {"severity": severity, "text": text}) |
| if master.recv_msg() is None: # pyright: ignore[reportAttributeAccessIssue] | ||
| break | ||
| except (OSError, ValueError) as exc: | ||
| logging_warning(_("Could not read motor-test status messages: %(error)s"), {"error": str(exc)}) |
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Test Results 3 files 3 suites 38m 34s ⏱️ Results for commit 53203f8. ♻️ This comment has been updated with latest results. |
Previous review (2026-10-08)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for this; logging every STATUSTEXT through a pymavlink message hook is a neat approach, and the reconnect/deactivate handling looks right. One problem needs fixing before merge:
Optional: the severity test at https://github.com/ArduPilot/MethodicConfigurator/pull/2181/files#diff-5ab67beea2ef10b83cc1cfbb2d1432811aabb252a08a262242760447c1f1821fR90 could assert the exact ERROR/WARNING/INFO mapping instead of >= INFO. The missing .pot/.po entries are fine, since the translation workflow adds them after merge. Not exercised here: real hardware/SITL timing and the full GUI suite. |
1b1cfb8 to
282da3e
Compare
Coverage Report for CI Build 38483205280Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Warning No base build found for commit Coverage: 91.773%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
Previous review (2026-10-08)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for the update. This is a rebase of the version reviewed earlier (now 282da3e, same changes as 1b1cfb8), so the earlier points still apply:
Optional: the severity test (https://github.com/ArduPilot/MethodicConfigurator/pull/2181/files#diff-5ab67beea2ef10b83cc1cfbb2d1432811aabb252a08a262242760447c1f1821fR90) could assert the exact ERROR/WARNING/INFO mapping, since >= INFO also passes if everything is logged as ERROR. Not exercised: hardware/SITL timing and the full GUI suite. |
Enable STATUSTEXT monitoring while the motor-test plugin is active. Observe messages through pymavlink receive hooks so command ACK, parameter, and battery reads cannot silently filter out firmware feedback. Log every nonempty payload without requiring a motor-test prefix. Preserve error and warning severity while making informational and debug messages visible at normal console verbosity. Safely decode padded and invalid UTF-8 payloads. Poll pending telemetry between commands and after Test All dispatch. Include firmware diagnostics received before or shortly after a failed motor-test ACK in the returned error message. Move the receive hook across reconnects and remove it when the plugin is deactivated or destroyed, preserving unrelated hooks. Bound polling work per refresh and prevent duplicate refresh timers. Add regression tests for all motor command paths, ACK ordering, severity levels, payload decoding, reconnects, cleanup, and transport failures. Update the motor-test architecture documentation. Keep existing motor safety checks unchanged. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
282da3e to
53203f8
Compare
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for the rebase. 53203f8 carries the same changes as 282da3e, now on a base where the battery and status-text code has changed, so the earlier points were re-run on this head rather than carried over. They still apply:
Optional: the severity test (https://github.com/ArduPilot/MethodicConfigurator/pull/2181/files#diff-5ab67beea2ef10b83cc1cfbb2d1432811aabb252a08a262242760447c1f1821fR92) asserts only >= INFO, which still passes if every severity is logged as ERROR; asserting the exact ERROR/WARNING/INFO mapping would pin it. The mapping itself is correct. Not exercised: real hardware over serial, other firmware versions, Windows and macOS, and the full test suite. CI for this head was still queued when this was written. |


Description
Enable STATUSTEXT monitoring while the motor-test plugin is active. Observe messages through pymavlink receive hooks so command ACK, parameter, and battery reads cannot silently filter out firmware feedback.
Log every nonempty payload without requiring a motor-test prefix. Preserve error and warning severity while making informational and debug messages visible at normal console verbosity. Safely decode padded and invalid UTF-8 payloads.
Poll pending telemetry between commands and after Test All dispatch. Include firmware diagnostics received before or shortly after a failed motor-test ACK in the returned error message.
Move the receive hook across reconnects and remove it when the plugin is deactivated or destroyed, preserving unrelated hooks. Bound polling work per refresh and prevent duplicate refresh timers.
Add regression tests for all motor command paths, ACK ordering, severity levels, payload decoding, reconnects, cleanup, and transport failures. Update the motor-test architecture documentation.
Keep existing motor safety checks unchanged.
Checklist
git commit --signoff)Testing
Describe how you tested these changes: