Skip to content

fix: VehicleCameraControl firmwareVersion is backwards from MAVLink spec and doesn't include dev#14285

Open
jnomikos wants to merge 1 commit intomavlink:masterfrom
jnomikos:fix-camera-firmware-version
Open

fix: VehicleCameraControl firmwareVersion is backwards from MAVLink spec and doesn't include dev#14285
jnomikos wants to merge 1 commit intomavlink:masterfrom
jnomikos:fix-camera-firmware-version

Conversation

@jnomikos
Copy link
Copy Markdown
Contributor

@jnomikos jnomikos commented Apr 16, 2026

Description

According to MAVLink spec for CAMERA_INFORMATION, Version of the camera firmware, encoded as: (Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff). Use 0 if not known.

When viewing the version of my camera server in a custom QGC, I noticed the firmware version was reversed. This is because it isn't following the MAVLink spec correctly.

As a note, I made the intentional choice to make dev optional, because not everyone uses it. Even in the MAVSDK camera server example, they don't use dev and instead just do "1.0.0".

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/Build changes
  • Other

Testing

  • Tested locally
  • Added/updated unit tests
  • Tested with simulator (SITL)
  • Tested with hardware

Platforms Tested

  • Linux
  • Windows
  • macOS
  • Android
  • iOS

Flight Stacks Tested

  • PX4
  • ArduPilot

Screenshots

Checklist

  • I have read the Contribution Guidelines
  • I have read the Code of Conduct
  • My code follows the project's coding standards
  • [] I have added tests that prove my fix/feature works
  • New and existing unit tests pass locally

Related Issues


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 April 16, 2026 17:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes camera firmware version parsing in VehicleCameraControl to match the MAVLink CAMERA_INFORMATION.firmware_version encoding, and optionally includes the “dev” component when present.

Changes:

  • Decode firmware_version bytes according to MAVLink spec (Major in lowest byte).
  • Return an empty string when firmware_version is 0 (unknown).
  • Append the dev component as a 4th version field when non-zero.

Comment on lines +266 to +270
int major = (_mavlinkCameraInfo.firmware_version) & 0xFF;
int minor = (_mavlinkCameraInfo.firmware_version >> 8) & 0xFF;
int patch = (_mavlinkCameraInfo.firmware_version >> 16) & 0xFF;
int dev = (_mavlinkCameraInfo.firmware_version >> 24) & 0xFF;
if (dev != 0) {
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The new MAVLink-spec firmware_version decoding logic should be covered by a unit test (e.g., cases for 0 -> empty/unknown, dev==0 -> "major.minor.patch", dev!=0 -> "major.minor.patch.dev") so regressions don’t silently reintroduce the byte-order issue.

Copilot uses AI. Check for mistakes.
Comment on lines +263 to +265
if (_mavlinkCameraInfo.firmware_version == 0) {
return {};
}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The PR description checklist indicates tests were added/updated, but this change set only updates production code. Either add a corresponding test (likely under test/Camera/VehicleCameraControlTest.cc) or update the PR checklist to reflect what was actually done.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@9c70488). Learn more about missing BASE report.

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

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #14285   +/-   ##
=========================================
  Coverage          ?   25.62%           
=========================================
  Files             ?      754           
  Lines             ?    68005           
  Branches          ?    31514           
=========================================
  Hits              ?    17429           
  Misses            ?    37898           
  Partials          ?    12678           
Flag Coverage Δ
unittests 25.62% <0.00%> (?)

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

Files with missing lines Coverage Δ
src/Camera/VehicleCameraControl.cc 1.77% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c70488...2f0d15d. 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.

@github-actions
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: 4 passed, 36 failed, 7 skipped.

Test Results

linux-coverage: 78 passed, 0 skipped
linux-sanitizers: 78 passed, 0 skipped
Total: 156 passed, 0 skipped

Code Coverage

Coverage: 58.2%

No baseline available for comparison

Artifact Sizes

Artifact Size
QGroundControl 247.81 MB
QGroundControl-aarch64 177.23 MB
QGroundControl-installer-AMD64 134.84 MB
QGroundControl-installer-AMD64-ARM64 77.45 MB
QGroundControl-installer-ARM64 106.17 MB
QGroundControl-linux 338.35 MB
QGroundControl-mac 188.82 MB
QGroundControl-windows 188.84 MB
QGroundControl-x86_64 172.35 MB
No baseline available for comparison

Updated: 2026-04-16 18:40:39 UTC • Triggered by: Android

@jnomikos
Copy link
Copy Markdown
Contributor Author

I don't think tests are necessary due to how simple the logic is, but I can add if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants