35
35
#include "nvs_flash.h"
36
36
#include "settings.h"
37
37
38
+ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL (5 , 3 , 0 )
39
+ #include "driver/uart_vfs.h"
40
+ #endif
41
+
38
42
// Conditionally enable the logging tag variable only when it's used
39
43
#if defined(CONFIG_STORE_HISTORY ) || defined(CONFIG_HEAP_USE_HOOKS )
40
44
static const char * TAG = "main" ;
@@ -86,7 +90,13 @@ static void initialize_console() {
86
90
setvbuf (stdin , NULL , _IONBF , 0 );
87
91
setvbuf (stdout , NULL , _IONBF , 0 );
88
92
89
- #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL (4 , 3 , 0 )
93
+ // These APIs vary depending on ESP-IDF version.
94
+ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL (5 , 3 , 0 )
95
+ /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
96
+ uart_vfs_dev_port_set_rx_line_endings (CONFIG_ESP_CONSOLE_UART_NUM , ESP_LINE_ENDINGS_CR );
97
+ /* Move the caret to the beginning of the next line on '\n' */
98
+ uart_vfs_dev_port_set_tx_line_endings (CONFIG_ESP_CONSOLE_UART_NUM , ESP_LINE_ENDINGS_CRLF );
99
+ #elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL (4 , 3 , 0 )
90
100
/* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
91
101
esp_vfs_dev_uart_port_set_rx_line_endings (CONFIG_ESP_CONSOLE_UART_NUM , ESP_LINE_ENDINGS_CR );
92
102
/* Move the caret to the beginning of the next line on '\n' */
@@ -102,7 +112,11 @@ static void initialize_console() {
102
112
ESP_ERROR_CHECK (uart_driver_install (CONFIG_CONSOLE_UART_NUM , 256 , 0 , 0 , NULL , 0 ));
103
113
104
114
/* Tell VFS to use UART driver */
115
+ #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL (5 , 3 , 0 )
116
+ uart_vfs_dev_use_driver (CONFIG_CONSOLE_UART_NUM );
117
+ #else
105
118
esp_vfs_dev_uart_use_driver (CONFIG_CONSOLE_UART_NUM );
119
+ #endif
106
120
107
121
/* Initialize the console */
108
122
esp_console_config_t console_config = {
@@ -173,7 +187,7 @@ static void prv_memfault_ota(void) {
173
187
174
188
int rv = memfault_esp_port_ota_update (& handler );
175
189
176
- #if MEMFAULT_METRICS_SYNC_SUCCESS
190
+ #if defined( CONFIG_MEMFAULT_METRICS_SYNC_SUCCESS )
177
191
// Record the OTA check result using the built-in sync success metric
178
192
if (rv == 0 || rv == 1 ) {
179
193
memfault_metrics_connectivity_record_sync_success ();
0 commit comments