-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Allow ESP8266 to use multiple i2c busses #6145
Conversation
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
124ccaa
to
c237e36
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #6145 +/- ##
==========================================
- Coverage 53.69% 53.64% -0.05%
==========================================
Files 50 50
Lines 9398 9403 +5
Branches 1652 1653 +1
==========================================
- Hits 5046 5044 -2
- Misses 4053 4059 +6
- Partials 299 300 +1 ☔ View full report in Codecov by Sentry. |
…ltiple i2c busses on ESP8266
c237e36
to
9de17fe
Compare
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
What does this implement/fix?
I have some esp8266 D1 devices which I made which have both an AHT10 and BMP025 sensor attached, but I wired these to separate i2c busses. With my own custom firmware these worked just fine, but when installing esphome and setting up the i2c busses I found that only one sensor at a time would be working.
I traced this down to the Wire.h library, which stores SDA and SCL pin assignments in global variables 🙄
This PR works around this by resetting the SDA/SCL assignments and clock frequency between every i2c read and write.
Types of changes
Related issue or feature (if applicable):
EDIT: found an issue relating to this: esphome/issues#2558
Pull request in esphome-docs with documentation (if applicable): N/A
Test Environment
Example entry for
config.yaml
:Checklist:
tests/
folder). - no tests exist for i2c componentIf user exposed functionality or configuration variables are added/changed: N/A