From ffec2a901f54ec9ea6876ab0f317657b428eff48 Mon Sep 17 00:00:00 2001 From: Tomer27cz Date: Sat, 28 Feb 2026 22:36:15 +0100 Subject: [PATCH] Update xt211_uart.h remove obsolete UART lock for newer ESPHome versions --- components/xt211/xt211_uart.h | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/components/xt211/xt211_uart.h b/components/xt211/xt211_uart.h index f1c2ab8..b6d82b9 100644 --- a/components/xt211/xt211_uart.h +++ b/components/xt211/xt211_uart.h @@ -89,15 +89,7 @@ class XT211Uart final : public uart::IDFUARTComponent { // Reconfigure baudrate void update_baudrate(uint32_t baudrate) { - auto &lock = uart_.*(&XT211Uart::lock_); - if (lock != nullptr) { - xSemaphoreTake(lock, portMAX_DELAY); - uart_set_baudrate(iuart_num_, baudrate); - xSemaphoreGive(lock); - } else { - // Lock not initialized yet, just set baudrate without locking - uart_set_baudrate(iuart_num_, baudrate); - } + uart_set_baudrate(iuart_num_, baudrate); } bool read_one_byte(uint8_t *data) { return read_array_quick_(data, 1); } @@ -122,13 +114,6 @@ class XT211Uart final : public uart::IDFUARTComponent { if (!this->check_read_timeout_quick_(len)) return false; - auto &lock = uart_.*(&XT211Uart::lock_); - bool locked = false; - if (lock != nullptr) { - xSemaphoreTake(lock, portMAX_DELAY); - locked = true; - } - if (this->has_peek_) { length_to_read--; *data = this->peek_byte_; @@ -146,10 +131,6 @@ class XT211Uart final : public uart::IDFUARTComponent { } } - if (locked) { - xSemaphoreGive(lock); - } - return true; } @@ -159,4 +140,4 @@ class XT211Uart final : public uart::IDFUARTComponent { #endif } // namespace xt211 -} // namespace esphome +} // namespace esphome \ No newline at end of file