Skip to content

Fix LCD booting with inverted colors on ST7789 displays - #404

Open
3rdIteration wants to merge 1 commit into
devfrom
fix/lcd-boot-invert-colors
Open

Fix LCD booting with inverted colors on ST7789 displays#404
3rdIteration wants to merge 1 commit into
devfrom
fix/lcd-boot-invert-colors

Conversation

@3rdIteration

Copy link
Copy Markdown
Owner

Summary

  • ST7789 init sequences (ST7789.py, st7789_mpy.py) hardcode INVON (0x21) as a boot-time register step, independent of the "Invert colors" setting.
  • Renderer.initialize_display() only forced the hardware register ON when the setting was Enabled; it never forced it OFF when Disabled (the default), so the display booted inverted and stayed that way until the setting was toggled off/on in the Settings menu.
  • This also reproduces whenever the "Display type" setting is changed (e.g. st7789_320x240st7789_240x240), since driver swaps go through the same initialize_display() path.
  • Fix: always sync the hardware inversion register to match the setting (both true and false) after instantiating a display driver, mirroring the logic already used by the Settings-view toggle handler.

Test plan

  • pytest tests/ -k "renderer or display" — 10 passed
  • Full pytest tests/ suite — 898 passed, 135 skipped, 1 xfailed, 0 failed (excluding test_smartcard_hardware.py, which requires a physical smartcard reader and is unaffected by this change)
  • Manual verification on ST7789 hardware: confirm display boots with correct colors when "Invert colors" is Disabled, boots inverted when Enabled, and stays correct after switching "Display type" between st7789_240x240/st7789_320x240

🤖 Generated with Claude Code

The ST7789 init sequences hardcode INVON (0x21) as a boot-time register
step, independent of the "Invert colors" setting. Renderer only forced
the register ON when the setting was enabled, never forced it OFF when
disabled, so displays booted inverted until the setting was toggled.
Now the renderer always syncs the hardware register to match the
setting, both at boot and whenever the display driver is reloaded.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant