mirror of
https://github.com/esphome/esphome.git
synced 2024-11-15 03:28:12 +01:00
[fix] deprecated functions warnings for logger component with ESP IDF version 5.3.0+ (#7600)
This commit is contained in:
parent
3ef31e55ca
commit
b274d6901a
1 changed files with 15 additions and 0 deletions
|
@ -10,8 +10,12 @@
|
|||
|
||||
#ifdef USE_LOGGER_USB_SERIAL_JTAG
|
||||
#include <driver/usb_serial_jtag.h>
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
|
||||
#include <esp_vfs_dev.h>
|
||||
#include <esp_vfs_usb_serial_jtag.h>
|
||||
#else
|
||||
#include <driver/usb_serial_jtag_vfs.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
@ -36,10 +40,17 @@ static const char *const TAG = "logger";
|
|||
static void init_usb_serial_jtag_() {
|
||||
setvbuf(stdin, NULL, _IONBF, 0); // Disable buffering on stdin
|
||||
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
|
||||
// Minicom, screen, idf_monitor send CR when ENTER key is pressed
|
||||
esp_vfs_dev_usb_serial_jtag_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
|
||||
// Move the caret to the beginning of the next line on '\n'
|
||||
esp_vfs_dev_usb_serial_jtag_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF);
|
||||
#else
|
||||
// Minicom, screen, idf_monitor send CR when ENTER key is pressed
|
||||
usb_serial_jtag_vfs_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
|
||||
// Move the caret to the beginning of the next line on '\n'
|
||||
usb_serial_jtag_vfs_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF);
|
||||
#endif
|
||||
|
||||
// Enable non-blocking mode on stdin and stdout
|
||||
fcntl(fileno(stdout), F_SETFL, 0);
|
||||
|
@ -57,7 +68,11 @@ static void init_usb_serial_jtag_() {
|
|||
}
|
||||
|
||||
// Tell vfs to use usb-serial-jtag driver
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
|
||||
esp_vfs_usb_serial_jtag_use_driver();
|
||||
#else
|
||||
usb_serial_jtag_vfs_use_driver();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue