Skip to content

Add function getWakeupCause for ESP32 #2359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2023

Conversation

cwilling
Copy link
Contributor

This function returns a number representing the reason that a device has woken from deep sleep. Example code:

var wakeupCause = ESP32.getWakeupCause();
if (wakeupCause == 0) {
  // Assume a reboot i.e.completely new start
  OnInit(); 
} else {
  // Wakeup from deep sleep.
  // Could check values 2-6 for explicit wakeup source
  OnWakeup();
}

Signed-off-by: Christoph Willing <[email protected]>
@cwilling cwilling mentioned this pull request May 10, 2023
33 tasks
@gfwilliams
Copy link
Member

Looks great, thanks!

I really appreciate the docs in the JSON header too - those will make big difference when folks go to use it

@gfwilliams gfwilliams merged commit 53bd231 into espruino:master May 10, 2023
@cwilling cwilling deleted the wakeupCause branch May 10, 2023 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants