Skip to content

fix: minor model/encoding validation (§4)#109

Merged
g4bri3lDev merged 1 commit into
OpenDisplay:mainfrom
balloob:fix/minor-model-validation
Jul 5, 2026
Merged

fix: minor model/encoding validation (§4)#109
g4bri3lDev merged 1 commit into
OpenDisplay:mainfrom
balloob:fix/minor-model-validation

Conversation

@balloob

@balloob balloob commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

A batch of small, self-contained §4-minor correctness fixes.

  • SensorType.BQ27220 = 5 — was missing, so the value degraded to a raw int.
  • AdvertisementData.touch_event now rejects a negative or >6 start_byte. A negative offset previously indexed from the end of the block and returned garbage; the firmware-valid range is 0–6.
  • encode_image(GRAYSCALE_4) now raises instead of returning packed 2bpp that no firmware path accepts — 4-gray needs two 1-bit controller planes (prepare_image already routes it through encode_gray4_bitplanes()). Mirrors the existing BWR/BWY guard.
  • Buzzer docstrings now cite command 0x0077 (the actual buzzer code; 0x0075 is LED STOP). Wire bytes were already correct.

Test plan

  • uv run pytest -q → 446 passed (3 new: BQ27220 == 5, encode_image(GRAYSCALE_4) raises, touch_event rejects out-of-range offsets)
  • ruff, mypy clean

🤖 Generated with Claude Code

@balloob balloob requested a review from g4bri3lDev as a code owner July 4, 2026 07:26
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- Add SensorType.BQ27220 = 5 (was missing; degraded to raw int).
- AdvertisementData.touch_event now rejects negative or >6 start_byte
  (negative indexing previously returned garbage; firmware range is 0-6).
- encode_image(GRAYSCALE_4) now raises instead of returning packed 2bpp that
  no firmware path accepts (4-gray needs two 1-bit planes; prepare_image
  already routes it through encode_gray4_bitplanes()).
- Fix buzzer docstrings to cite command 0x0077 (0x0075 is LED STOP).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JRrm95f1qNZzDM9r2SB6KW
@balloob balloob force-pushed the fix/minor-model-validation branch from 6a3323d to 8184ae5 Compare July 4, 2026 11:43
@g4bri3lDev g4bri3lDev merged commit 5f4bcd1 into OpenDisplay:main Jul 5, 2026
6 checks passed
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