mirror of
https://github.com/esphome/esphome.git
synced 2025-04-07 03:10:27 +01:00
fix merge error
This commit is contained in:
parent
9a425f003b
commit
a53afdc256
@ -307,17 +307,6 @@ async def to_code(config):
|
|||||||
except cv.Invalid:
|
except cv.Invalid:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
|
||||||
uart_selection(USB_SERIAL_JTAG)
|
|
||||||
cg.add_build_flag("-DUSE_USB_SERIAL_JTAG")
|
|
||||||
except cv.Invalid:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
uart_selection(USB_CDC)
|
|
||||||
cg.add_build_flag("-DUSE_USB_CDC")
|
|
||||||
except cv.Invalid:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if CORE.using_zephyr:
|
if CORE.using_zephyr:
|
||||||
if config[CONF_HARDWARE_UART] == UART0:
|
if config[CONF_HARDWARE_UART] == UART0:
|
||||||
zephyr_add_overlay("""&uart0 { status = "okay";};""")
|
zephyr_add_overlay("""&uart0 { status = "okay";};""")
|
||||||
|
@ -39,7 +39,7 @@ void Logger::write_header_(int level, const char *tag, int line) {
|
|||||||
|
|
||||||
const char *color = LOG_LEVEL_COLORS[level];
|
const char *color = LOG_LEVEL_COLORS[level];
|
||||||
const char *letter = LOG_LEVEL_LETTERS[level];
|
const char *letter = LOG_LEVEL_LETTERS[level];
|
||||||
#ifdef USE_ARDUINO
|
#if defined(USE_ARDUINO) || defined(USE_ESP_IDF)
|
||||||
void * current_task = xTaskGetCurrentTaskHandle();
|
void * current_task = xTaskGetCurrentTaskHandle();
|
||||||
#elif defined(USE_ZEPHYR)
|
#elif defined(USE_ZEPHYR)
|
||||||
k_tid_t current_task = k_current_get();
|
k_tid_t current_task = k_current_get();
|
||||||
@ -49,7 +49,7 @@ void Logger::write_header_(int level, const char *tag, int line) {
|
|||||||
if (current_task == main_task_) {
|
if (current_task == main_task_) {
|
||||||
this->printf_to_buffer_("%s[%s][%s:%03u]: ", color, letter, tag, line);
|
this->printf_to_buffer_("%s[%s][%s:%03u]: ", color, letter, tag, line);
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_ARDUINO
|
#if defined(USE_ARDUINO) || defined(USE_ESP_IDF)
|
||||||
const char *thread_name = pcTaskGetName(current_task);
|
const char *thread_name = pcTaskGetName(current_task);
|
||||||
#elif defined(USE_ZEPHYR)
|
#elif defined(USE_ZEPHYR)
|
||||||
const char *thread_name = k_thread_name_get(current_task);
|
const char *thread_name = k_thread_name_get(current_task);
|
||||||
@ -141,16 +141,6 @@ void HOT Logger::log_message_(int level, const char *tag, int offset) {
|
|||||||
this->log_callback_.call(level, tag, msg);
|
this->log_callback_.call(level, tag, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_HOST) || defined(USE_ARDUINO)
|
|
||||||
void HOT Logger::write_msg_(const char *msg) {
|
|
||||||
#ifdef USE_HOST
|
|
||||||
puts(msg);
|
|
||||||
#elif USE_ARDUINO
|
|
||||||
this->hw_serial_->println(msg);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Logger::Logger(uint32_t baud_rate, size_t tx_buffer_size) : baud_rate_(baud_rate), tx_buffer_size_(tx_buffer_size) {
|
Logger::Logger(uint32_t baud_rate, size_t tx_buffer_size) : baud_rate_(baud_rate), tx_buffer_size_(tx_buffer_size) {
|
||||||
// add 1 to buffer size for null terminator
|
// add 1 to buffer size for null terminator
|
||||||
this->tx_buffer_ = new char[this->tx_buffer_size_ + 1]; // NOLINT
|
this->tx_buffer_ = new char[this->tx_buffer_size_ + 1]; // NOLINT
|
||||||
|
@ -29,7 +29,7 @@ namespace esphome {
|
|||||||
|
|
||||||
namespace logger {
|
namespace logger {
|
||||||
|
|
||||||
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) || defined(USE_NRF52)
|
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) || defined(USE_ZEPHYR)
|
||||||
/** Enum for logging UART selection
|
/** Enum for logging UART selection
|
||||||
*
|
*
|
||||||
* Advanced configuration (pin selection, etc) is not supported.
|
* Advanced configuration (pin selection, etc) is not supported.
|
||||||
@ -72,7 +72,7 @@ class Logger : public Component {
|
|||||||
#ifdef USE_ESP_IDF
|
#ifdef USE_ESP_IDF
|
||||||
uart_port_t get_uart_num() const { return uart_num_; }
|
uart_port_t get_uart_num() const { return uart_num_; }
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) || defined(USE_NRF52)
|
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) || defined(USE_ZEPHYR)
|
||||||
void set_uart_selection(UARTSelection uart_selection) { uart_ = uart_selection; }
|
void set_uart_selection(UARTSelection uart_selection) { uart_ = uart_selection; }
|
||||||
/// Get the UART used by the logger.
|
/// Get the UART used by the logger.
|
||||||
UARTSelection get_uart() const;
|
UARTSelection get_uart() const;
|
||||||
@ -151,16 +151,19 @@ class Logger : public Component {
|
|||||||
char *tx_buffer_{nullptr};
|
char *tx_buffer_{nullptr};
|
||||||
int tx_buffer_at_{0};
|
int tx_buffer_at_{0};
|
||||||
int tx_buffer_size_{0};
|
int tx_buffer_size_{0};
|
||||||
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_NRF52)
|
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_ZEPHYR)
|
||||||
UARTSelection uart_{UART_SELECTION_UART0};
|
UARTSelection uart_{UART_SELECTION_UART0};
|
||||||
#elif defined(USE_LIBRETINY)
|
#endif
|
||||||
|
#ifdef USE_LIBRETINY
|
||||||
UARTSelection uart_{UART_SELECTION_DEFAULT};
|
UARTSelection uart_{UART_SELECTION_DEFAULT};
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_ARDUINO
|
#ifdef USE_ARDUINO
|
||||||
Stream *hw_serial_{nullptr};
|
Stream *hw_serial_{nullptr};
|
||||||
#elif defined(USE_ESP_IDF)
|
#endif
|
||||||
|
#ifdef USE_ESP_IDF
|
||||||
uart_port_t uart_num_;
|
uart_port_t uart_num_;
|
||||||
#elif defined(USE_ZEPHYR)
|
#endif
|
||||||
|
#if defined(USE_ZEPHYR)
|
||||||
const device *uart_dev_{nullptr};
|
const device *uart_dev_{nullptr};
|
||||||
#endif
|
#endif
|
||||||
struct LogLevelOverride {
|
struct LogLevelOverride {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user