I have a code looping with the help of the dsleep
mode. Each time dsleep
ends, the init.lua
is loaded, does something the goes back to sleep.
Now I want to implement a button to my ESP8266 that will trigger the reset pin. When pushed, my system should enter in a "setup mode", providing AP to do some setup (that part of code is OK).
My problem is: How do I know if the current init was triggered manually (then go to setup mode) or by normal reboot after dsleep
?
I'm guessing that there should be two ways doing this:
- programmatically: somehow store a meta-global variable changed by the gpio15 trigger in the end of
dsleep
... - electronically: hack something to change one pin state when pushing reset button
Any advice?