Skip to content

Fixed sensor initialization and automatic selection of I2C addresses for BME/BMP sensors#2452

Open
IoTThinks wants to merge 1 commit intomeshcore-dev:devfrom
IoTThinks:MCdev-Fixed-Sensor-Initialization-and-AutoI2C-202604
Open

Fixed sensor initialization and automatic selection of I2C addresses for BME/BMP sensors#2452
IoTThinks wants to merge 1 commit intomeshcore-dev:devfrom
IoTThinks:MCdev-Fixed-Sensor-Initialization-and-AutoI2C-202604

Conversation

@IoTThinks
Copy link
Copy Markdown
Contributor

@IoTThinks IoTThinks commented Apr 30, 2026

Fixed sensor initialization and automatic selection of I2C addresses for BME/BMP sensors

  • Added i2c_probe to probe sensors before initializing to avoid setup unnecessary sensors and to avoid bugs from unused sensors to impact the main code.
    Current issue Heltec V3.2 wire.cpp i2cRead Error #1086.
    One time, I saw Adafruit_VL53L0X crashed Heltec boards and this i2c_probe could mitigate / avoid the crash.
  • Added automatically selection of I2C addresses 0x76 and 0x77 for BME280, BMP280 and BME680.
    This is to avoid the headache to mess around with I2C addresses of BME280, BMP280 and BME680.
    If the I2C address is defined, the automatic selection of I2C addresses is ignored.

Tested and works perfect for 3 releases of my MeshCore variant.
image

…for BME/BMP sensors

- Added i2c_probe to probe sensors before initializing to avoid setup unnecessary sensors and to avoid bugs from unused sensors to impact the main code
- Added automatically selection of I2C addresses 0x76 and 0x77 for BME280, BMP280 and BME680.
@IoTThinks
Copy link
Copy Markdown
Contributor Author

Without this PR, we need to solder most of the BME/BMP sensors to fit the 0x76 address for MeshCore.
And not all boards have the same default I2C addresses.
image
image

Copy link
Copy Markdown
Contributor

@446564 446564 left a comment

Choose a reason for hiding this comment

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

🙌 tested on xiao nrf with bme/bmp280, no 680 on hand.

nice work

@IoTThinks
Copy link
Copy Markdown
Contributor Author

Great.
It has been working for a while.

@446564
Copy link
Copy Markdown
Contributor

446564 commented May 4, 2026

@recrof

@recrof
Copy link
Copy Markdown
Member

recrof commented May 4, 2026

there is new sensor detection PR that should be much more robust.. I'm bit conflicted which PR to merge first, because sensor init was not the best for long time. mentioned PR: #2327

@446564
Copy link
Copy Markdown
Contributor

446564 commented May 5, 2026

I like them both actually.

With this one I like the change to have multiple addresses for a given sensor as there are many with such possibilities.

I like #2327 because it scans all addresses.

I wish we moved away from build flags now that we are scanning, I know if saves a bit of space in fw but it would be nice for the end user to just add a sensor and have it work.

@IoTThinks
Copy link
Copy Markdown
Contributor Author

IoTThinks commented May 6, 2026

This is about reliability vs. major feature changes.
More code changes means less reliability.

This PR is a maintenance patch while PR #2327 is a new feature patch.
This PR has gone through extensive internal and community testing.

If you push PR #2327, please perform extensive testings too.
I'm fine with both ways.

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.

4 participants