Fix SHT2x detection for INA219 addresses#10482
Open
balya wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves I2C sensor detection by validating SHT2x serial-number responses before registering an overlapping INA-series address as SHTXX, addressing false positives that blocked INA219 telemetry.
Changes:
- Adds Sensirion CRC-8 validation for SHT2x serial-number bytes.
- Reads and checks both SHT2x serial-number response blocks before accepting the detection.
- Allows failed SHT2x validation to fall through to existing INA219 detection behavior.
Contributor
|
Good job. I don't have a sht21, but this looks good to me. |
Contributor
|
@Tomas-Kuchta-FPV You have a sht21 still, right? Can you give this a go? |
Right I have it. But it's now integrated on a wall sadly, so I have no good access to it and also I don't want to mess with it anymore. |
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.

Summary
Fixes #10110.
This PR fixes false-positive SHT2x/SHTxx detection on I2C addresses shared with INA219/INA-series sensors.
INA219 can respond on
0x40/0x41, which overlaps with SHT2x probing. The previous SHT2x serial-number probe only checked that enough bytes were returned, so an INA219 could be incorrectly registered asSHTXX. That caused environment telemetry initialization to fail and prevented INA219 voltage readings from being reported correctly.This change validates the SHT2x serial-number response using the Sensirion CRC-8 checksum before accepting the device as SHT2x. If the CRC validation fails, detection falls through to the existing INA detection path.
Testing
Tested on an ESP32-S3 E22 W5500 node with INA219 at I2C address
0x41.Before this change, boot logs showed:
After this change, the same hardware is detected correctly:
🤝 Attestations