Using System.sleepResult and SLEEP_MODE_DEEP

photon
Tags: #<Tag:0x00007f1cae725a48>

#1

Is System.sleepResult() and result.wokenUpByPin() intended to be used with deep sleep or only stop mode sleep?
I have a Photon in SLEEP_MODE_DEEP for most the time and I’m trying to use an external push button (connected to WKP and a pull-down resistor) to wake the device and thereafter put it into Safe Mode. The sketch simply tests if result.wokenUpByPin() is true at start, however the device goes straight into to go into Safe Mode every time it wake regardless of button push or timer expiring.


#2

Could you post the code you are using to check if woken by pin?

I thought the Photon does a reset immediately after exiting SLEEP_MODE_DEEP. It will do this on the RTC or WKP pin - I don’t believe you can put it into safe mode.

In this particular mode, the device shuts down the network subsystem and puts the microcontroller in a standby mode. When the device awakens from deep sleep, it will reset and run all user code from the beginning with no values being maintained in memory from before the deep sleep.The standby mode is used to achieve the lowest power consumption. After entering standby mode, the RAM and register contents are lost except for retained memory.The device will automatically wake up after the specified number of seconds or by applying a rising edge signal to the WKP pin.