Fix I2C address claiming and probe both BMP/BME addresses - #3234
Open
agessaman wants to merge 2 commits into
Open
Fix I2C address claiming and probe both BMP/BME addresses#3234agessaman wants to merge 2 commits into
agessaman wants to merge 2 commits into
Conversation
Several table entries share an address and not every driver verifies a chip ID: INA226::begin() only checks that the address ACKs, so an SHT4x at 0x44 was also registered as an INA226 and reported junk current on a second channel. Mark the address consumed once a driver initializes it so later entries cannot re-claim the same device.
Grove and other Bosch modules strap SDO high, so the 0x76-only table never initialized them. Add an alternate-address entry per Bosch sensor; the bus scan still gates every probe, and all four drivers verify a chip ID before claiming an address. Each sensor type has a single static driver instance, so skip an entry whose query is already active: the alternate address is a fallback, not a second device.
mikecarper
added a commit
to mikecarper/MeshCore
that referenced
this pull request
Aug 18, 2026
Use automatic 0x76/0x77 fallback probing while preserving the newer sensor manager implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bosch BMP/BME parts pick their I2C address from the SDO pin: 0x76 or 0x77.
SENSOR_TABLEonly ever had the 0x76 entry, so anything strapped high got seen by the bus scan and then quietly skipped. That covers Grove modules and most of the cheap BMP280 breakouts. A user hit this and found their sensor only worked once they moved it to 0x76.There's already a per-variant
TELEM_*_ADDRESSoverride, but it doesn't help here.First commit claims an address once a driver has successfully initialized it. That's mostly groundwork for the second commit, but it fixes something on its own: several table entries share an address, and not every driver bothers to check a chip ID.
INA226::begin()only checks that the address ACKs. In the defaultsensor_baseboth SHT4X and INA226 sit at 0x44, so a real SHT4x was also being registered as an INA226 and reporting junk current on a second channel.Second commit adds the alternate-address entry for each Bosch sensor. There's one static driver instance per sensor type, so an entry whose query function is already active gets skipped—the second address is a fallback, not a second device. Without that check, two same-type parts at 0x76 and 0x77 would register two channels that both read whichever one initialized last.
On safety: entries whose address didn't ACK during
scanI2CBusstill never get touched, and all four drivers verify a chip ID before they'll claim an address (Adafruit_BMP280against thechipidargument,Adafruit_BME280against 0x60,bme68x_initagainstBME68X_CHIP_ID,Adafruit_BMP085against 0x55). BMP085 stays last in the table, so a real BMP180 at 0x77 still ends up with its address after the newer drivers turn it down.One flag:
bme68x_init()does a soft reset before it reads the chip ID, so with BME680 compiled in, anything that ACKs at 0x77 now takes a blind0xE0 <- 0xB6. That's the standard soft-reset register on Bosch parts, and it was already happening at 0x76, so I don't think it's a problem—but it is new behavior at the second address.Built
Heltec_v3_sensor,T_Beam_S3_Supreme_SX1262_repeaterandLilyGo_T-Echo_repeater. The last two pinTELEM_BME280_ADDRESS=0x77, so they reverse the direction. The overrides are redundant now, but I left them alone rather than grow the diff. The fix was tested on a Station G3 using a BMP280 connected via Grove.