1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-06 19:00:29 +01:00

fix build error

This commit is contained in:
Tomasz Duda 2024-04-23 21:11:21 +02:00
parent a53afdc256
commit de78aaa090

View File

@ -39,6 +39,7 @@ void Logger::write_header_(int level, const char *tag, int line) {
const char *color = LOG_LEVEL_COLORS[level];
const char *letter = LOG_LEVEL_LETTERS[level];
#ifndef USE_ESP8266
#if defined(USE_ARDUINO) || defined(USE_ESP_IDF)
void * current_task = xTaskGetCurrentTaskHandle();
#elif defined(USE_ZEPHYR)
@ -47,7 +48,9 @@ void Logger::write_header_(int level, const char *tag, int line) {
void * current_task = nullptr;
#endif
if (current_task == main_task_) {
#endif
this->printf_to_buffer_("%s[%s][%s:%03u]: ", color, letter, tag, line);
#ifndef USE_ESP8266
} else {
#if defined(USE_ARDUINO) || defined(USE_ESP_IDF)
const char *thread_name = pcTaskGetName(current_task);
@ -57,6 +60,7 @@ void Logger::write_header_(int level, const char *tag, int line) {
this->printf_to_buffer_("%s[%s][%s:%03u]%s[%s]%s: ", color, letter, tag, line,
ESPHOME_LOG_BOLD(ESPHOME_LOG_COLOR_RED), thread_name, color);
}
#endif
}
void HOT Logger::log_vprintf_(int level, const char *tag, int line, const char *format, va_list args) { // NOLINT
@ -144,11 +148,13 @@ void HOT Logger::log_message_(int level, const char *tag, int offset) {
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
this->tx_buffer_ = new char[this->tx_buffer_size_ + 1]; // NOLINT
#ifdef USE_ARDUINO
#ifndef USE_ESP8266
#if defined(USE_ARDUINO) || defined(USE_ESP_IDF)
this->main_task_ = xTaskGetCurrentTaskHandle();
#elif defined(USE_ZEPHYR)
this->main_task_ = k_current_get();
#endif
#endif
}
#ifdef USE_LOGGER_USB_CDC