sleep: fix flushing UARTs when entering deep sleep

Since 94250e42a0, UART output is suspended when entering sleep mode
(deep or light sleep). This makes sense for light sleep, where sleep
normally takes small amount of time, and flushing the UART would add
a lot of latency. But this breaks existing behaviour for deep sleep,
where UART output was previously sent out before entering sleep mode.

Closes https://github.com/espressif/esp-idf/issues/2145
This commit is contained in:
Ivan Grokhotkov
2018-07-04 12:11:07 +08:00
parent afdc73c8ab
commit d360f6d95d
2 changed files with 22 additions and 2 deletions

View File

@@ -136,6 +136,13 @@ Add the following code before :cpp:func:`esp_deep_sleep_start` to remove this ex
rtc_gpio_isolate(GPIO_NUM_12);
```
UART output handling
--------------------
Before entering sleep mode, :cpp:func:`esp_deep_sleep_start` will flush the contents of UART FIFOs.
When entering light sleep mode using :cpp:func:`esp_light_sleep_start`, UART FIFOs will not be flushed. Instead, UART output will be suspended, and remaining characters in the FIFO will be sent out after wakeup from light sleep.
Checking sleep wakeup cause
---------------------------