My Home-IoT
Find a file
Tim Niemueller 11f1e28139
Make per-loop display clearing optional (#2626)
Currently, in each loop during DisplayBuffer::update_() the display is
cleared by calling DisplayBuffer::clear().

This prevents more efficient display usages that do not render the
screen in each loop, but only if necessary. This can be helpful, for
example, if images are rendered. This would cause the loop time to be
exceeded frequently.

This change adds a new optional flag "auto_clear" that can be used to
control the clearing behavior. If unset, the DisplayBuffer defaults to
enabled auto clearing, the current behavior and thus backward compatible.

This flag applies to displays that use DisplayBuffer.

Example excerpt:
globals:
  - id: state
    type: bool
    restore_value: no
    initial_value: "false"
  - id: state_processed
    type: bool
    restore_value: no
    initial_value: "false"

switch:
  - platform: template
    name: "State"
    id: state_switch
    lambda: |-
      return id(state);
    turn_on_action:
      - globals.set:
          id: state
          value: "true"
      - globals.set:
          id: state_processed
          value: "false"
    turn_off_action:
      - globals.set:
          id: state
          value: "false"
      - globals.set:
          id: state_processed
          value: "false"

display:
  - platform: ili9341
    # ...
    auto_clear_enabled: false
    lambda: |-
      if (!id(state_processed)) {
        it.fill(COLOR_WHITE);
        if (id(state)) {
          it.image(80, 20, id(image1));
        } else {
          it.image(80, 20, id(image2));
        }
        id(state_processed) = true;
      }

Co-authored-by: Tim Niemueller <timdn@google.com>
2021-11-03 17:56:09 +01:00
.devcontainer Redo docker build system with buildkit+multi-stage and cache pio packages (#2338) 2021-09-20 09:07:38 +02:00
.github Constrain GH Actions workflows permissions (#2625) 2021-10-26 10:55:27 +02:00
.vscode Refactor clang-tidy script to use actual compiler flags and includes (#2133) 2021-08-09 22:43:18 +02:00
docker Update docker base images (#2583) 2021-10-21 20:07:44 +02:00
esphome Make per-loop display clearing optional (#2626) 2021-11-03 17:56:09 +01:00
script Fix default environment for clang-tidy (#2420) 2021-09-30 16:24:02 +02:00
tests Make per-loop display clearing optional (#2626) 2021-11-03 17:56:09 +01:00
.clang-format Configure clang-format for consistent pointer alignment (#1890) 2021-06-10 12:55:20 +02:00
.clang-tidy Fix clang-tidy header filter (#2385) 2021-09-24 18:02:28 +02:00
.coveragerc Unittests for esphome python code (#931) 2020-03-12 14:27:22 -07:00
.dockerignore More VSCode devcontainer improvements (#1934) 2021-06-22 16:37:05 +02:00
.editorconfig Adds support cpp to vscode (#1828) 2021-06-15 10:45:22 +12:00
.gitattributes Fix line endings normalization (#2407) 2021-09-30 18:07:28 +02:00
.gitignore Allow compilation against IDF from repository (#2355) 2021-09-21 17:12:17 +02:00
.gitpod.yml extract and use current version of python 3 (#938) 2020-01-09 13:27:39 -08:00
.pre-commit-config.yaml Rename master branch to release (#1976) 2021-07-02 15:42:36 +02:00
CODE_OF_CONDUCT.md Update email addresses (#1733) 2021-05-03 11:51:10 +12:00
CODEOWNERS Add support for CSE7761 sensor (#2546) 2021-10-28 20:58:48 +02:00
CONTRIBUTING.md Drop obsolete comments from CONTRIBUTING.md (#2271) 2021-09-12 22:04:35 +02:00
LICENSE 🏗 Merge C++ into python codebase (#504) 2019-04-17 12:06:00 +02:00
MANIFEST.in Fix sdist missing requirements.txt (#1214) 2020-07-28 14:29:01 +02:00
platformio.ini ESP8266 disable PIO LDF (#2608) 2021-10-23 19:44:55 +02:00
pylintrc add-black (#1593) 2021-03-07 16:03:16 -03:00
pyproject.toml add-black (#1593) 2021-03-07 16:03:16 -03:00
pytest.ini Unittests for esphome python code (#931) 2020-03-12 14:27:22 -07:00
README.md Rename master branch to release (#1976) 2021-07-02 15:42:36 +02:00
requirements.txt Bump tzlocal from 4.0.2 to 4.1 (#2645) 2021-10-30 20:12:57 +02:00
requirements_optional.txt Bump base image to 3.4.0 (#1879) 2021-06-08 22:03:04 +02:00
requirements_test.txt Bump black from 21.9b0 to 21.10b0 (#2650) 2021-11-01 21:03:23 +01:00
sdkconfig.defaults [esp-idf fix] increase FreeRTOS ticker loop from 100Hz to 1kHz (#2527) 2021-10-15 22:06:49 +02:00
setup.cfg add-black (#1593) 2021-03-07 16:03:16 -03:00
setup.py Fix pypi download url (#2177) 2021-08-18 15:39:57 +12:00

ESPHome Discord Chat GitHub release

ESPHome Logo

Documentation: https://esphome.io/

For issues, please go to the issue tracker.

For feature requests, please see feature requests.