From 42c2f1906f2a9bef13a19b4aa5e256a96b5a66c2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 31 Mar 2026 20:39:43 -1000 Subject: [PATCH] Use constexpr for queue size with +1 for LockFreeQueue ring buffer --- esphome/components/wifi/wifi_component.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/wifi/wifi_component.h b/esphome/components/wifi/wifi_component.h index 4f5ed0bc9f..a44a9bd617 100644 --- a/esphome/components/wifi/wifi_component.h +++ b/esphome/components/wifi/wifi_component.h @@ -891,10 +891,12 @@ class WiFiComponent final : public Component { // Thread-safe queue for WiFi events from LibreTiny callback thread. // LockFreeQueue on platforms with hardware atomics (RTL87xx, LN882x), // FreeRTOSQueue on platforms without (BK72xx). + static constexpr uint8_t LT_EVENT_QUEUE_SIZE = 16; #ifdef ESPHOME_THREAD_MULTI_ATOMICS - LockFreeQueue event_queue_; + // Ring buffer reserves one slot, so +1 for 16 usable slots + LockFreeQueue event_queue_; #else - FreeRTOSQueue event_queue_; + FreeRTOSQueue event_queue_; #endif #endif