Skip to content

Flush serial in DeepSleep example to allow print before sleep #1791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 17, 2018
Merged

Flush serial in DeepSleep example to allow print before sleep #1791

merged 2 commits into from
Sep 17, 2018

Conversation

lbernstone
Copy link
Contributor

Fixes #1790

Copy link
Contributor

@stickbreaker stickbreaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Serial.flush() work now?

@lbernstone lbernstone changed the title Add delay into example to allow print before sleep Flush serial in DeepSleep example to allow print before sleep Aug 28, 2018
@entropia1ac
Copy link

not work -no going to sleep. (Board: TTGO LORA32 ,stable release 1.0.0)
........
void setup(){
Serial.begin(115200);
delay(1000); //Take some time to open up the Serial Monitor
++bootCount;
Serial.println("Boot number: " + String(bootCount));
print_wakeup_reason();

Serial.flush();
delay(1000);
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) +
" Seconds");
}
void loop(){
Serial.println("Boot number in loop=" + String(bootCount));
delay(1000);
}
.....
debug:==============
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:808
load:0x40078000,len:6084
load:0x40080000,len:6696
entry 0x400802e4
Boot number: 1
Wakeup was not caused by deep sleep
Setup ESP32 to sleep for every 5 Seconds
Boot number in loop=1
Boot number in loop=1
Boot number in loop=1
Boot number in loop=1
Boot number in loop=1
Boot number in loop=1
Boot number in loop=1
Boot number in loop=1
Boot number in loop=1

@lbernstone
Copy link
Contributor Author

This is not really the place for issues. The code works fine for me, and you have clearly changed it. Download the actual code (https://github.com/lbernstone/arduino-esp32/blob/sleepsketchfix/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino) and test that.

@me-no-dev me-no-dev merged commit f9f995b into espressif:master Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants