Skip to content

Feature/madflight fc3 config new sensors#1030

Open
gintaris wants to merge 4 commits intobetaflight:masterfrom
gintaris:feature/madflight-fc3-sensors
Open

Feature/madflight fc3 config new sensors#1030
gintaris wants to merge 4 commits intobetaflight:masterfrom
gintaris:feature/madflight-fc3-sensors

Conversation

@gintaris
Copy link

@gintaris gintaris commented Feb 16, 2026

PR: MADFLIGHT_FC3 - Add internal I2C sensor configuration

Repository: betaflight/config
Branch: feature/madflight-fc3-sensors
Target: master

Title

MADFLIGHT_FC3: Add internal I2C sensor configuration

Description

Summary

Update MADFLIGHT_FC3 board configuration to enable internal I2C sensors.

Changes

  • I2C0 Configuration: Added 100kHz clock speed and internal pull-ups for reliable sensor communication
  • BMP5xx Barometer: Configured internal BMP580/BMP581 on I2C0 (replaces external baro on I2C1)
  • MMC5603 Magnetometer: Configured internal compass on I2C0 (replaces external mag on I2C1)
  • INA226 Power Monitor: Added current/voltage sensor configuration on I2C0
  • Motor Protocol: Use default DSHOT600 (Oneshot125 commented out for analog ESC reference)
  • MSP Displayport: Enabled OSD via PIOUART0 for digital VTX systems
  • Cleanup: Removed unused gyro defines (LSM6DSO, LSM6DSV16X)

Related PRs (betaflight/betaflight)

  • #14925 - BMP580/BMP581 barometer driver
  • #14924 - MMC560x magnetometer driver
  • #14927 - INA226 power monitor driver

Hardware

  • Board: MADFLIGHT FC3
  • MCU: RP2350B (Raspberry Pi Pico 2)
  • Internal sensors: BMP580/BMP581, MMC5603, INA226

Testing

  • Compiled locally with make MADFLIGHT_FC3
  • Hardware tested with local build

PR Link

Create PR: https://github.com/gintaris/betaflight_config/pull/new/feature/madflight-fc3-sensors

Set:

  • Base repository: betaflight/config
  • Base: master
  • Head repository: gintaris/betaflight_config
  • Compare: feature/madflight-fc3-sensors

Summary by CodeRabbit

  • New Features

    • Switched battery/current metering to INA226 over I2C with default addresses, scaling and limits.
    • Added internal barometer (BMP580/BMP581) and magnetometer (MMC5603) support on the board's internal I2C bus and enabled I2C clock/pull-ups.
    • Added additional internal gyro/accelerometer variants for broader sensor support.
  • Bug Fixes

    • Removed external I2C sensor references and reduced reliance on external I2C bus to improve sensor routing and noise.

Update MADFLIGHT FC3 configuration for internal I2C sensors:

Changes:
- Add INA226 power monitor configuration (I2C0, 0x40, 2mΩ shunt)
- Use INA226 for both current and voltage measurement
- Configure I2C0 at 100kHz with internal pull-ups
- Add BMP580 barometer on I2C0
- Add MSP Displayport OSD configuration
- Set DSHOT600 as default motor protocol (ONESHOT125 as fallback)
- Remove ADC-based battery voltage sensing

Sensors on I2C0 bus:
- BMP580 barometer (0x47)
- MMC5603 magnetometer (0x30)
- INA226 power monitor (0x40)

Tested on: MADFLIGHT FC3 (RP2350B)
Matches betaflight/betaflight PR #14925 BMP5xx driver rename.
Remove Oneshot125 override - use platform default DSHOT600.
Oneshot125 commented out for reference if analog ESCs needed.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

Switches board sensors to internal I2C0: enables I2C0 clock/pull-up, replaces ADC VBAT metering with INA226-based current/voltage sensing, moves barometer and magnetometer to BMP580/BMP581 and MMC5603 on I2C0, and adds related sensor/macros in configs/MADFLIGHT_FC3/config.h.

Changes

Cohort / File(s) Summary
Board configuration
configs/MADFLIGHT_FC3/config.h
Enabled I2C0 (I2C0_CLOCKSPEED, USE_I2C_PULLUP), switched VBAT/current metering from ADC to INA226 (USE_CURRENT_METER_INA226, DEFAULT_INA226_*, DEFAULT_CURRENT_METER_SOURCE, DEFAULT_VOLTAGE_METER_SOURCE), enabled internal baro/mag (USE_BARO_BMP580, USE_BARO_BMP581, DEFAULT_BARO_BMP580, BARO_I2C_INSTANCE=I2CDEV_0, USE_MAG_MMC5603, MAG_I2C_INSTANCE=I2CDEV_0), and added internal gyro/accel variants (LSM6DSO/LSM6DSV16X). Comments/old ADC/I2C1 sensor references updated/removed.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

Awaiting prototype samples

Suggested reviewers

  • haslinghuis
  • blckmn
  • ot0tot
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description includes detailed summaries of changes, hardware details, and testing information, but lacks mandatory checklist items and compliance documentation required by the template. Add the mandatory checklist from the template (schematics review, hardware testing, guidelines compliance, connector standards, flight testing) and confirm adherence to manufacturer design guidelines.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding new internal I2C sensor configuration to the MADFLIGHT_FC3 board, which aligns with the substantial sensor-related changes in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@haslinghuis haslinghuis left a comment

Choose a reason for hiding this comment

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

Awaiting updates to use CURRENT_METER_INA226 and VOLTAGE_METER_INA226

  • there is no USE_VOLTAGE_METER_INA226 define.

@haslinghuis
Copy link
Member

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Add internal sensor configuration for MADFLIGHT FC3:

INA226 Power Monitor (PR #14927):
- USE_CURRENT_METER_INA226 enabled
- DEFAULT_CURRENT_METER_SOURCE = CURRENT_METER_INA226
- DEFAULT_VOLTAGE_METER_SOURCE = VOLTAGE_METER_INA226
- Config: 0x40 address, 2mΩ shunt, 50A max

BMP580 Barometer (PR #14925):
- USE_BARO_BMP580/BMP581 on I2C0
- DEFAULT_BARO_BMP580

MMC5603 Magnetometer (PR #14924):
- USE_MAG_MMC5603 on I2C0

I2C0 config:
- 100kHz clock speed
- Internal pull-ups enabled

Addresses reviewer comment requesting CURRENT_METER_INA226
and VOLTAGE_METER_INA226 usage.
@gintaris
Copy link
Author

Awaiting updates to use CURRENT_METER_INA226 and VOLTAGE_METER_INA226

  • there is no USE_VOLTAGE_METER_INA226 define.

There are several PR's dependencies with this one :
betaflight/betaflight#14927
betaflight/betaflight#14925
betaflight/betaflight#14924

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.

2 participants