Core 2 wakeup from touch?
is there a way to make the M5Core2 wake up from sleeping modes by touching the screen?
I'm aware of the "esp_sleep_enable_touchpad_wakeup();" function, but I just can't get it to do what it is supposed to. Using "touchAttachInterrupt(G27, callback, Threshold);" does not help. Furthermore, except for G27, all other pins I tried to tie to this function (0,2,4,12-15,27,32,33) lead to permanent reboot cycles. With G27, at least this issue did not occur.
Your response is highly appreciated,
felmue last edited by felmue
esp_sleep_enable_touchpad_wakeup();is meant for when some of the ESP32 GPIOs are used as capacitive touch pads. They are completely different form the M5Core2 touch screen.
Have a look at this example which puts ESP32 into light sleep which then can be woken by touching the screen.
thanks a lot for the fast reply. i'll try your proposed solution asap. seems i've missed out on this basic solution, although i did quite some search before and never stumbled across such a piece of code. however, i'll get back to you.
have a good day, digs
meanwhile I tested your proposed solution. Unfortunately, it just lead to a continuous reboot cycle without any sleep state ever reached :-((
Substituting "deep_sleep" for "light_sleep" did not change anything.
Grepping in my Arduino libraries i found "gpio_wakeup_enable" and "esp_sleep_enable_gpio_wakeup" to be declared in various header files under
but not under ~/Arduino/libraries/M5Core2....
The CST_INT definition was found under ~/Arduino/libraries/M5Core2...
whereas GPIO_INTR_LOW_LEVEL again only in the ~/.arduino15 branch
Is the multitude of declarations under .arduino15 or the absence from the M5Core2 libraries a potential explanation for failure? Could it be, that your solution works fine with one of the ESP32 development boards but not with the M5Core2?
Appreciating your response.
felmue last edited by felmue
esp_sleep_enable_gpio_wakeupcan only be used for light sleep but not for deep sleep. See ESP32 sleep modes.
If you want to use deep sleep check out this example.
Please also check out this article about different sleep modes.
The sleep functions are not M5Core2 specific. They are functions of the ESP32 so it should work on all devices using ESP32. It is normal for them to be found in esp32 related libraries, but not in the M5Core2 library.
Both my sleep examples have been tested on an M5Core2 (under ESP32 Arduino framework 2.0.4 and 2.0.5), so I am stumped as to why it fails for you.
Could you please post the debug log - hopefully this will shed some light on the reason for the reboot.
after your reply (thanxxxs!) I tested again. And this time it worked :-))) I must have messed up your original example code 'til the failure point with my supplements. This time I sticked rigoroulsy to your formulation. Success!
Regarding your literature hints: Thanks again. I had gone through relevant randomnerd tutorials before. That's how "esp_sleep_enable_touchpad_wakeup()" came to my mind... a dead end road as I learned from your remarks. The Espressif sleep docu I have yet to read.
felmue last edited by
I am glad to hear you got it sorted out. Thank you for reporting back.
ajb2k3 last edited by