Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deep sleep between updates for waveshare epaper 1.54in and 1.54inv2 #5961

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

mathieu-mp
Copy link
Contributor

@mathieu-mp mathieu-mp commented Dec 18, 2023

What does this implement/fix?

Waveshare 1.54in and 1.54v2 displays are always powered on (not asleep) which causes damage to the display over time. Waveshare warns of display damage if the display is left on for an extended period of time:

I've updated the existing code of the WaveshareEPaperTypeA for 1.54in and 1.54inv2 display variants to fix this problem:

  • When initializating the display: if a reset pin is provided and the display are of 1.54in or 1.54inv2, populate a boolean deep_sleep_between_updates_ protected variable.
  • On display update, following the "Normal Operation Flow" provided by Wavehsare:
    • Reset the display
    • Reconfigure it
    • Update the display (no changes done to that part)
    • Set the display back in deep sleep mode

I tried to make the code reusable to eventually include extra models to this the deep sleep feature.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes #5235

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

display:
- platform: waveshare_epaper
  id: epaper
  spi_id: spi_bus
  cs_pin: D8
  dc_pin: D0
  busy_pin: D6
  reset_pin: D4 # Required to enable deep-sleep on 1.54in displays
  model: 1.54in

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@mathieu-mp mathieu-mp marked this pull request as ready for review December 18, 2023 15:38
@jesserockz jesserockz added this to the 2023.12.0b4 milestone Dec 19, 2023
@jesserockz jesserockz merged commit 52b9668 into esphome:dev Dec 19, 2023
48 checks passed
@mathieu-mp mathieu-mp deleted the waveshare-1.54in-deep-sleep branch December 19, 2023 16:54
@jesserockz jesserockz mentioned this pull request Dec 20, 2023
@jesserockz jesserockz mentioned this pull request Dec 20, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Waveshare 1.54in stays always on
2 participants