Merge branch 'doc/fix_uart_output_handling_doc_format' into 'master'

fix(doc): fix uart output handling doc format

Closes IDFGH-18237

See merge request espressif/esp-idf!52484
This commit is contained in:
Jiang Jiang Jian
2026-09-08 11:04:46 +08:00
2 changed files with 16 additions and 16 deletions
+4 -4
View File
@@ -673,17 +673,17 @@ You can override the default by calling :cpp:func:`esp_sleep_set_console_uart_ha
The sleep flow runs in a critical section. When using a mode that flushes the console UART (e.g. :cpp:enumerator:`ESP_SLEEP_ALWAYS_FLUSH_UART`, or the default behavior for Light-sleep/Deep-sleep when the HP peripheral domain is powered down), set :menuitem:`CONFIG_ESP_INT_WDT_TIMEOUT_MS` to be **greater than** ``SOC_UART_FIFO_LEN`` × (time to send one character at the current baud rate). Otherwise, if too much data is queued in the TX FIFO, the flush may take longer than the interrupt watchdog timeout and trigger a watchdog reset during sleep entry. The sleep flow runs in a critical section. When using a mode that flushes the console UART (e.g. :cpp:enumerator:`ESP_SLEEP_ALWAYS_FLUSH_UART`, or the default behavior for Light-sleep/Deep-sleep when the HP peripheral domain is powered down), set :menuitem:`CONFIG_ESP_INT_WDT_TIMEOUT_MS` to be **greater than** ``SOC_UART_FIFO_LEN`` × (time to send one character at the current baud rate). Otherwise, if too much data is queued in the TX FIFO, the flush may take longer than the interrupt watchdog timeout and trigger a watchdog reset during sleep entry.
Example: ensure all debug output is sent before every sleep:: Example: ensure all debug output is sent before every sleep:
.. code-block:: C .. code-block:: c
fflush(stdout); fflush(stdout);
esp_sleep_set_console_uart_handling_mode(ESP_SLEEP_ALWAYS_FLUSH_UART); esp_sleep_set_console_uart_handling_mode(ESP_SLEEP_ALWAYS_FLUSH_UART);
esp_light_sleep_start(); esp_light_sleep_start();
Example: minimize sleep entry time and allow discarding console output:: Example: minimize sleep entry time and allow discarding console output:
.. code-block:: C .. code-block:: c
esp_sleep_set_console_uart_handling_mode(ESP_SLEEP_ALWAYS_DISCARD_UART); esp_sleep_set_console_uart_handling_mode(ESP_SLEEP_ALWAYS_DISCARD_UART);
esp_deep_sleep_start(); esp_deep_sleep_start();
@@ -673,7 +673,7 @@ UART 输出处理
睡眠流程在临界区中执行,当使用会冲刷控制台 UART 的模式(如 :cpp:enumerator:`ESP_SLEEP_ALWAYS_FLUSH_UART`,或 HP 外设域掉电时的 Light-sleep/Deep-sleep 默认行为)时,请将 :menuitem:`CONFIG_ESP_INT_WDT_TIMEOUT_MS` 配置为**大于** ``SOC_UART_FIFO_LEN`` ×(当前波特率下发送一个字符所需时间)。否则若 TX FIFO 中积压数据过多,冲刷时间可能超过中断看门狗超时,会在进入睡眠过程中触发看门狗复位。 睡眠流程在临界区中执行,当使用会冲刷控制台 UART 的模式(如 :cpp:enumerator:`ESP_SLEEP_ALWAYS_FLUSH_UART`,或 HP 外设域掉电时的 Light-sleep/Deep-sleep 默认行为)时,请将 :menuitem:`CONFIG_ESP_INT_WDT_TIMEOUT_MS` 配置为**大于** ``SOC_UART_FIFO_LEN`` ×(当前波特率下发送一个字符所需时间)。否则若 TX FIFO 中积压数据过多,冲刷时间可能超过中断看门狗超时,会在进入睡眠过程中触发看门狗复位。
示例:在每次睡眠前确保所有调试输出已发出:: 示例:在每次睡眠前确保所有调试输出已发出:
.. code-block:: c .. code-block:: c
@@ -681,7 +681,7 @@ UART 输出处理
esp_sleep_set_console_uart_handling_mode(ESP_SLEEP_ALWAYS_FLUSH_UART); esp_sleep_set_console_uart_handling_mode(ESP_SLEEP_ALWAYS_FLUSH_UART);
esp_light_sleep_start(); esp_light_sleep_start();
示例:尽量缩短进入睡眠时间并允许丢弃控制台输出:: 示例:尽量缩短进入睡眠时间并允许丢弃控制台输出:
.. code-block:: c .. code-block:: c