diff --git a/esphome/components/logger/logger.cpp b/esphome/components/logger/logger.cpp index bb00a230ee6..1b41bc3d470 100644 --- a/esphome/components/logger/logger.cpp +++ b/esphome/components/logger/logger.cpp @@ -197,8 +197,8 @@ void Logger::init_log_buffer(size_t total_buffer_size) { this->log_buffer_ = esphome::make_unique(total_buffer_size); #endif -#ifdef USE_ESP32 - // Start with loop disabled when using task buffer (unless using USB CDC) +#if defined(USE_ESP32) || defined(USE_LIBRETINY) + // Start with loop disabled when using task buffer (unless using USB CDC on ESP32) // The loop will be enabled automatically when messages arrive this->disable_loop_when_buffer_empty_(); #endif @@ -247,7 +247,7 @@ void Logger::process_messages_() { } #endif } -#ifdef USE_ESP32 +#if defined(USE_ESP32) || defined(USE_LIBRETINY) else { // No messages to process, disable loop if appropriate // This reduces overhead when there's no async logging activity diff --git a/esphome/components/logger/logger.h b/esphome/components/logger/logger.h index 79299c2b1c1..c58ca8ddce6 100644 --- a/esphome/components/logger/logger.h +++ b/esphome/components/logger/logger.h @@ -609,8 +609,8 @@ class Logger : public Component { this->write_body_to_buffer_(ESPHOME_LOG_RESET_COLOR, RESET_COLOR_LEN, buffer, buffer_at, buffer_size); } -#ifdef USE_ESP32 - // Disable loop when task buffer is empty (with USB CDC check) +#if defined(USE_ESP32) || defined(USE_LIBRETINY) + // Disable loop when task buffer is empty (with USB CDC check on ESP32) inline void disable_loop_when_buffer_empty_() { // Thread safety note: This is safe even if another task calls enable_loop_soon_any_context() // concurrently. If that happens between our check and disable_loop(), the enable request