Added check connection state for i2c devices #120
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.
If the BME280 isn't connected correctly you can handle this issue in your application.
I had an assembly using the AskSinPP library. The sensor was damaged during use. While debugging the sketch stopped while initializing the BME280 sensor. If there is a check whether the sensor is acknowledging you can easier debug a hardware defect.
Related issue # and issue behavior
none
Description of changes/fixes
added new member function the check the connection by reading only the slave address. The 'endTransaction' command returns if there was a NACK on I2C line.
@mention a person to review
Steps to test
Disconnect BME280 from your microcontroller (works only for I2C BME280s). Check the return status of BME280::Initialize() maybe output some information that the sensor can't be found.
Second do the positive test by connecting the BME280 through I2C bus.
Any outstanding TODOs or known issues
not tested for BRZO, but the documentation says the same behaviour as the Wire library
not tested for SPI connections - only minor changes