diff --git a/esphome/components/ble_nus/ble_nus.cpp b/esphome/components/ble_nus/ble_nus.cpp index d0d37dbf1c..2f60f81471 100644 --- a/esphome/components/ble_nus/ble_nus.cpp +++ b/esphome/components/ble_nus/ble_nus.cpp @@ -67,14 +67,14 @@ bool BLENUS::read_array(uint8_t *data, size_t len) { // First, use the peek buffer if available if (this->has_peek_) { +#ifdef USE_UART_DEBUGGER + this->debug_callback_.call(uart::UART_DIRECTION_RX, this->peek_buffer_); +#endif data[0] = this->peek_buffer_; this->has_peek_ = false; data++; if (--len == 0) { // Decrement len first, then check it... -#ifdef USE_UART_DEBUGGER - this->debug_callback_.call(uart::UART_DIRECTION_RX, this->peek_buffer_); -#endif - return true; // No more to read + return true; // No more to read } } diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index c5448dd4f6..38bad4f2e5 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -715,17 +715,20 @@ void Application::yield_with_select_(uint32_t delay_ms) { #endif // Process select() result: - // ret < 0: error (except EINTR which is normal) // ret > 0: socket(s) have data ready - normal and expected // ret == 0: timeout occurred - normal and expected - const int err = errno; - if (ret >= 0 || err == EINTR) [[likely]] { + if (ret >= 0) [[likely]] { // Yield if zero timeout since select(0) only polls without yielding if (delay_ms == 0) [[unlikely]] { yield(); } return; } + // ret < 0: error (EINTR is normal, anything else is unexpected) + const int err = errno; + if (err == EINTR) { + return; + } // select() error - log and fall through to delay() ESP_LOGW(TAG, "select() failed with errno %d", err); } diff --git a/esphome/core/component.cpp b/esphome/core/component.cpp index 100ac5dfda..f493a592f2 100644 --- a/esphome/core/component.cpp +++ b/esphome/core/component.cpp @@ -524,7 +524,7 @@ uint32_t PollingComponent::get_update_interval() const { return this->update_int void PollingComponent::set_update_interval(uint32_t update_interval) { this->update_interval_ = update_interval; } void __attribute__((noinline, cold)) -WarnIfComponentBlockingGuard::warn_blocking_(Component *component, uint32_t blocking_time) { +WarnIfComponentBlockingGuard::warn_blocking(Component *component, uint32_t blocking_time) { bool should_warn; if (component != nullptr) { should_warn = component->should_warn_of_blocking(blocking_time); diff --git a/esphome/core/component.h b/esphome/core/component.h index 0997d02cea..5fdf23e128 100644 --- a/esphome/core/component.h +++ b/esphome/core/component.h @@ -599,7 +599,7 @@ class WarnIfComponentBlockingGuard { this->record_runtime_stats_(); #endif if (blocking_time > WARN_IF_BLOCKING_OVER_MS) [[unlikely]] { - warn_blocking_(this->component_, blocking_time); + warn_blocking(this->component_, blocking_time); } return curr_time; } @@ -616,7 +616,7 @@ class WarnIfComponentBlockingGuard { private: // Cold path for blocking warning - defined in component.cpp - static void __attribute__((noinline, cold)) warn_blocking_(Component *component, uint32_t blocking_time); + static void __attribute__((noinline, cold)) warn_blocking(Component *component, uint32_t blocking_time); }; // Function to clear setup priority overrides after all components are set up