System.sleep(SLEEP_MODE_DEEP, sleepTime) and WKP pin

Sometimes I need to have the system sleep and wakeup on the WKP pin, other times I need to have it deep sleep until a timeout occurs, in which case I do NOT want it waking up on the WKP pin (the WKP pin is attached to an accelerometer interrupt and I need some periods in deep sleep whatever the world is doing to save power).

I had thought that System.sleep(SLEEP_MODE_DEEP, sleepTime) would sleep and wake-up with a reset at the given time, however it appears to react to the WKP pin as well.

How can I achieve deep sleep irrespective of external interrupts?

Rob

AFAIK there is no option to not wake on WKP from deep sleep.
But you should be able to deactivate the interrupt output on the accelerometer.

In that case I’ll raise an issue on the documentation 'cos System.sleep (SLEEP_MODE_DEEP, longSeconds) makes no mention of external interrupts, just says “the device will automatically wake up and reestablish the Wi-Fi connection after the specified number of seconds”.

Thanks for the swift reply.

Rob

Better?
https://docs.particle.io/reference/firmware/photon/#sleep-sleep-

Yup :-).

1 Like