Skip to content

Feat/migrate screen library#346

Open
Charly-sketch wants to merge 11 commits intomainfrom
feat/migrate-screen-library
Open

Feat/migrate screen library#346
Charly-sketch wants to merge 11 commits intomainfrom
feat/migrate-screen-library

Conversation

@Charly-sketch
Copy link
Copy Markdown
Contributor

@Charly-sketch Charly-sketch commented Apr 1, 2026

Summary

Migrates steami_screen.py (from tutorials repo) into a proper driver-style module under lib/steami_screen.

Closes #269
Closes #268
Closes #267
Opens #349, #348


Changes

  • Migrated steami_screen into lib/steami_screen/steami_screen

  • Split code into proper modules:

    • screen.py (Screen class + 10 widgets)
    • colors.py (color helpers: rgb_to_gray4, rgb_to_rgb565, rgb_to_rgb8)
    • __init__.py (exports Screen + color constants)
    • manifest.py
  • Adapted internal imports (from .colors import *)

  • Added README

  • Added basic mock tests

    33 passed, 4 deselected in 0.35s
  • Updated calibrate_magnetometer.py to use new module


Task

  • Create lib/steami_screen/ module (manifest.py, init.py, screen.py, colors.py)
  • Create lib/steami_ssd1327/ wrapper module
  • Create lib/steami_gc9a01/ wrapper module
  • Adapt imports between modules
  • Add to firmware manifest.py for freezing
  • Add basic mock tests
  • Create READMEs
  • Update calibrate_magnetometer.py imports
  • Verify make firmware && make deploy includes steami_screen frozen

Checklist

  • ruff check passes
  • python -m pytest tests/ -k mock -v passes
  • Tested on hardware (if applicable)
  • README updated
  • Examples added/updated (if applicable)
  • Commit messages follow <scope>: <Description.> format

Add initial mock test coverage for the steami_screen driver.

## Added
- FakeDisplay backend to simulate a display device
- Basic property tests: center, radius, max_chars
- Core drawing API tests: clear, show, pixel, line, rect, text
- Text helpers: title, subtitle, value
- Widgets: bar, menu, face
- Advanced widgets smoke tests: graph, gauge, compass, watch
- Geometry helpers via public API: circle (outline and fill)
- Edge cases: empty subtitle, unknown face, invalid position fallback

Tests validate that high-level API correctly delegates to the display backend
by inspecting recorded calls.

## Notes
- Tests access the backend via `dev._d` due to runner scope limitations
- No hardware dependency (pure mock)

## Remaining work
- Validate exact layout/positions (not just call presence)
- Test scaling behavior (text scale, value rendering)
- Add snapshot/visual tests (e.g. Pillow backend)
- Add hardware tests for real displays (SSD1327, GC9A01)
- Improve coverage of edge cases (bounds, clipping, long text)
@Charly-sketch Charly-sketch marked this pull request as ready for review April 2, 2026 15:11
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.

feat: Add steami_gc9a01 display wrapper. feat: Add steami_ssd1327 display wrapper. feat: Add steami_screen widget library.

2 participants