Page 1 of 1

esp32 wake from sleep via interrupt then return to sleep

Posted: Fri Apr 17, 2020 11:10 pm
by rktuttle
I would like to put esp32 into light sleep mode then be able to wakeup via ext interrupt. Next, I want to resume the sleep cycle. My attempts restart sleep cycle after interrupt is serviced. Problem is that a new sleep cycle is started after each interrupt.

Re: esp32 wake from sleep via interrupt then return to sleep

Posted: Sat Apr 18, 2020 11:48 am
by Agree007
Thats the way it works, you will have to save you state and other required data, before going to sleep and the reload data when it wakes up.

Re: esp32 wake from sleep via interrupt then return to sleep

Posted: Mon Apr 20, 2020 3:01 pm
by fasani
Yes I agree with that.
Do you think is a good idea to use the Preferences class to save state?

Re: esp32 wake from sleep via interrupt then return to sleep

Posted: Mon Apr 20, 2020 5:54 pm
by Agree007
fasani wrote:
Mon Apr 20, 2020 3:01 pm
Yes I agree with that.
Do you think is a good idea to use the Preferences class to save state?
The Preferences class is very easy to use and control, so in most cases I would use it, but it migth depend on what else you code does and require.

Re: esp32 wake from sleep via interrupt then return to sleep

Posted: Thu Apr 23, 2020 10:04 pm
by rktuttle
Thank you both for your replies. I am new to this and will have to learn about the Preference class. Will do a google search.
Thanks again.