Hello Rui
Using the exact code from the example I wondered to did get this output:
…
Boot number: 2
wakeup_reason = 4
Wakeup caused by touchpad
Setup ESP32 to sleep for every 5 Seconds
…
Although the wakeup is really caused by the timer.
Trying a different case statement however works fine:
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;
}
According to my findings the definition in
https://github.com/espressif/esp-idf/blob/master/components/esp32/include/esp_sleep.h
line 62 the enum statement gives ESP_SLEEP_WAKEUP_TIMER indeed the number 4
So the numbers of the cases in the example should be changed?
Best regards
Wolfgang
Hi.
I’ve tested the example with the latest release of ESP32 for Arduino IDE, and it is working fine.
I get “Wakeup caused by timer”
Are you using the latest table release or the latest development release? https://github.com/espressif/arduino-esp32
Regards,
Sara
Hello Sara
Thank you for your quick answer!
Please excuse my impertinent question: are you sure to use the latest update?
I found that with the latest update from Sep 21, 2018 there has really been a change in the file:
arduino-esp32/tools/sdk/include/esp32/esp_sleep.h
A new wakeup item has been added and with that update the timer wakeup got now number 4 (in former versions it’s been number 3)
I think other new users with a fresh installed environment will see the same effect as I did.
Perhaps you can check it.
Anyway – Thank you for your great job and all the material you did supply!!!
For you an Rui a happy & successful new year!
Best regards
Wolfgang
Hi again.
I was not able to reproduce that error.
I get the right wake up reason with the latest installation.
I think that issue was already resolved. Take a look at the following links:
- https://github.com/espressif/arduino-esp32/commit/a43682596fad48f18b87903807bb95e2b56750be#diff-8444ad22f7fba217637bf2f6b55496e4
- https://github.com/espressif/arduino-esp32/pull/1911
- https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino
I hope this helps. Let me know if you have any other issues.
Thank you for supporting our work!
Regards,
Sara 🙂