From f9f995b283e3e64be572136c6a64cb5025ecdfd1 Mon Sep 17 00:00:00 2001 From: lbernstone Date: Mon, 17 Sep 2018 12:31:24 -0700 Subject: [PATCH] Flush serial in DeepSleep example to allow print before sleep (#1791) * Add delay into example to allow print before sleep * Changed to Serial.flush() --- libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino b/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino index 423ef828..d1743cdc 100644 --- a/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino +++ b/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino @@ -40,7 +40,7 @@ void print_wakeup_reason(){ 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; + default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break; } } @@ -84,6 +84,7 @@ void setup(){ reset occurs. */ Serial.println("Going to sleep now"); + Serial.flush(); esp_deep_sleep_start(); Serial.println("This will never be printed"); }