Conversation
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
Review Summary by QodoEnable automatic barometer detection for HUMMINGBIRD FC305
WalkthroughsDescription• Switch barometer from fixed SPL06 to automatic detection • Add DPS310 barometer support with shared I2C bus • Consolidate barometer I2C bus configuration • Fix unreliable SPL06 sensor detection issues Diagramflowchart LR
A["Fixed SPL06 Config"] -->|"Switch to autodetect"| B["BARO_AUTODETECT"]
C["SPL06 Only"] -->|"Add DPS310 support"| D["SPL06 + DPS310"]
E["Separate I2C Configs"] -->|"Consolidate"| F["Shared BARO_I2C_BUS"]
File Changes1. src/main/target/HUMMINGBIRD_FC305/config.c
|
Code Review by Qodo
1. busdev_dps310 uses hardcoded addr
|
|
Test firmware build ready — commit Download firmware for PR #11469 1 targets built. Find your board's
|
| BUSDEV_REGISTER_I2C(busdev_spl06, DEVHW_SPL06, BARO_I2C_BUS, SPL06_I2C_ADDR, NONE, DEVFLAGS_NONE, 0); | ||
| BUSDEV_REGISTER_I2C(busdev_dps310, DEVHW_DPS310, BARO_I2C_BUS, 0x76, NONE, DEVFLAGS_NONE, 0); |
There was a problem hiding this comment.
1. busdev_dps310 uses hardcoded addr 📘 Rule violation ⚙ Maintainability
The new DPS310 registration hardcodes 0x76 instead of using a centralized *_I2C_ADDR macro, making address/behavior easy to drift across modules/targets. This can break or confuse barometer autodetection if the DPS310 address differs from the SPL06 address on a given board variant.
Agent Prompt
## Issue description
`busdev_dps310` is registered with a hardcoded I2C address (`0x76`) while other baro devices use named macros. This duplicates a shared mapping and increases the chance of drift/misconfiguration across modules/targets.
## Issue Context
This target now enables `USE_BARO_DPS310` and uses `BARO_AUTODETECT`. The address should be a target-level constant (like `SPL06_I2C_ADDR`) so hardware variants can adjust it without hunting for literals.
## Fix Focus Areas
- src/main/target/HUMMINGBIRD_FC305/target.h[56-61]
- src/main/target/HUMMINGBIRD_FC305/target.c[30-31]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| BUSDEV_REGISTER_I2C(busdev_spl06, DEVHW_SPL06, BARO_I2C_BUS, SPL06_I2C_ADDR, NONE, DEVFLAGS_NONE, 0); | ||
| BUSDEV_REGISTER_I2C(busdev_dps310, DEVHW_DPS310, BARO_I2C_BUS, 0x76, NONE, DEVFLAGS_NONE, 0); |
There was a problem hiding this comment.
2. Dps310 masked by spl06 🐞 Bug ≡ Correctness
With BARO_AUTODETECT, barometer detection tries SPL06 before DPS310, and both drivers accept chip-id 0x10 from register 0x0D, so a DPS310 can be detected as SPL06 and the DPS310 driver will never run. This can defeat the intended “automatic detection” fix and may run the wrong driver on DPS310 hardware.
Agent Prompt
### Issue description
HUMMINGBIRD_FC305 now enables `BARO_AUTODETECT` and registers both SPL06 and DPS310. However, `BARO_AUTODETECT` probes SPL06 before DPS310, and both SPL06 and DPS310 drivers treat chip-id `0x10` (read from reg `0x0D`) as a valid match. This means DPS310 hardware can be misdetected as SPL06, preventing DPS310 driver initialization.
### Issue Context
- Autodetect order is implemented in `baroDetect()`.
- SPL06 and DPS310 detection both read register `0x0D` and accept `0x10`.
### Fix Focus Areas
- src/main/sensors/barometer.c[73-185]
- src/main/drivers/barometer/barometer_spl06.c[161-174]
- src/main/drivers/barometer/barometer_dps310.c[328-374]
### Suggested fix approach
Implement deterministic disambiguation when both `USE_BARO_SPL06` and `USE_BARO_DPS310` are enabled:
1. In `BARO_AUTODETECT` mode, try `baroDPS310Detect()` before `spl06Detect()` **or**
2. Add a secondary probe in SPL06 detection to reject DPS310 (or vice-versa) based on an additional register/value that differs between the parts, and only then accept the device.
Ensure that whichever approach is used does not leave the sensor in a partially-configured state if the first probe fails and the second probe is attempted.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Our customers reported that the SPL06 sometimes isn’t detected, so we’ve switched to automatic detection.

