adafruit / Adafruit_BME280_Library

Arduino Library for BME280 sensors
Other
333 stars 304 forks source link

begin() fail gracefully #49

Closed sellensr closed 5 years ago

sellensr commented 5 years ago

Adafruit_BME280.cpp

begin(void) will now try the 0x76 alternate I2C address if it fails on 0x77.

init() now sets _sensorID to the sensor ID retrieved from the chip. Variable was previous declared, but not used.

New function sensorID() returns the value of the sensor ID for diagnostics.

Should be no functional changes from existing code, except success independent of address wiring.

BME280test.ino

Provides more diagnostics in the event that bme.begin() fails

sellensr commented 5 years ago

This is prompted by watching some of my students struggle when they downloaded the wrong library for the chip they were trying to use. Similar changes would make sense in the BMP 280 and BME 680 libraries.

sellensr commented 5 years ago

The fail on the M4 build doesn't happen on my machine -- maybe a configuration issue?

siddacious commented 5 years ago

@sellensr the M4 build issue was due to a stale cache which I fixed however Doxygen is now complaining that the macro for the new address is not documented.

sellensr commented 5 years ago

Passes the documentation check now -- this Doxygen process is new to me. Does it generate a more readable document that is available somewhere?

ladyada commented 5 years ago

http://adafruit.github.io/Adafruit_BME280_Library/html/index.html

sellensr commented 5 years ago

Also https://adafruit.github.io/Adafruit_SSD1306/html/index.html now that I know the pattern, but I'm guessing this is a work in progress ;-)

hoffmannjan commented 5 years ago

tested on uno & m0 and works fine :)