Update xt211_uart.h

remove obsolete UART lock for newer ESPHome versions
main
Tomer27cz 2026-02-28 22:36:15 +01:00
parent b9c2cd3fbe
commit ffec2a901f
1 changed files with 2 additions and 21 deletions

View File

@ -89,15 +89,7 @@ class XT211Uart final : public uart::IDFUARTComponent {
// Reconfigure baudrate // Reconfigure baudrate
void update_baudrate(uint32_t baudrate) { void update_baudrate(uint32_t baudrate) {
auto &lock = uart_.*(&XT211Uart::lock_); uart_set_baudrate(iuart_num_, baudrate);
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);
}
} }
bool read_one_byte(uint8_t *data) { return read_array_quick_(data, 1); } 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)) if (!this->check_read_timeout_quick_(len))
return false; return false;
auto &lock = uart_.*(&XT211Uart::lock_);
bool locked = false;
if (lock != nullptr) {
xSemaphoreTake(lock, portMAX_DELAY);
locked = true;
}
if (this->has_peek_) { if (this->has_peek_) {
length_to_read--; length_to_read--;
*data = this->peek_byte_; *data = this->peek_byte_;
@ -146,10 +131,6 @@ class XT211Uart final : public uart::IDFUARTComponent {
} }
} }
if (locked) {
xSemaphoreGive(lock);
}
return true; return true;
} }