Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pistomp/lcd320x240.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def __init__(self, cwd, handler=None, flip=False, display=None, spi_speed_mhz=24

self.wifi_menu = WifiMenu(self)

# Skip the in-app splash when early boot already showed one (/run/lcd.init).
# Hardware reset/clear still runs every process start (see LcdIli9341).
if not display.has_system_splash:
self.splash_show(True)

Expand Down
22 changes: 9 additions & 13 deletions uilib/lcd_ili9341.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import threading
import os

# Written by early-boot splash integration before pi-stomp starts; lives in tmpfs
# (/run) for the current boot only. pi-stomp reads it but never creates it.
INIT_STAMP = "/run/lcd.init"


Expand All @@ -29,16 +31,17 @@ class LcdIli9341(LcdBase):
# TODO: Turn "flip" into all 90deg angle combinations
def __init__(self, spi, cs_pin, dc_pin, reset_pin, baudrate, flip=True):
import adafruit_rgb_display.ili9341 as ili9341
rst = reset_pin if not self.has_system_splash else None
self.disp = ili9341.ILI9341(spi, cs=cs_pin, dc=dc_pin, rst=rst, baudrate=baudrate)
self.disp = ili9341.ILI9341(
spi, cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=baudrate
)

# Use this to assure we don't have multiple threads trying to change the screen
# All methods which do change the screen (eg. dist. calls) should acquire/release
self.lock = threading.Lock()

if not self.has_system_splash:
self.clear()
self._set_stamp()
# Always reset and clear on process start so service restarts are reliable.
# has_system_splash (INIT_STAMP) only skips the in-app splash in lcd320x240.
self.clear()

# Test full screen image
self.width = self.disp.height
Expand All @@ -47,16 +50,9 @@ def __init__(self, spi, cs_pin, dc_pin, reset_pin, baudrate, flip=True):

@cached_property
def has_system_splash(self):
"""Does the OS provide a splash screen?"""
"""True when early boot left INIT_STAMP (OS splash already shown this boot)."""
return os.path.exists(INIT_STAMP)

def _set_stamp(self):
try:
with open(INIT_STAMP, "w") as _f:
pass
except Exception:
pass

def dimensions(self):
return (self.width, self.height)

Expand Down
1 change: 1 addition & 0 deletions uilib/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def update(self, image, box=None) -> None: ...

@property
def has_system_splash(self) -> bool:
"""False for backends without OS splash integration (emulator, tests)."""
return False


Expand Down