Replace hardcoded PX4 firmware lookup with manifest-based discovery#13966
Replace hardcoded PX4 firmware lookup with manifest-based discovery#13966mrpollo wants to merge 5 commits into
Conversation
Pre-commit Checks Failed
Hook ResultsFiles Modified by HooksHow to Fix./tools/pre-commit.sh
git add -u && git commit --amend --no-editRun ID: 21894206095 |
Build ResultsPlatform Status
All builds passed. Test Resultslinux_gcc_64: 0 passed, 0 skipped Total: 0 passed, 0 skipped Code CoverageCoverage: 100.0% No baseline available for comparison Artifact Sizes
No baseline available for comparisonUpdated: 2026-02-11 06:42:04 UTC • Triggered by: Android |
Replace the static px4_board_name_map and GitHub Releases API version detection with dynamic firmware discovery from the PX4 manifest at https://px4-travis.s3.amazonaws.com/Firmware/manifest.json (format v2). This removes the need to manually maintain board ID to firmware name mappings and supports all boards published in the PX4 manifest automatically. Changes: - Remove hardcoded px4_board_name_map (60+ entries) and the GitHub Releases API call (_determinePX4StableVersion) - Add manifest download, parse, and data model structs (PX4ManifestBuildInfo_t, PX4ManifestReleaseInfo_t) - Add _downloadPX4Manifest(), _parsePX4Manifest(), and _buildPX4FirmwareHashFromManifest() for firmware URL resolution - Expose version properties (px4DevVersion, px4ManifestLoaded, px4ManifestDownloading, px4AvailableVersions) to QML - Wire SHA-256 hash verification from manifest into firmware downloads - Add unit tests for manifest parsing, version extraction, firmware hash building, missing board handling, and invalid manifest formats - Add test fixture (px4_manifest_v2.json) with multi-board, multi-channel, bootloader/variant build coverage Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Add a firmware selection combo box for PX4 that lets the user choose from available builds for their board, mirroring the existing ArduPilot firmware selection pattern. The manifest contains multiple build variants per board (default, rover, fixedwing, etc.) alongside bootloader images. This change filters out bootloader/canbootloader builds, presents the remaining variants in a combo box, and pre-selects the _default build. Controller changes: - Add _buildPX4FirmwareNames() to populate build list from manifest, filtering bootloader builds and building friendly display names - Add setSelectedPX4Version() for version picker support - Expose px4FirmwareNames, px4FirmwareUrls, px4FirmwareNamesBestIndex properties to QML - Wire build list refresh on bootloader detection, firmware type change, manifest load, and version selection QML changes: - Add PX4 firmware selection combo box (px4FirmwareSelectionCombo) - Add PX4 version picker combo for advanced mode - Add download status and error labels for PX4 manifest state - Refactor onAccepted to use flashFirmwareUrl() for PX4 builds - Rename "PX4 Pro" to "PX4 Autopilot" in radio button label Tests: - Add _testBuildPX4FirmwareNames for name/URL/count verification - Add _testBootloaderFilteredOut for bootloader exclusion - Add _testDefaultBuildPreSelected for best-index logic - Add _testSha256MapPopulation for hash map verification Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Replace all px4-travis.s3.amazonaws.com references with the new artifacts.px4.io CloudFront distribution. This covers the PX4 manifest URL, SiK radio firmware URLs, and test fixtures. The SiK radio hm_trp URL is also upgraded from http to https. Signed-off-by: Ramon Roche <mrpollo@gmail.com>
c435bac to
fa10ba3
Compare
|
@mrpollo Looks pretty cool. What happens in airframe selection - i.e. if you have rover, are you only shown Rover frames? |
|
@hamishwillee I haven't arrived there yet, hopefully it only displays rover frames? I'll check and confirm! |
Me too, but I suspect not. Either way this is all a change to the UI which will need to be documented in both QGC (first) and PX4 docs. I'm not too involved in the QGC docs anymore but this particular case will need to be done. |
The other issue here is that QGC has it's own list of available airframes, which may or may not be present in the firmware ROMFS. A user can select a non-existent airframe and only finds out later, this gets reported frequently. Long term I think we should remove all these baked-in aiframes from ROMFS, in a deployed system only one airframe file is ever used and the rest are bloat. Perhaps a follow-on to this work would be an airframe manifest, or airframe database (like how betaflight does it) where users can download a "preset" (airframe file) specific to their vehicle. This would allow us to host and make available an arbitrary number of airframe files. |
|
@dakejahl thats a neat idea, right now the *.px4 file also has this info baked in, perhaps we can use this for now? beyond that, I can add an extra field to the manifest for a board that includes this info too, many sources to download from now that we have this manifest stuff |
|
FWIW we'd probably be best off supplying the supported airframes as component metadata - perhaps created initially at build time using information in our config files (do we need to think about adding airframes dynamically via SD?). That way you install the firmware you want - "multicopter" and get the frames that make sense for that firmware. Short term you could probably hard code this mapping in QGC based on the filename variant of the firmware. Alternatively, invert behaviour such that the user selects an airframe, and from that the firmware is chosen. Not sure that makes sense though, since not all firmwares are airframes, and by the time you have selected your firmware now, you are only interested in the particular relevant subset of frames. |
One of these. Either we decide that copter get's a handful of copter specific airframes or we decide that copter only gets the base airframe file (rc.mc_defaults) and any further configuration lives in an airframe file on the SD card. The QGC UI would allow downloading airframes files to the SD card (download from server and then push via mavlink FTP). |
Compute and store the SHA-256 hash of PX4 firmware images after decompression (before 4-byte padding) so it can be verified against the manifest-provided sha256sum. This catches corrupted downloads that would otherwise only fail at flash time. Also enrich the test fixture with manifest v2 nested objects (firmware_category, label_pretty, hardware info) to match the real PX4 manifest format and support category-based filtering and build variant tests. Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Replace the confusing channel/version combo in PX4 advanced mode with two purpose-built dropdowns: a version selector (filtered by connected board, annotated with channel) and a build variant selector (filtered by board + version). This mirrors how the manifest actually organizes firmware and removes the version dropdown that showed all versions regardless of channel. - Add _buildPX4AdvancedVersions() to filter versions by board - Add _buildPX4AdvancedBuildNames() to filter builds by version - Add setSelectedPX4AdvancedVersionByIndex() for QML interaction - Add px4AdvancedSelectedChannel() for beta/dev warning display - Add "Custom firmware file..." button in advanced mode - Add manifest download retry button for network failures - Fix custom firmware cancel leaving user stuck at plug-in screen - Hide old channel dropdown and unfiltered version combo for PX4 - Normal mode and ArduPilot advanced mode unchanged - Add 4 new unit tests covering all advanced mode methods Signed-off-by: Ramon Roche <mrpollo@gmail.com>
|
So I spent a few hours trying to improve the UX for the firmware setup, and its much better now, I was able to create a fake manifest with the updated pretty labels from the recent discussion in the PX4 manifest PR, and incorporated here with pretty good results. But before that, I also realized we didn't go anywhere with the hash verification before, so I fixed that. Add SHA-256 verification for decompressed firmware images
Redesign PX4 advanced mode with version and build dropdowns The old Advanced mode had a confusing UX: a channel dropdown (Stable/Beta/Dev/Custom) plus a version dropdown that showed all versions
Normal mode (Advanced unchecked) is unchanged — still shows the single build variant combo. ArduPilot advanced mode is 4 new unit tests added (20 total, all passing):
Re: documentation (@hamishwillee) Agreed that the UI changes will need documentation updates in both QGC and PX4 docs. Happy to help draft those once this PR stabilizes. Re: airframes (@hamishwillee, @dakejahl ) I can confirm that even if you install Rover, the full aerial airframe selection is still available, making it pretty confusing!
|
|
New firmware flash ui looking good so far. |
I think we address that in a separate PR, for the time being it will remain a little confusing (as it has been) |
|
This PR has been automatically marked as stale due to 90 days of inactivity. Please rebase and update if still relevant, or it may be closed in the future. |










Summary
px4_board_name_map(60+ hardcoded board ID → firmware name entries) and the GitHub Releases API version detection with dynamic firmware discovery from the PX4 manifestDependency
Currently this PR points at the existing manifest URL (
https://px4-travis.s3.amazonaws.com/Firmware/manifest.json) which is already live with format v2 data. The manifest format and URL may be updated as the PX4 PR evolves.Changes
Commit 1: Manifest parsing backend
px4_board_name_mapand_determinePX4StableVersion()(GitHub Releases API)_downloadPX4Manifest), parse (_parsePX4Manifest), and data model structs (PX4ManifestBuildInfo_t,PX4ManifestReleaseInfo_t)_buildPX4FirmwareHashFromManifest()for firmware URL resolution per board/channelpx4DevVersion,px4ManifestLoaded,px4ManifestDownloading,px4AvailableVersions) to QML_downloadFirmware()px4_manifest_v2.jsonwith multi-board, multi-channel, bootloader/variant build coverageCommit 2: User-selectable build list UI
_buildPX4FirmwareNames()— filters bootloader builds, builds friendly display names, pre-selects_defaultbuildsetSelectedPX4Version()for version picker support in advanced modepx4FirmwareNames,px4FirmwareUrls,px4FirmwareNamesBestIndexto QMLFirmwareUpgrade.qmlonAcceptedhandler to useflashFirmwareUrl()for PX4 buildsTest plan
--unittest:PX4ManifestTest)_defaultbuild is pre-selected