Skip to content

Fix bf2inav.py PINIO/CAMERA_CONTROL_PIN/unsupported-chip generation gaps#11691

Merged
sensei-hacker merged 2 commits into
iNavFlight:release/9.1from
sensei-hacker:fix-bf2inav-gaps
Jul 7, 2026
Merged

Fix bf2inav.py PINIO/CAMERA_CONTROL_PIN/unsupported-chip generation gaps#11691
sensei-hacker merged 2 commits into
iNavFlight:release/9.1from
sensei-hacker:fix-bf2inav-gaps

Conversation

@sensei-hacker

Copy link
Copy Markdown
Member

Summary

Fixes three gaps in src/utils/bf2inav.py, the developer utility that
generates 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 writes
    pinioBoxConfigMutable()->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's
    config.c had an empty targetConfiguration() body regardless of how
    many PINIO pins the board had.
  • Capped the PINIO loop at PINIO_COUNT (4, matching
    BOX_PERMANENT_ID_USER1..USER4 in src/main/io/piniobox.h) in both
    target.h and config.c generation. The target.h loop previously
    went up to PINIO8, which firmware has no way to wire up.
  • 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 (this pin was previously dropped
    entirely).
  • Print a warning to stderr when the source config lists a gyro chip
    INAV has no driver for yet (currently checks for LSM6DSV16X and
    LSM6DSK320X) instead of silently omitting it with no indication
    anything was skipped.

Not changed: the existing ICM42688PICM42605 substitution in
buildMap(). This looked like a bug at first glance but is actually
correct — ICM42605, ICM42686P, and ICM42688P share one INAV driver
gated only by USE_IMU_ICM42605, so rewriting the Betaflight macro
before generation is the right behavior.

Testing

Ran the script against a reconstructed DAKEFPVF405 Betaflight
config.h (2 PINIO pins, CAMERA_CONTROL_PIN, plus
ICM42688P/LSM6DSV16X/LSM6DSK320X gyro lines) and confirmed:

  • Both permanentId[0]/permanentId[1] lines are written correctly to
    config.c.
  • Both unsupported-chip warnings print to stderr.
  • CAMERA_CONTROL_PIN is generated with the expected comment.
  • The existing ICM42688PICM42605 behavior is unaffected.
  • Reviewed with the project's code-review process; addressed the one
    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)

- 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.
@sensei-hacker sensei-hacker added this to the 9.1 milestone Jul 6, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test firmware build ready — commit 0014dbc

Download firmware for PR #11691

242 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

@sensei-hacker sensei-hacker merged commit 9f57c17 into iNavFlight:release/9.1 Jul 7, 2026
7 checks passed
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.

1 participant