From 376acbff367612a7d8a16ad486510b352e283503 Mon Sep 17 00:00:00 2001 From: Greg Dickson Date: Sun, 8 May 2022 11:38:12 +0800 Subject: [PATCH 1/7] added epd_powerdown On lilygo disable display power but not touch screen. The epd power flag was re-purposed as power enable however it also disables the touch. this workaround may still leave power on to epd and as such may cause other problems such as grey screen. please also use poweroff when you sleep the system wake on touch will still work just not the I2C interface. --- src/epd_driver/config_reg_v2.h | 22 ++++++++++++++++++++++ src/epd_driver/display_ops.c | 7 +++++++ src/epd_driver/include/epd_driver.h | 11 +++++++++++ 3 files changed, 40 insertions(+) diff --git a/src/epd_driver/config_reg_v2.h b/src/epd_driver/config_reg_v2.h index c6e6242b..cae25c19 100644 --- a/src/epd_driver/config_reg_v2.h +++ b/src/epd_driver/config_reg_v2.h @@ -66,6 +66,28 @@ static void cfg_poweron(epd_config_register_t *cfg) { // END POWERON } +#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47) +static void cfg_powerdown(epd_config_register_t *cfg) { + // This was re-purposed as power enable however it also disables the touch. + // this workaround may still leave power on to epd and as such may cause other + // problems such as grey screen. + cfg->pos_power_enable = false; + push_cfg(cfg); + busy_delay(10 * 240); + + cfg->neg_power_enable = false; + cfg->pos_power_enable = false; + push_cfg(cfg); + busy_delay(100 * 240); + + cfg->ep_stv = false; + cfg->ep_output_enable = false; + cfg->ep_mode = false; + cfg->power_disable = true; + push_cfg(cfg); +} +#endif + static void cfg_poweroff(epd_config_register_t *cfg) { // POWEROFF cfg->pos_power_enable = false; diff --git a/src/epd_driver/display_ops.c b/src/epd_driver/display_ops.c index deca3854..e2fd3310 100644 --- a/src/epd_driver/display_ops.c +++ b/src/epd_driver/display_ops.c @@ -106,6 +106,13 @@ void epd_poweron() { cfg_poweron(&config_reg); } +#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47) +void epd_powerdown() { + cfg_powerdown(&config_reg); + i2s_gpio_detach(); +} +#endif + void epd_poweroff() { cfg_poweroff(&config_reg); i2s_gpio_detach(); diff --git a/src/epd_driver/include/epd_driver.h b/src/epd_driver/include/epd_driver.h index 65943fb8..ece4e840 100644 --- a/src/epd_driver/include/epd_driver.h +++ b/src/epd_driver/include/epd_driver.h @@ -206,6 +206,17 @@ void epd_deinit(); /** Enable display power supply. */ void epd_poweron(); +#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47) +/** On lilygo disable display power but not touch screen. + * The epd power flag was re-purposed as power enable + * however it also disables the touch. + * this workaround may still leave power on to epd + * and as such may cause other problems such as grey screen. + * please also use poweroff when you sleep the system + * wake on touch will still work just not the I2C interface. + */ +void epd_powerdown(); +#endif /** Disable display power supply. */ void epd_poweroff(); From 0fd32c89c40cac55fdd9c3beccb403004aedb233 Mon Sep 17 00:00:00 2001 From: Greg Dickson Date: Mon, 9 May 2022 19:52:59 +0800 Subject: [PATCH 2/7] lilygo epd_powerdown note in readme Sorry it's not the prettiest thing. --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index de3381c1..cb0d6694 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,21 @@ The following list is compiled from past experiences and GitHub issues: * **The existing image fades / darkens when updating a partial screen region.** Make sure the VCOM voltage is [calibrated](https://epdiy.readthedocs.io/en/latest/getting_started.html#calibrate-vcom) for your specific display. * **The second third of the image is replaced with the last third.** This seems to be a timing issue we could not yet quite figure out the reason for. For a workarround or suggestions please [join the discussion](https://github.com/vroland/epdiy/issues/15). * **The ESP does not boot correctly when external periperals are connected.** Make sure not to pull GPIO12 high during boot, as it is a strapping pin internal voltage selection (https://github.com/vroland/epdiy/issues/17). - + +LilyGo Boards +--------------- +There are several differences with these boards. One particular one is the way the LilyGo handles power to the display the official lilygo code has two states. **epd_poweroff()** and **epd_poweroff_all()**. +This is now handled in epdiy in a different way **epd_poweroff()** completly turns the power off to the display and the other peripherals. The new function **epd_powerdown()** keeps the peripherals on (this allows the touch functions to continue to work). +**epd_poweroff() should allways be called before sleeping the system** You can still use touch to wake the screen with the following. + +`epd_poweroff();` + + `epd_deinit();` + + `esp_sleep_enable_ext1_wakeup(GPIO_SEL_13, ESP_EXT1_WAKEUP_ANY_HIGH);` + + `esp_deep_sleep_start();` + More on E-Paper Displays ------------------------ @@ -115,4 +129,3 @@ The board and schematic are licensed under a