Skip to content

PX4 custom mode list: align with PX4 definition - #14540

Merged
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
DonLakeFlyer:px4-flight-mode-align
Jul 6, 2026
Merged

PX4 custom mode list: align with PX4 definition#14540
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
DonLakeFlyer:px4-flight-mode-align

Conversation

@DonLakeFlyer

Copy link
Copy Markdown
Contributor

Replaces #14359.

Aligns the PX4 custom flight mode list baked into QGC with the current PX4 definitions.

Description

  • Pin enum values. PX4_CUSTOM_MAIN_MODE, PX4_CUSTOM_SUB_MODE_AUTO and PX4_CUSTOM_SUB_MODE_POSCTL now have explicit numeric values. These are a wire contract with PX4 firmware and must not depend on enum auto-increment ordering.
  • Add missing modes. QGC now knows about Position Slow, Altitude Cruise, Termination, VTOL Takeoff and Guided Course (e.g. "Termination" previously showed as Unknown).
  • Remove phantom AUTO_RTGS. PX4 deleted the AUTO_RTGS sub-mode in 2020, but QGC still displayed "Return to Groundstation". Slot 7 is now an explicit reserved/do-not-use placeholder.
  • Classify new modes. updateAvailableFlightModes() now assigns fixed wing / multi rotor flags for the new modes instead of letting them fall through to struct defaults (this also keeps the two switches exhaustive, avoiding -Wswitch).
  • Simplify custom-example. CustomFirmwarePlugin::updateAvailableFlightModes() now calls the base PX4FirmwarePlugin implementation and only narrows canBeSet, rather than duplicating the airframe switch logic (which had already drifted out of sync).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Testing

  • Builds clean locally (no errors/warnings on the four changed files)

Flight Stacks Tested

  • PX4 (mode list updated to match PX4; runtime spot-check still recommended)

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).

Copilot AI review requested due to automatic review settings June 16, 2026 16:46

This comment was marked as resolved.

This comment was marked as low quality.

@github-actions

github-actions Bot commented Jun 16, 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: 25 passed, 0 skipped
linux-coverage-unit: 103 passed, 0 skipped
Total: 128 passed, 0 skipped

Code Coverage

Coverage: 66.3%

No baseline available for comparison

Artifact Sizes

Artifact Size
QGroundControl 221.85 MB
QGroundControl-aarch64 179.43 MB
QGroundControl-installer-AMD64 137.91 MB
QGroundControl-installer-AMD64-ARM64 80.45 MB
QGroundControl-installer-ARM64 109.20 MB
QGroundControl-linux 87.09 MB
QGroundControl-mac 87.09 MB
QGroundControl-windows 86.14 MB
QGroundControl-x86_64 191.65 MB
No baseline available for comparison

Updated: 2026-07-06 18:29:43 UTC • Commit: 6abfa8a • Triggered by: Android

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 12.90323% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.64%. Comparing base (f29efd3) to head (6abfa8a).
⚠️ Report is 126 commits behind head on master.

Files with missing lines Patch % Lines
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc 12.90% 22 Missing and 5 partials ⚠️

❌ Your patch check has failed because the patch coverage (12.90%) is below the target coverage (30.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14540      +/-   ##
==========================================
+ Coverage   25.47%   30.64%   +5.17%     
==========================================
  Files         769      785      +16     
  Lines       65912    66787     +875     
  Branches    30495    30944     +449     
==========================================
+ Hits        16788    20467    +3679     
+ Misses      37285    32391    -4894     
- Partials    11839    13929    +2090     
Flag Coverage Δ
unittests 30.64% <12.90%> (+5.17%) ⬆️

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

Files with missing lines Coverage Δ
src/Comms/MockLink/MockLink.cc 56.28% <ø> (+5.40%) ⬆️
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc 30.78% <12.90%> (-1.02%) ⬇️

... and 435 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 1e2d58e...6abfa8a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +28 to 31
PX4_CUSTOM_SUB_MODE_AUTO_PRECLAND = 9,
PX4_CUSTOM_SUB_MODE_AUTO_VTOL_TAKEOFF = 10,
PX4_CUSTOM_SUB_MODE_GUIDED_COURSE = 11,
};
Comment on lines 74 to +76
AUTO_TAKEOFF = PX4_CUSTOM_MAIN_MODE_AUTO <<16 | (PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF << 24 ),
AUTO_VTOL_TAKEOFF = PX4_CUSTOM_MAIN_MODE_AUTO <<16 | (PX4_CUSTOM_SUB_MODE_AUTO_VTOL_TAKEOFF << 24 ),
AUTO_GUIDED_COURSE = PX4_CUSTOM_MAIN_MODE_AUTO <<16 | (PX4_CUSTOM_SUB_MODE_GUIDED_COURSE << 24 ),
- Pin explicit numeric values to PX4_CUSTOM_MAIN_MODE / SUB_MODE enums so the
  wire contract no longer depends on auto-increment ordering.
- Add the modes QGC was missing: Position Slow, Altitude Cruise, Termination,
  VTOL Takeoff and Guided Course.
- Remove the phantom "Return to Groundstation" (AUTO_RTGS) mode; PX4 deleted
  this sub-mode in 2020. Slot 7 is now reserved/do-not-use.
- Classify the new modes for fixed wing / multi rotor in
  updateAvailableFlightModes() so they aren't left at struct defaults.
- Simplify the custom-example override to call the base implementation and only
  narrow canBeSet, instead of duplicating the airframe switch logic.
@DonLakeFlyer
DonLakeFlyer force-pushed the px4-flight-mode-align branch from 69a5c94 to 6abfa8a Compare July 6, 2026 17:36
@DonLakeFlyer
DonLakeFlyer merged commit 0983301 into mavlink:master Jul 6, 2026
44 checks passed
@DonLakeFlyer
DonLakeFlyer deleted the px4-flight-mode-align branch July 6, 2026 18:39
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