Fix bf2inav.py PINIO/CAMERA_CONTROL_PIN/unsupported-chip generation gaps#11691
Merged
sensei-hacker merged 2 commits intoJul 7, 2026
Merged
Conversation
- Actually write pinioBoxConfigMutable()->permanentId[n] lines in generated config.c; they previously existed only as commented-out Python source and never reached the file, so every generated target had an empty targetConfiguration() regardless of how many PINIO pins it defined. - Cap the PINIO loop at PINIO_COUNT (4) in both target.h and config.c generation -- the target.h loop previously went up to PINIO8 with no way to ever wire those beyond what firmware supports. - Generate CAMERA_CONTROL_PIN when present in the source config, with a comment noting it has no consuming driver prior to INAV 10.0's planned PWM-capable PINIO feature. - Warn on stderr when a Betaflight source lists a known-unsupported gyro chip (LSM6DSV16X, LSM6DSK320X) instead of silently omitting it.
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Test firmware build ready — commit Download firmware for PR #11691 242 targets built. Find your board's
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three gaps in
src/utils/bf2inav.py, the developer utility thatgenerates a starting-point INAV target from a Betaflight
config.h.Found while manually porting the DAKEFPVF405 target (#11690) and
confirmed against the two AxisFlying target tasks currently queued,
which will use this generator.
Changes
writeConfigC()now actually writespinioBoxConfigMutable()->permanentId[n] = BOX_PERMANENT_ID_USERn+1;lines for each PINIO pin found in the source config. Previously these
lines existed only as commented-out Python source in the script itself
and were never
file.write()'d, so every generated target'sconfig.chad an emptytargetConfiguration()body regardless of howmany PINIO pins the board had.
PINIO_COUNT(4, matchingBOX_PERMANENT_ID_USER1..USER4insrc/main/io/piniobox.h) in bothtarget.handconfig.cgeneration. Thetarget.hloop previouslywent up to
PINIO8, which firmware has no way to wire up.CAMERA_CONTROL_PINwhen present in the source config, witha comment noting it has no consuming driver prior to INAV 10.0's
planned PWM-capable PINIO feature (this pin was previously dropped
entirely).
INAV has no driver for yet (currently checks for
LSM6DSV16XandLSM6DSK320X) instead of silently omitting it with no indicationanything was skipped.
Not changed: the existing
ICM42688P→ICM42605substitution inbuildMap(). This looked like a bug at first glance but is actuallycorrect —
ICM42605,ICM42686P, andICM42688Pshare one INAV drivergated only by
USE_IMU_ICM42605, so rewriting the Betaflight macrobefore generation is the right behavior.
Testing
Ran the script against a reconstructed DAKEFPVF405 Betaflight
config.h(2 PINIO pins,CAMERA_CONTROL_PIN, plusICM42688P/LSM6DSV16X/LSM6DSK320Xgyro lines) and confirmed:permanentId[0]/permanentId[1]lines are written correctly toconfig.c.CAMERA_CONTROL_PINis generated with the expected comment.ICM42688P→ICM42605behavior is unaffected.actionable finding (PINIO loop bound in
target.h) before this PR.This is a Python developer-tooling script, not shipped firmware — no
hardware target build is applicable to this change.
Related
Related PR: #11690 (DAKEFPVF405 target update, where these gaps were found)