Skip to content

Commit 3ffb83c

Browse files
authored
Add epd_powerdown for lilygo (#179)
* 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. * lilygo epd_powerdown note in readme Sorry it's not the prettiest thing. * Documentation change Deoxygenised the comments on the function so it will be explained in the readthedocs.io * Clarify readme * Finish readme for lily go * Clean up * Oops
1 parent fd8a290 commit 3ffb83c

File tree

4 files changed

+72
-2
lines changed

4 files changed

+72
-2
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,25 @@ The following list is compiled from past experiences and GitHub issues:
8686
* **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.
8787
* **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).
8888
* **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).
89-
89+
90+
LilyGo Boards
91+
---------------
92+
There are several differences with these boards.
93+
One particular one is the way the LilyGo handles power to the display the official lilygo code has two states.
94+
This is now handled in epdiy in a different way to the lilygo code.
95+
**epd_poweroff()** completely turns the power off to the display and the other peripherals of the lilygo.
96+
The new function **epd_powerdown()** keeps the peripherals on (this allows the touch functions to continue to work).
97+
**epd_poweroff() should allways be called before sleeping the system**
98+
You can still use touch to wake the screen with the following.
99+
In Arduino it works like this.
100+
`epd_poweroff();`
101+
102+
`epd_deinit();`
103+
104+
`esp_sleep_enable_ext1_wakeup(GPIO_SEL_13, ESP_EXT1_WAKEUP_ANY_HIGH);`
105+
106+
`esp_deep_sleep_start();`
107+
90108
More on E-Paper Displays
91109
------------------------
92110

@@ -115,4 +133,3 @@ The board and schematic are licensed under a <a rel="license" href="https://crea
115133

116134
Firmware and remaining examples are licensed under the terms of the GNU Lesser GPL version 3.
117135
Utilities are licensed under the terms of the MIT license.
118-

src/epd_driver/config_reg_v2.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,28 @@ static void cfg_poweron(epd_config_register_t *cfg) {
6666
// END POWERON
6767
}
6868

69+
#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
70+
static void cfg_powerdown(epd_config_register_t *cfg) {
71+
// This was re-purposed as power enable however it also disables the touch.
72+
// this workaround may still leave power on to epd and as such may cause other
73+
// problems such as grey screen.
74+
cfg->pos_power_enable = false;
75+
push_cfg(cfg);
76+
busy_delay(10 * 240);
77+
78+
cfg->neg_power_enable = false;
79+
cfg->pos_power_enable = false;
80+
push_cfg(cfg);
81+
busy_delay(100 * 240);
82+
83+
cfg->ep_stv = false;
84+
cfg->ep_output_enable = false;
85+
cfg->ep_mode = false;
86+
cfg->power_disable = true;
87+
push_cfg(cfg);
88+
}
89+
#endif
90+
6991
static void cfg_poweroff(epd_config_register_t *cfg) {
7092
// POWEROFF
7193
cfg->pos_power_enable = false;

src/epd_driver/display_ops.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ void epd_poweron() {
106106
cfg_poweron(&config_reg);
107107
}
108108

109+
#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
110+
void epd_powerdown() {
111+
cfg_powerdown(&config_reg);
112+
i2s_gpio_detach();
113+
}
114+
#endif
115+
109116
void epd_poweroff() {
110117
cfg_poweroff(&config_reg);
111118
i2s_gpio_detach();

src/epd_driver/include/epd_driver.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,30 @@ void epd_deinit();
206206
/** Enable display power supply. */
207207
void epd_poweron();
208208

209+
#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
210+
/** This is a Lilygo47 specific function
211+
212+
This is a work around a hardware issue with the Lilygo47 epd_poweroff() turns off the epaper completely
213+
however the hardware of the Lilygo47 is different than the official boards. Which means that on the Lilygo47 this
214+
disables power to the touchscreen.
215+
216+
This is a workaround to allow to disable display power but not the touch screen.
217+
On the Lilygo the epd power flag was re-purposed as power enable
218+
for everything. This is a hardware thing.
219+
\warning This workaround may still leave power on to epd and as such may cause other problems such as grey screen.
220+
Please also use epd_poweroff() and epd_deinit() when you sleep the system wake on touch will still work.
221+
222+
Arduino specific code:
223+
\code{.c}
224+
epd_poweroff();
225+
epd_deinit();
226+
esp_sleep_enable_ext1_wakeup(GPIO_SEL_13, ESP_EXT1_WAKEUP_ANY_HIGH);
227+
esp_deep_sleep_start();
228+
\endcode
229+
*/
230+
void epd_powerdown();
231+
#endif
232+
209233
/** Disable display power supply. */
210234
void epd_poweroff();
211235

0 commit comments

Comments
 (0)