Skip to content

Commit 1f217a9

Browse files
authored
chore: Update deprecated console APIs (#6)
1 parent 1b602e3 commit 1f217a9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/debug/src/espnow_console.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,17 @@ esp_err_t espnow_console_init(const espnow_console_config_t *config)
253253
/* Disable buffering on stdin */
254254
setvbuf(stdin, NULL, _IONBF, 0);
255255

256+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
257+
/* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
258+
usb_serial_jtag_vfs_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
259+
/* Move the caret to the beginning of the next line on '\n' */
260+
usb_serial_jtag_vfs_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF);
261+
#else
256262
/* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
257263
esp_vfs_dev_usb_serial_jtag_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
258264
/* Move the caret to the beginning of the next line on '\n' */
259265
esp_vfs_dev_usb_serial_jtag_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF);
266+
#endif
260267

261268
/* Enable non-blocking mode on stdin and stdout */
262269
fcntl(fileno(stdout), F_SETFL, 0);
@@ -267,8 +274,13 @@ esp_err_t espnow_console_init(const espnow_console_config_t *config)
267274
/* Install USB-SERIAL-JTAG driver for interrupt-driven reads and writes */
268275
ESP_ERROR_CHECK(usb_serial_jtag_driver_install(&usb_serial_jtag_config));
269276

277+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
278+
/* Tell vfs to use usb-serial-jtag driver */
279+
usb_serial_jtag_vfs_use_driver();
280+
#else
270281
/* Tell vfs to use usb-serial-jtag driver */
271282
esp_vfs_usb_serial_jtag_use_driver();
283+
#endif
272284

273285
#elif CONFIG_ESP_CONSOLE_USB_CDC
274286
/* Minicom, screen, idf_monitor send CR when ENTER key is pressed */

0 commit comments

Comments
 (0)