Skip to content

fix(Joystick): match actual update rate to joystick setting - #14797

Draft
bosism wants to merge 1 commit into
mavlink:masterfrom
bosism:agent/joystick-update-rate
Draft

fix(Joystick): match actual update rate to joystick setting#14797
bosism wants to merge 1 commit into
mavlink:masterfrom
bosism:agent/joystick-update-rate

Conversation

@bosism

@bosism bosism commented Aug 9, 2026

Copy link
Copy Markdown

Bug Description

The joystick's actual axis update rate can be lower than the value configured in Axis frequency. With the default 25 Hz setting, the configured interval is 40 ms, but an update at exactly 40 ms was rejected.

Root Cause

The polling thread checks joystick state approximately every 20 ms. _handleAxis() returned while the elapsed time was less than or equal to the configured interval. A poll at exactly 40 ms was therefore skipped and the update could be delayed until the next poll, around 60 ms.

Solution

Treat the configured interval as inclusive: an axis update is due when elapsed >= delay. A deterministic regression test covers the boundary at 39, 40, and 41 ms.

Testing

  • Tested locally
  • Added regression test
  • Tested with simulator (SITL)
  • Tested with hardware

Validation performed:

  • Debug build completed successfully.
  • All joystick-labelled unit tests pass (4/4).
  • Relevant repository policy hooks and changed-line clang-format checks pass.
  • The full Unit label passes 193/194 tests. The unrelated BluetoothWorkerTest fails because the host BlueZ backend emits an unexpected warning for the test's invalid Bluetooth address; the failure reproduces when that test is run alone.

Platforms Tested

  • Linux
  • Windows
  • macOS
  • Android
  • iOS

Flight Stacks Tested

  • PX4
  • ArduPilot
  • N/A

Checklist

  • I have read the Contribution Guidelines
  • My code follows the project's coding standards
  • I have added a test that reproduces the bug
  • New and existing unit tests pass locally (193/194; unrelated Bluetooth failure described above)

By submitting this pull request, I confirm that my contribution is made under the terms of the project's dual license (Apache 2.0 and GPL v3).

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for your first pull request! 🎉

A maintainer will review this soon. Please ensure:

  • CI checks pass
  • Code follows coding standards
  • Changes tested on relevant platforms

We appreciate your contribution to QGroundControl!

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 32.73%. Comparing base (f29efd3) to head (0c25e13).
⚠️ Report is 260 commits behind head on master.

Files with missing lines Patch % Lines
src/Joystick/Joystick.cc 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14797      +/-   ##
==========================================
+ Coverage   25.47%   32.73%   +7.26%     
==========================================
  Files         769      784      +15     
  Lines       65912    67635    +1723     
  Branches    30495    31330     +835     
==========================================
+ Hits        16788    22141    +5353     
+ Misses      37285    30589    -6696     
- Partials    11839    14905    +3066     
Flag Coverage Δ
unittests 32.73% <50.00%> (+7.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/Joystick/Joystick.h 17.02% <100.00%> (+1.96%) ⬆️
src/Joystick/Joystick.cc 11.16% <0.00%> (+3.82%) ⬆️

... and 475 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84bd446...0c25e13. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Build Results

Platform Status

Platform Status Details
Linux Passed View
Windows Passed View
MacOS Passed View
Android Passed View

All builds passed.

Pre-commit

Check Status Details
pre-commit Failed (non-blocking) View

Pre-commit hooks: 0 passed, 0 failed, 0 skipped.

Test Results

linux-coverage-integration: 37 passed, 0 skipped
linux-coverage-unit: 120 passed, 0 skipped
linux-sanitizers-integration: 20 passed, 0 skipped
linux-sanitizers-unit: 120 passed, 0 skipped
Total: 297 passed, 0 skipped

Code Coverage

Coverage: 69.5%

No baseline available for comparison

Artifact Sizes

Artifact Size
QGroundControl 252.61 MB
QGroundControl-aarch64 179.35 MB
QGroundControl-installer-AMD64 137.86 MB
QGroundControl-installer-AMD64-ARM64 80.38 MB
QGroundControl-installer-ARM64 109.13 MB
QGroundControl-linux 87.04 MB
QGroundControl-mac 87.04 MB
QGroundControl-x86_64 191.58 MB
No baseline available for comparison

Updated: 2026-08-09 15:48:28 UTC • Commit: 0c25e13 • Triggered by: MacOS

@DonLakeFlyer DonLakeFlyer added this to the Release V5.2 milestone Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants