diff --git a/esphome/components/esp32/helpers.cpp b/esphome/components/esp32/helpers.cpp index cfc648e1d1..13b12157c4 100644 --- a/esphome/components/esp32/helpers.cpp +++ b/esphome/components/esp32/helpers.cpp @@ -39,15 +39,14 @@ LwIPLock::LwIPLock() { // Only lock if we're not already in the TCPIP thread if (!sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) { LOCK_TCPIP_CORE(); - locked_ = true; } #endif } LwIPLock::~LwIPLock() { #ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING - // Only unlock if we locked it - if (locked_ && sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) { + // Only unlock if we hold the lock + if (sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) { UNLOCK_TCPIP_CORE(); } #endif diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 745b3e5e8e..6650a1c4d5 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -695,11 +695,6 @@ class LwIPLock { public: LwIPLock(); ~LwIPLock(); - - protected: -#if defined(USE_ESP32) - bool locked_{false}; -#endif }; /** Helper class to request `loop()` to be called as fast as possible.