mirror of
https://github.com/esphome/esphome.git
synced 2026-01-09 11:40:50 -07:00
Merge branch 'disable_loop_when_buffer_empty_' into integration
This commit is contained in:
@@ -197,8 +197,8 @@ void Logger::init_log_buffer(size_t total_buffer_size) {
|
|||||||
this->log_buffer_ = esphome::make_unique<logger::TaskLogBufferLibreTiny>(total_buffer_size);
|
this->log_buffer_ = esphome::make_unique<logger::TaskLogBufferLibreTiny>(total_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_ESP32
|
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
||||||
// Start with loop disabled when using task buffer (unless using USB CDC)
|
// Start with loop disabled when using task buffer (unless using USB CDC on ESP32)
|
||||||
// The loop will be enabled automatically when messages arrive
|
// The loop will be enabled automatically when messages arrive
|
||||||
this->disable_loop_when_buffer_empty_();
|
this->disable_loop_when_buffer_empty_();
|
||||||
#endif
|
#endif
|
||||||
@@ -247,7 +247,7 @@ void Logger::process_messages_() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef USE_ESP32
|
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
||||||
else {
|
else {
|
||||||
// No messages to process, disable loop if appropriate
|
// No messages to process, disable loop if appropriate
|
||||||
// This reduces overhead when there's no async logging activity
|
// This reduces overhead when there's no async logging activity
|
||||||
|
|||||||
@@ -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);
|
this->write_body_to_buffer_(ESPHOME_LOG_RESET_COLOR, RESET_COLOR_LEN, buffer, buffer_at, buffer_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_ESP32
|
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
||||||
// Disable loop when task buffer is empty (with USB CDC check)
|
// Disable loop when task buffer is empty (with USB CDC check on ESP32)
|
||||||
inline void disable_loop_when_buffer_empty_() {
|
inline void disable_loop_when_buffer_empty_() {
|
||||||
// Thread safety note: This is safe even if another task calls enable_loop_soon_any_context()
|
// 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
|
// concurrently. If that happens between our check and disable_loop(), the enable request
|
||||||
|
|||||||
Reference in New Issue
Block a user