M5paper touchscreen wakeup from sleep
-
Hello @Joonas
Here is how I put my M5Paper into deep sleep with touch wake up:
esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, LOW); // TOUCH_INT gpio_hold_en(GPIO_NUM_2); // M5EPD_MAIN_PWR_PIN gpio_deep_sleep_hold_en(); esp_deep_sleep_start();
or light sleep with touch wake up:
esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, LOW); // TOUCH_INT esp_light_sleep_start();
Thanks
Felix -
@felmue
Big thanks. Now it works.
I was missing the two lines "gpio_hold_en(GPIO_NUM_2);" & "gpio_deep_sleep_hold_en();" The other lines I already tried.Now i will keep testing to make the battery life and wakeup times better.
-
-
Hello @felmue
With an M5Paper V1.1 and your code sample, I can't put the device in deep (instant reboot with RTC_IO wakeup cause) or light sleep. This works well with BTN_UP.
Is there a difference with V1.0 that can explain this behavior or something I missed ?
Thanks
JC -
-
@felmue - is latency between waking up from deep sleep is low enough to capture the same touch in main code (after wake up)?
-
Hello @kelcon
yes, the main code can read the same touch which has caused the waking up since the touch IC stores the last touch coordinates for the main code to fetch it.
Thanks
Felix -
@felmue If I use esp_deep_sleep_start(); with canvas.drawJpgUrl() it restarts every 5 seconds. Works with light.
-
Hello @actuar
well there is different behavior regarding program flow after waking from deep sleep vs waking from light sleep.
After waking from deep sleep the program flow is (re-)started from the top. Which looks like a restart as it actually is a restart.
After waking from light sleep the program flow continues and does not restart.
Thanks
Felix -
Thank you, all clear now, so M5.shutdown(600) will run again the entire setup. Great!
Now M5.shutdown(600) it is run actually every 9 minutes and M5.shutdown(3600*11) every 2 and almost a half hour, not 11 hours.
In order to avoid charging problems I use:
if (voltage<4150) {
M5.shutdown(shutdownDuration);
}otherwise it restarts every 5 seconds when charging. Is there any other solution when charging?
The battery only charges to max 4100 and is dead at 3410: just bought a new M5Paper a week ago.float voltage = M5.getBatteryVoltage();