Skip to content

Conversation

@LYNHQQ
Copy link
Contributor

@LYNHQQ LYNHQQ commented Oct 30, 2025

User description

HUMMINGBIRD FC305: Update MAG driver registration for external I2C pads


PR Type

Enhancement, New Target


Description

  • Add external I2C magnetometer driver registration for three sensor types

    • HMC5883 at address 0x1E
    • QMC5883 at address 0x0D
    • MAG3110 at address 0x0E
  • Reorder timer hardware PWM output assignments for correct servo mapping


Diagram Walkthrough

flowchart LR
  A["HUMMINGBIRD_FC305 Target"] --> B["Add MAG I2C Drivers"]
  B --> C["HMC5883, QMC5883, MAG3110"]
  A --> D["Reorder Timer Outputs"]
  D --> E["Correct PWM Servo Mapping"]
Loading

File Walkthrough

Relevant files
Enhancement
target.c
Add magnetometer I2C drivers and fix timer mapping             

src/main/target/HUMMINGBIRD_FC305/target.c

  • Register three external I2C magnetometer sensors using
    BUSDEV_REGISTER_I2C_TAG macro
  • Configure HMC5883, QMC5883, and MAG3110 with appropriate I2C addresses
    on MAG_I2C_BUS
  • Reorder timer hardware definitions to correct PWM output channel
    assignments for servo outputs S2-S4
+7/-3     

@qodo-code-review
Copy link
Contributor

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

@qodo-code-review
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Enable interrupt pin for MAG3110

For the MAG3110 sensor registration, use MAG_DRDY_PIN instead of NONE for the
drdyPin argument to enable more efficient interrupt-driven sensor reading.

src/main/target/HUMMINGBIRD_FC305/target.c [32-34]

 BUSDEV_REGISTER_I2C_TAG(busdev_hmc5883,     DEVHW_HMC5883,      MAG_I2C_BUS,        0x1E,               NONE,                   0,  DEVFLAGS_NONE,    0);
 BUSDEV_REGISTER_I2C_TAG(busdev_qmc5883,     DEVHW_QMC5883,      MAG_I2C_BUS,        0x0D,               NONE,                   0,  DEVFLAGS_NONE,    0);
-BUSDEV_REGISTER_I2C_TAG(busdev_mag3110,     DEVHW_MAG3110,      MAG_I2C_BUS,        0x0E,               NONE,                   0,  DEVFLAGS_NONE,    0);
+BUSDEV_REGISTER_I2C_TAG(busdev_mag3110,     DEVHW_MAG3110,      MAG_I2C_BUS,        0x0E,               MAG_DRDY_PIN,           0,  DEVFLAGS_NONE,    0);
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a potential performance improvement by using the MAG3110's DRDY pin for interrupt-driven reads, which is more efficient than the default polling method.

Low
  • More

@sensei-hacker sensei-hacker merged commit 4ccc8e0 into iNavFlight:master Oct 30, 2025
21 checks passed
@sensei-hacker sensei-hacker added this to the 9.0 milestone Oct 30, 2025
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.

2 participants