[epaper_spi] Ensure test card gets drawn (#20804)

This commit is contained in:
Clyde Stubbs
2026-10-19 10:33:13 +13:00
committed by Jesse Hills
parent 79823c89ab
commit 235c614e68
3 changed files with 35 additions and 0 deletions
+1
View File
@@ -208,6 +208,7 @@ def _final_validate(config) -> None:
else:
# If no drawing methods are configured, and LVGL is not enabled, show a test card
config[CONF_SHOW_TEST_CARD] = True
config[CONF_UPDATE_INTERVAL] = update_interval("1min")
elif CONF_UPDATE_INTERVAL not in config:
config[CONF_UPDATE_INTERVAL] = update_interval("1min")
@@ -0,0 +1,22 @@
esphome:
name: test
esp32:
board: esp32dev
spi:
clk_pin: GPIO18
mosi_pin: GPIO19
display:
- platform: epaper_spi
id: epaper_display
model: ssd1677
dc_pin: GPIO21
busy_pin: GPIO22
reset_pin: GPIO23
cs_pin: GPIO5
update_interval: never
dimensions:
width: 200
height: 200
@@ -580,3 +580,15 @@ def test_model_with_no_default_init_sequence_generates(
# init_sequence_length, ...); a length of 0 confirms the empty init
# sequence array was generated instead of raising during code generation.
assert re.search(r"epaper_spi::EPaperT133A01\([^;]*,\s*\w+,\s*0\);", main_cpp)
def test_test_card_overrides_update_interval(
generate_main: Callable[[str | Path], str],
component_config_path: Callable[[str], Path],
) -> None:
"""With nothing else to draw, update_interval is not left at never for the test card."""
main_cpp = generate_main(component_config_path("test_card_update_interval.yaml"))
match = re.search(r"epaper_display->set_update_interval\((\d+)\);", main_cpp)
assert match is not None
assert int(match.group(1)) != 4294967295