mirror of
https://github.com/esphome/esphome.git
synced 2025-02-07 00:11:59 +01:00
[uart] allow set parameters before ready
This commit is contained in:
parent
7480f92879
commit
a9b0c5a159
@ -200,19 +200,23 @@ void IDFUARTComponent::dump_config() {
|
||||
}
|
||||
|
||||
void IDFUARTComponent::set_rx_full_threshold(size_t rx_full_threshold) {
|
||||
esp_err_t err = uart_set_rx_full_threshold(this->uart_num_, rx_full_threshold);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "uart_set_rx_full_threshold failed: %s", esp_err_to_name(err));
|
||||
return;
|
||||
if (this->is_ready()) {
|
||||
esp_err_t err = uart_set_rx_full_threshold(this->uart_num_, rx_full_threshold);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "uart_set_rx_full_threshold failed: %s", esp_err_to_name(err));
|
||||
return;
|
||||
}
|
||||
}
|
||||
this->rx_full_threshold_ = rx_full_threshold;
|
||||
}
|
||||
|
||||
void IDFUARTComponent::set_rx_timeout(size_t rx_timeout) {
|
||||
esp_err_t err = uart_set_rx_timeout(this->uart_num_, rx_timeout);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "uart_set_rx_timeout failed: %s", esp_err_to_name(err));
|
||||
return;
|
||||
if (this->is_ready()) {
|
||||
esp_err_t err = uart_set_rx_timeout(this->uart_num_, rx_timeout);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "uart_set_rx_timeout failed: %s", esp_err_to_name(err));
|
||||
return;
|
||||
}
|
||||
}
|
||||
this->rx_timeout_ = rx_timeout;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user