fix: read chip ID with single byte read from 0xD0#15
Merged
Conversation
The official Bosch SensorAPI reads only 1 byte from register 0xD0. Register 0xD1 is undocumented — reading it was a leftover from the original Matt Hawkins driver. Return (chip_id, 0) to preserve the existing tuple API without breaking callers. Update tests to assert read_byte_data is used and called with 0xD0. Co-authored-by: agilicode <agilicode@gmail.com>
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
read_i2c_block_data(addr, 0xD0, 2)withread_byte_data(addr, 0xD0)inread_id()0xD1is undocumented in the official Bosch SensorAPI — the second byte was never meaningful(chip_id, 0)to keep the existingtuple[int, int]API intact without breaking callerstest_read_id_uses_single_byte_read: assertsread_byte_datais called with0xD0Test plan
docker compose run --rm test