Skip to content

Commit

Permalink
compatibility for st7789 240x320; re-init display on settings change
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmukai committed Aug 25, 2024
1 parent f9bffa3 commit 027b3d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/seedsigner/hardware/displays/display_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, display_type: str = DISPLAY_TYPE__ST7789, width: int = None,

if self.display_type == DISPLAY_TYPE__ST7789:
from seedsigner.hardware.displays.st7789_mpy import ST7789
if height != 240 or width not in [240, 320]:
if height not in [240, 320] or width != 240:
raise ValueError("ST7789 display only supports 240x240 or 320x240 resolutions")
self.display = ST7789(width=width, height=height)

Expand Down
4 changes: 2 additions & 2 deletions src/seedsigner/models/settings_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ def map_network_to_embit(cls, network) -> str:

# Hardware config settings
DISPLAY_CONFIGURATION__ST7789__240x240 = "st7789_240x240" # default; original Waveshare 1.3" display hat
DISPLAY_CONFIGURATION__ST7789__320x240 = "st7789_320x240"
DISPLAY_CONFIGURATION__ST7789__240x320 = "st7789_240x320"
DISPLAY_CONFIGURATION__ILI9341__240x320 = "ili9341_240x320" # natively portrait dimensions; we apply a 90° rotation
DISPLAY_CONFIGURATION__ILI9486__320x480 = "ili9486_320x480" # natively portrait dimensions; we apply a 90° rotation
ALL_DISPLAY_CONFIGURATIONS = [
(DISPLAY_CONFIGURATION__ST7789__240x240, "st7789 240x240"),
(DISPLAY_CONFIGURATION__ST7789__320x240, "st7789 320x240"),
(DISPLAY_CONFIGURATION__ST7789__240x320, "st7789 240x320"),
(DISPLAY_CONFIGURATION__ILI9341__240x320, "ili9341 240x320"),
# (DISPLAY_CONFIGURATION__ILI9486__320x480, "ili9486 320x480"), # TODO: Enable when ili9486 driver performance is improved
]
Expand Down
5 changes: 4 additions & 1 deletion src/seedsigner/views/settings_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ def run(self):
value=updated_value
)

if self.settings_entry.attr_name == SettingsConstants.SETTING__DISPLAY_COLOR_INVERTED:
if self.settings_entry.attr_name == SettingsConstants.SETTING__DISPLAY_CONFIGURATION:
self.renderer.initialize_display()

elif self.settings_entry.attr_name == SettingsConstants.SETTING__DISPLAY_COLOR_INVERTED:
self.renderer.disp.invert(enabled=updated_value == SettingsConstants.OPTION__ENABLED)

if destination:
Expand Down

0 comments on commit 027b3d5

Please sign in to comment.