Skip to content

Commit f9f995b

Browse files
lbernstoneme-no-dev
authored andcommitted
Flush serial in DeepSleep example to allow print before sleep (#1791)
* Add delay into example to allow print before sleep * Changed to Serial.flush()
1 parent c8fe873 commit f9f995b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void print_wakeup_reason(){
4040
case 3 : Serial.println("Wakeup caused by timer"); break;
4141
case 4 : Serial.println("Wakeup caused by touchpad"); break;
4242
case 5 : Serial.println("Wakeup caused by ULP program"); break;
43-
default : Serial.println("Wakeup was not caused by deep sleep"); break;
43+
default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break;
4444
}
4545
}
4646

@@ -84,6 +84,7 @@ void setup(){
8484
reset occurs.
8585
*/
8686
Serial.println("Going to sleep now");
87+
Serial.flush();
8788
esp_deep_sleep_start();
8889
Serial.println("This will never be printed");
8990
}

0 commit comments

Comments
 (0)