Photon Sleep Protocol

I’m having a hard time finding documentation or forum threads that discuss exactly how the Photon reacts to System.sleep(uint16_t wakeUpPin, uint16_t edgeTriggerMode). I’m running 0.4.6 firmware - just upgraded yesterday. Three questions:

  1. Does this call put the system into deep sleep or light sleep - it’s not clear since the argument to choose is missing from this call, while present in others. I believe it’s a deep sleep - the doc seems to indicate that, but am not sure.

  2. When this call is in effect, what is the effect of pulling the WKP pin HIGH on the Photon? Regardless of the state of the selected wakeUpPin, does WKP also wake the system up?

  3. When the wakeUpPin is triggered - does the loop() continue with the next statement after the sleep call, or does it begin with the setup routine again? Again, the docs to not talk to this aspect of the sleep call, but the behavior I’ve observed is that the system wakes up and begin execution with the statement following sleep.

Thanks in advance,

There is an open issue on GitHub

And about the sleep modes once they are working

And even better in the GitHub sources (comments at line 340ff: Low Power modes configuration functions)

The docs do say:

Where “registers” also includes stack and instruction pointer, so the program flow will continue with the next instruction after sleep()
But since this is not as clear as it could be another GitHub issue was already opened too.