From a43682596fad48f18b87903807bb95e2b56750be Mon Sep 17 00:00:00 2001 From: WereCatf Date: Mon, 19 Nov 2018 17:41:07 +0200 Subject: [PATCH] Deep-sleep example-sketches reported wrong wakeup-reason (#1911) Incorrect values used, use the proper defines from header-files instead. --- .../DeepSleep/ExternalWakeUp/ExternalWakeUp.ino | 12 ++++++------ .../examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino | 10 +++++----- .../examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ExternalWakeUp.ino b/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ExternalWakeUp.ino index 5d357128..8a13b771 100644 --- a/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ExternalWakeUp.ino +++ b/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ExternalWakeUp.ino @@ -36,12 +36,12 @@ void print_wakeup_reason(){ switch(wakeup_reason) { - case 1 : Serial.println("Wakeup caused by external signal using RTC_IO"); break; - case 2 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break; - case 3 : Serial.println("Wakeup caused by timer"); break; - case 4 : Serial.println("Wakeup caused by touchpad"); break; - case 5 : Serial.println("Wakeup caused by ULP program"); break; - default : Serial.println("Wakeup was not caused by deep sleep"); break; + 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; } } diff --git a/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino b/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino index d1743cdc..e8f280f3 100644 --- a/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino +++ b/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino @@ -35,11 +35,11 @@ void print_wakeup_reason(){ switch(wakeup_reason) { - case 1 : Serial.println("Wakeup caused by external signal using RTC_IO"); break; - case 2 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break; - case 3 : Serial.println("Wakeup caused by timer"); break; - case 4 : Serial.println("Wakeup caused by touchpad"); break; - case 5 : Serial.println("Wakeup caused by ULP program"); break; + 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; } } diff --git a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino index e6784049..52f252f1 100644 --- a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino +++ b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/TouchWakeUp.ino @@ -26,12 +26,12 @@ void print_wakeup_reason(){ switch(wakeup_reason) { - case 1 : Serial.println("Wakeup caused by external signal using RTC_IO"); break; - case 2 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break; - case 3 : Serial.println("Wakeup caused by timer"); break; - case 4 : Serial.println("Wakeup caused by touchpad"); break; - case 5 : Serial.println("Wakeup caused by ULP program"); break; - default : Serial.println("Wakeup was not caused by deep sleep"); break; + 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; } }