Skip to content

Add chipId 0xB4 to allowlist of CST816S#534

Open
pascaldornfeld wants to merge 1 commit intolvgl-micropython:mainfrom
pascaldornfeld:main
Open

Add chipId 0xB4 to allowlist of CST816S#534
pascaldornfeld wants to merge 1 commit intolvgl-micropython:mainfrom
pascaldornfeld:main

Conversation

@pascaldornfeld
Copy link

@pascaldornfeld pascaldornfeld commented Mar 1, 2026

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.

Copilot AI review requested due to automatic review settings March 1, 2026 20:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 0xB4 as 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)})')
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}"
)

Copilot uses AI. Check for mistakes.
@pascaldornfeld pascaldornfeld changed the title Add chipId 0xB4 to allowlist Add chipId 0xB4 to allowlist of CST816S Mar 3, 2026
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

Successfully merging this pull request may close these issues.

2 participants