Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect that ADS1x15 is not present? #13

Open
Humancell opened this issue Jan 23, 2019 · 6 comments
Open

Detect that ADS1x15 is not present? #13

Humancell opened this issue Jan 23, 2019 · 6 comments

Comments

@Humancell
Copy link

Hello,

Thank you for taking this library forward. I appreciate the work you have put into it ... Adafruit owes you for doing their work for them. :-)

I noticed that if the ADS1x15 is NOT present on the I2C bus, there is no indication that I can find that my code can use to know the values are all "bad". Often, in other libraries, the .begin() method will fail if the chip is not detected on the I2C bus.

Is there currently a way in the library to determine that an ADS1x15 chip is or is not present and responding?

Do you have ideas or suggestions on implementing such a test?

Thanks again!

@soligen2010
Copy link
Owner

I don't think this is implemented. I guess this could be done if you can find a command to send the chip that has a predictable response.

I have renewed hopes that Adafruit will merge this into their base, in which case you could make this addition to the original library. I don't think I would take a pull request right now in hopes that they are going to merge what I already have. However, you could add it to your own fork then send it in once we see where things land.

@Humancell
Copy link
Author

Yes ... I looked through the code and hadn't spotted anything. There are a few easy ways this can be added:

  1. When instantiating the class, a simple Wire test can be done:
Wire.beginTransmission(i2cAddress);
error = Wire.endTransmission();

The return value "error" will be 0 if there is a device at that address. Not necessarily an ADS1x15, but at least a device is present.

  1. I also noticed that the readRegister() and writeRegister() are not checking the return values for Wire.endTransmission() which might be returning errors that are simply being ignored.

I'm early in my testing, but might fork if I decide to implement one or both of these "fixes".

I did reach out to Adafruit to ask them about these libraries last week. That is when I found your fork. They explained about the overhead of maintaining libraries, and having to do regression testing, and testing across multiple boards. They asked if I'd like to "take care" of a repo. I'm thinking about what I want to ask for in return. :-)

@soligen2010
Copy link
Owner

In in RF24 library (for the NRF24L01) they implemented a separate isChipConnected() method. Another option. This way worked well for me because I could detect if one or 2 chips were connected and adjust the behavior accordingly.

I guess by default I am "taking care" of this library as this fork has so much more functionality than the original. Not everyone finds this fork, so I see the same changes being done by multiple people.

If Adafruit continues to not do the merge after a while, I'll take what you come up with here.

@trycoon
Copy link

trycoon commented Aug 17, 2019

Any response from Adafruit?

@soligen2010
Copy link
Owner

I think there is never going to be merged.

@trycoon
Copy link

trycoon commented Aug 21, 2019

Well they are not famous for maintaining their libraries... 😕
Maybe you could maintain this fork?

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

No branches or pull requests

3 participants