print wakeup reason

pico-fc-test
alanbjohnston 3 years ago committed by GitHub
parent 71c8c7afc7
commit 9c8e54fcc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -174,6 +174,21 @@ void deleteFile(fs::FS &fs, const char * path) {
}
}
void print_wakeup_reason(){ // from https://randomnerdtutorials.com/esp32-deep-sleep-arduino-ide-wake-up-sources/
esp_sleep_wakeup_cause_t wakeup_reason;
wakeup_reason = esp_sleep_get_wakeup_cause();
switch(wakeup_reason){
case ESP_SLEEP_WAKEUP_EXT0 : Serial.println("Wakeup caused by external signal using RTC_IO"); break;
case ESP_SLEEP_WAKEUP_EXT1 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
case ESP_SLEEP_WAKEUP_TIMER : Serial.println("Wakeup caused by timer"); break;
case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("Wakeup caused by touchpad"); break;
case ESP_SLEEP_WAKEUP_ULP : Serial.println("Wakeup caused by ULP program"); break;
default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break;
}
}
void setup() {
// delay(5000);
@ -242,6 +257,7 @@ void setup() {
delay (100); // Wait 0.1 sec
digitalWrite(LED_PIN, HIGH); // Turn off
print_wakeup_reason();
}
void loop() {

Loading…
Cancel
Save

Powered by TurnKey Linux.