Is it possible to determine if Electron wakes from WKP or from System.sleep seconds expiring

I have an Electron that I am using as a sort of “smoke alarm” of sorts. It will be in a remote location and run off the battery. I would like to have it wake up once a week and “call home” to let me know that it is still alive and report battery, etc. However it needs to immediately call home if the “smoke alarm” goes off. Basically I am going into System.sleep(SLEEP_MODE_SOFTPOWEROFF, long seconds) for the call home function and this works. When in deep sleep, a rising edge on WKP works as the “smoke alarm”. Is there any way to determine if the electron was awakened from the WKP pin or from the System.sleep call seconds expiring? Possibly check if the WKP pin is HIGH perhaps ? Any ideas would be greatly appreciated. Thanks in advance for the advice.

This question was asked multiple times before
Electron Detect Wakeup from Pin Vs. Timer
Photon interrupt pin high upon wakeup from interrupt or timeout
Photon WKP Pin Interupt Flag Question

2 Likes

Thanks for your response, I will look into those answers.

3 Likes