Skip to content

fix(pitotmeter): guard MS5525 i2c address writes with USE_I2C for SITL builds#11570

Merged
sensei-hacker merged 1 commit into
iNavFlight:maintenance-9.xfrom
sensei-hacker:fix/ms5525-sitl-i2c-guard
May 19, 2026
Merged

fix(pitotmeter): guard MS5525 i2c address writes with USE_I2C for SITL builds#11570
sensei-hacker merged 1 commit into
iNavFlight:maintenance-9.xfrom
sensei-hacker:fix/ms5525-sitl-i2c-guard

Conversation

@sensei-hacker
Copy link
Copy Markdown
Member

Summary

The MS5525 pitotmeter driver failed to compile for SITL targets because it directly accessed pitot->busDev->busdev.i2c.address, but the i2c union member in busDevice_t.busdev is conditionally compiled under #ifdef USE_I2C. The SITL target explicitly #undef USE_I2C (target.h), so the member does not exist in that build.

Changes

  • Wrapped the two busdev.i2c.address assignment lines in pitotmeter_ms5525.c with #ifdef USE_I2C / #endif, matching the pattern already used throughout bus.h and bus.c

Testing

  • SITL target compiled successfully with the fix applied (ninja -j4 in build_sitl/)
  • No behavioral change on hardware targets where USE_I2C is defined — the guards are compile-time only
  • Note: full hardware I2C testing of the MS5525 sensor was not performed (no hardware available); the fix is a compile guard only and does not alter runtime logic

Code Review

Reviewed for correctness and INAV coding standards — no issues found. The fix mirrors the existing #ifdef USE_I2C pattern used in bus.c and bus.h for all direct busdev union member accesses.

SITL target undefines USE_I2C, so the i2c member of the busdev union
does not exist in that build. Wrap the two address-assignment lines
with #ifdef USE_I2C so the code compiles without hardware I2C support.
@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 →

@sensei-hacker sensei-hacker merged commit 7073c68 into iNavFlight:maintenance-9.x May 19, 2026
23 checks passed
@github-actions
Copy link
Copy Markdown

Test firmware build ready — commit 73c59e8

Download firmware for PR #11570

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant