mirror of
https://github.com/esphome/esphome.git
synced 2026-10-11 05:44:15 +00:00
[epaper_spi] Add is_updating condition (#20261)
This commit is contained in:
@@ -27,3 +27,8 @@ binary_sensor:
|
||||
name: Trigger
|
||||
on_press:
|
||||
- epaper_spi.full_update_next: epaper_display
|
||||
- if:
|
||||
condition:
|
||||
epaper_spi.is_updating: epaper_display
|
||||
then:
|
||||
- component.update: epaper_display
|
||||
|
||||
@@ -551,6 +551,16 @@ def test_full_update_next_action_code_generation(
|
||||
assert "epaper_display->request_full_update();" in main_cpp
|
||||
|
||||
|
||||
def test_is_updating_condition_code_generation(
|
||||
generate_main: Callable[[str | Path], str],
|
||||
component_config_path: Callable[[str], Path],
|
||||
) -> None:
|
||||
"""The epaper_spi.is_updating condition checks the configured display."""
|
||||
main_cpp = generate_main(component_config_path("full_update_next_test.yaml"))
|
||||
|
||||
assert "epaper_display->is_updating()" in main_cpp
|
||||
|
||||
|
||||
def test_model_with_no_default_init_sequence_generates(
|
||||
generate_main: Callable[[str | Path], str],
|
||||
component_config_path: Callable[[str], Path],
|
||||
|
||||
@@ -196,6 +196,21 @@ TEST(EPaperSSD1677, RequestedFullUpdateAppliesWhenTheNextUpdateStarts) {
|
||||
EXPECT_FALSE(display.run_update_state()) << "request was applied more than once";
|
||||
}
|
||||
|
||||
/// The display reports updating from the start of an update until it is back to idle.
|
||||
TEST(EPaperSSD1677, IsUpdatingUntilBackToIdle) {
|
||||
TestableSSD1677 display(16, 2);
|
||||
RecordingDelegate bus(&display.dc);
|
||||
display.install(&bus, 5);
|
||||
|
||||
EXPECT_FALSE(display.is_updating());
|
||||
display.request_full_update();
|
||||
EXPECT_TRUE(display.run_update_state());
|
||||
EXPECT_TRUE(display.is_updating());
|
||||
|
||||
EXPECT_FALSE(display.run_update_state()) << "an update with nothing drawn should not push";
|
||||
EXPECT_FALSE(display.is_updating());
|
||||
}
|
||||
|
||||
/// Nothing a partial needs lives in controller RAM any more, so a partial push skips the reset
|
||||
/// altogether; a full one still gets the hardware pulse and the software reset.
|
||||
TEST(EPaperSSD1677, PartialPushSkipsTheResetAndAFullPushKeepsIt) {
|
||||
|
||||
@@ -8,6 +8,11 @@ esphome:
|
||||
on_boot:
|
||||
then:
|
||||
- epaper_spi.full_update_next: epaper_partial
|
||||
- if:
|
||||
condition:
|
||||
epaper_spi.is_updating: epaper_partial
|
||||
then:
|
||||
- component.update: epaper_partial
|
||||
|
||||
display:
|
||||
- platform: epaper_spi
|
||||
|
||||
Reference in New Issue
Block a user