I'm playing around with the M5Paper RTC and I'm stuck on differentiating between a restart caused by pressing the reset button, and a restart caused by a
shutdown() with a RTC IRQ wakeup.
I'm writing a simple clock application that updates once a minute with the following properties:
- On boot I paint a decorative frame (I actually pull it by http), connect to ntp and setup the RTC clock. Finally I draw the time, and do a
shutdown(60)to wake up in a minute.
- After a minute I want to wake up, draw the time, and go back to sleep.
So I did all the initialization in
setup() and initialized the RTC, setup the font cache, and then went to sleep for 60s. But when I wake up after 60s I need to know whether the RTC has already been initialized, and whether I have already painted the clock frame. Right now I do all the setup once a minute.
The ESP itself has a wake up "reason". But how would I access it on the M5Paper? And does it work in the context of the BM8563 RTC?