Skip to content

Commit ec358cf

Browse files
committed
fix(light_sleep/example): fix potential compilation error in light_sleep example
If ESP_CONSOLE_NONE is selected in menuconfig, compilation fails with undefined CONFIG_ESP_CONSOLE_UART_BAUDRATE macro.
1 parent 85f0da6 commit ec358cf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/system/light_sleep/main/uart_wakeup.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@
1414
#include "driver/uart_wakeup.h"
1515
#include "sdkconfig.h"
1616

17-
#define EXAMPLE_UART_NUM 0
17+
#define EXAMPLE_UART_NUM CONFIG_ESP_CONSOLE_UART_NUM
1818
/* Notice that ESP32 has to use the iomux input to configure uart as wakeup source
1919
* Please use 'UxRXD_GPIO_NUM' as uart rx pin. No limitation to the other target */
2020
#define EXAMPLE_UART_TX_IO_NUM U0TXD_GPIO_NUM
2121
#define EXAMPLE_UART_RX_IO_NUM U0RXD_GPIO_NUM
2222

23+
#if CONFIG_ESP_CONSOLE_UART
24+
#define EXAMPLE_UART_BAUDRATE CONFIG_ESP_CONSOLE_UART_BAUDRATE
25+
#else
26+
#define EXAMPLE_UART_BAUDRATE 115200
27+
#endif
28+
2329
#define EXAMPLE_UART_WAKEUP_EDGE_THRESHOLD 3
2430
#define EXAMPLE_UART_WAKEUP_FIFO_THRESHOLD 8
2531
#define EXAMPLE_UART_WAKEUP_CHARS_SEQ "ok"
@@ -103,7 +109,7 @@ static void uart_wakeup_task(void *arg)
103109
static void uart_initialization(void)
104110
{
105111
uart_config_t uart_cfg = {
106-
.baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE,
112+
.baud_rate = EXAMPLE_UART_BAUDRATE,
107113
.data_bits = UART_DATA_8_BITS,
108114
.parity = UART_PARITY_DISABLE,
109115
.stop_bits = UART_STOP_BITS_1,

0 commit comments

Comments
 (0)