feat(FactSystem): add BulkRefreshJob / bulkRefresh() to replace scatter-shot refreshParameter calls#14413
Conversation
Add a BulkRefreshJob class that fires a batch of PARAM_REQUEST_READs with exponential-backoff retry. Owned by ParameterManager as a QObject child; self-deletes on completion. Add ParameterManager::bulkRefresh() which resolves a mix of exact names and wildcard prefixes (e.g. "COMPASS_*") against the known parameter set, deduplicates, and delegates to BulkRefreshJob. Timeouts (_waitForParamValueAckMs, BulkRefreshJob::_retryBaseDelayMs) are reduced to 50 ms under QGC::runningUnitTests() so the test suite stays fast. Add five unit tests covering: exact names, prefix expansion, unknown name skipped, round-0-failure-then-retry-succeeds, and all-rounds-exhausted.
a62226d to
2830339
Compare
…pups After compass calibration stops/cancels the FC is often slow to answer. The old code called refreshParameter + refreshParametersPrefix individually, causing a modal "Parameter read failed" popup for every timed-out request which could stack dozens of dialogs and freeze the UI (mavlink#14346). Replace _refreshParams() in both APM and PX4 sensor controllers with a single bulkRefresh() call (notifyFailure=false). Retry logic and logging are preserved inside BulkRefreshJob; only the user-visible modal is suppressed. Also fix QML signal handler syntax (arrow-function form) in APMSensorsComponent.qml to silence qmllint warnings. Addresses the compass-cal refresh spam described in mavlink#14347.
2830339 to
6b5d3e2
Compare
Codecov Report❌ Patch coverage is ❌ Your project check has failed because the head coverage (25.57%) is below the target coverage (30.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #14413 +/- ##
==========================================
+ Coverage 25.47% 25.57% +0.10%
==========================================
Files 769 767 -2
Lines 65912 66281 +369
Branches 30495 30663 +168
==========================================
+ Hits 16788 16954 +166
+ Misses 37285 37279 -6
- Partials 11839 12048 +209
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 30 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Build ResultsPlatform Status
All builds passed. Pre-commit
Pre-commit hooks: 4 passed, 45 failed, 7 skipped. Test Resultslinux-coverage: 87 passed, 0 skipped Code CoverageCoverage: 59.4% No baseline available for comparison Artifact Sizes
Updated: 2026-05-19 21:45:35 UTC • Triggered by: Android |
Summary
Adds a proper batch-parameter-refresh API to
ParameterManagerand uses itto eliminate the post-compass-calibration popup spam described in #14347 /
#14346.
Problem
_refreshParams()in both the APM and PX4 sensor controllers calledrefreshParameter()andrefreshParametersPrefix()individually. The FCis often slow to respond mid-cancel; every timed-out request fired a modal
"Parameter read failed" via
QGC::showAppMessage, stacking dozens ofdialogs and freezing the UI.
Solution
BulkRefreshJob(newsrc/FactSystem/BulkRefreshJob.{h,cc}):A
QObject-child ofParameterManagerthat fires a batch ofPARAM_REQUEST_READmessages and retries (exponential back-off, up tokMaxRetryRounds = 3rounds) any that time out.notifyFailure = falsesuppresses the user-visible modal while still logging and emitting
_paramRequestReadFailurefor internal use. Self-deletes on completion.ParameterManager::bulkRefresh()(new public API):Accepts a list of exact names and/or wildcard prefixes (e.g.
"COMPASS_*"),resolves them against the known parameter set, deduplicates, and delegates to
BulkRefreshJob.Sensor controllers updated to use a single
bulkRefresh()call withnotifyFailure = false, replacing the old scattered individual-refresh loops.QML (
APMSensorsComponent.qml): signal handlers converted to arrow-functionsyntax to fix qmllint warnings.
Test-speed note
_waitForParamValueAckMsandBulkRefreshJob::_retryBaseDelayMsare set to50 ms under
QGC::runningUnitTests()so the new retry tests complete in ~1 sinstead of ~19 s.
Test plan
ctest -L Unit -R ParameterManager— all 19 tests pass (5 new tests added,including retry-succeeds and all-rounds-exhausted paths)
"Parameter read failed" modals; UI stays responsive
no popup spam
Addresses the compass-cal refresh spam described in #14347.