Add chipId 0xB4 to allowlist of CST816S#534
Open
pascaldornfeld wants to merge 1 commit intolvgl-micropython:mainfrom
Open
Add chipId 0xB4 to allowlist of CST816S#534pascaldornfeld wants to merge 1 commit intolvgl-micropython:mainfrom
pascaldornfeld wants to merge 1 commit intolvgl-micropython:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Expands the CST816S touch controller chip ID allowlist to support hardware reporting chip ID 0xB4 (as reported in lvgl-micropython issue #533).
Changes:
- Add
0xB4as an additional allowed CST816S chip ID. - Update the chip ID allowlist check to accept the new value.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+210
to
211
| if chip_id not in (_ChipIDValue, _ChipIDValue2, _ChipIDValue3): | ||
| raise RuntimeError(f'Incorrect chip id ({hex(_ChipIDValue)})') |
There was a problem hiding this comment.
The RuntimeError message still hard-codes the expected chip ID as _ChipIDValue (0xB5), but the allowlist now includes 0xB4/0xB5/0xB6. This will mislead users debugging mismatches. Consider including the actual chip_id read and the full set of allowed IDs in the error message (e.g., “expected one of …, got …”).
Suggested change
| if chip_id not in (_ChipIDValue, _ChipIDValue2, _ChipIDValue3): | |
| raise RuntimeError(f'Incorrect chip id ({hex(_ChipIDValue)})') | |
| allowed_ids = (_ChipIDValue, _ChipIDValue2, _ChipIDValue3) | |
| if chip_id not in allowed_ids: | |
| allowed_hex = ", ".join(hex(i) for i in allowed_ids) | |
| raise RuntimeError( | |
| f"Incorrect chip id: expected one of {allowed_hex}, got {hex(chip_id)}" | |
| ) |
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.
See #533
Might be a duplicate of #522. Consider this to be a mr that fixes the issue following the current code structure and the other mr to refactor that piece of code.