Added check connection state for i2c devices#120
Open
lumapu wants to merge 3 commits intofinitespace:masterfrom
Open
Added check connection state for i2c devices#120lumapu wants to merge 3 commits intofinitespace:masterfrom
lumapu wants to merge 3 commits intofinitespace:masterfrom
Conversation
If the BME280 isn't connected correctly you can handle this issue in your application.
finitespace
reviewed
Feb 23, 2021
| ):BME280(settings), | ||
| m_settings(settings) | ||
| { | ||
| Wire.begin(); |
Owner
There was a problem hiding this comment.
This is on the user, per previous issue
Author
There was a problem hiding this comment.
My investigations showed that Wire.begin() is necessary to have a non blocking behaviour for Wire.endTransmission().
I just tested it here again.
finitespace
reviewed
Feb 23, 2021
|
|
||
|
|
||
| /****************************************************************/ | ||
| bool BME280Spi::IsConnected(void) { |
Owner
There was a problem hiding this comment.
Since these are defaulted to true, this indicates to me that IsConnected shouldn't be in the base class.
Author
There was a problem hiding this comment.
That's correct. Now it's implemented much simpler! Thank you for your annotation.
finitespace
requested changes
Feb 26, 2021
Owner
finitespace
left a comment
There was a problem hiding this comment.
Please look at other comments and resolve
…class BME280I2C. No connection check in base class any more.
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.
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