Skip to content

fix(steami_screen): Improve gauge reactivity and readability.#421

Open
MatteoCnda1 wants to merge 1 commit intomainfrom
fix/steami-screen-gauge-demo
Open

fix(steami_screen): Improve gauge reactivity and readability.#421
MatteoCnda1 wants to merge 1 commit intomainfrom
fix/steami-screen-gauge-demo

Conversation

@MatteoCnda1
Copy link
Copy Markdown
Contributor

Summary

Improve gauge_demo.py reactivity and readability on hardware. Closes #370

Changes

  • Added arc_width optional parameter to gauge() in device.py
    • Defaults to max(5, radius // 9) if not provided — no breaking change
  • Reduced _draw_arc() oversampling from x2 to x1.5 for faster rendering
  • Updated gauge_demo.py:
    • Dynamic arc color based on distance zones (WHITE / YELLOW / LIGHT)
    • Dynamic arc width — thicker when close, thinner when far
    • Moving average smoothing over 5 samples to avoid abrupt jumps
    • Redraw only when distance changes by more than 5mm (REDRAW_THRESHOLD)
    • Replaced screen.value() with screen.text() at scale=1 for readability
    • Added try/finally to clear display on exit

Checklist

  • ruff check passes
  • python -m pytest tests/ -k mock -v passes
  • Tested on hardware (STM32WB55 / STeaMi board)
  • Examples added/updated (lib/steami_screen/examples/gauge_demo.py)
  • Commit messages follow <scope>: <Description.> format

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.

fix(steami_screen): Improve gauge_demo reactivity and readability.

1 participant