parent
b9c2cd3fbe
commit
ffec2a901f
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue