mirror of
https://github.com/esphome/esphome.git
synced 2024-09-21 03:12:12 +02:00
UART flow control: Fix forgotten change to esp_idf and improve esp32-arduino
This commit is contained in:
parent
d92a57db75
commit
168ea40da6
@ -120,7 +120,6 @@ void ESP32ArduinoUARTComponent::setup() {
|
|||||||
void ESP32ArduinoUARTComponent::load_settings(bool dump_config) {
|
void ESP32ArduinoUARTComponent::load_settings(bool dump_config) {
|
||||||
int8_t tx = this->tx_pin_ != nullptr ? this->tx_pin_->get_pin() : -1;
|
int8_t tx = this->tx_pin_ != nullptr ? this->tx_pin_->get_pin() : -1;
|
||||||
int8_t rx = this->rx_pin_ != nullptr ? this->rx_pin_->get_pin() : -1;
|
int8_t rx = this->rx_pin_ != nullptr ? this->rx_pin_->get_pin() : -1;
|
||||||
int8_t flow_control = this->flow_control_pin_ != nullptr ? this->flow_control_pin_->get_pin() : -1;
|
|
||||||
bool invert = false;
|
bool invert = false;
|
||||||
if (tx_pin_ != nullptr && tx_pin_->is_inverted())
|
if (tx_pin_ != nullptr && tx_pin_->is_inverted())
|
||||||
invert = true;
|
invert = true;
|
||||||
@ -131,7 +130,7 @@ void ESP32ArduinoUARTComponent::load_settings(bool dump_config) {
|
|||||||
this->hw_serial_->begin(this->baud_rate_, get_config(), rx, tx, invert);
|
this->hw_serial_->begin(this->baud_rate_, get_config(), rx, tx, invert);
|
||||||
#ifdef USE_UART_FLOW_CONTROL
|
#ifdef USE_UART_FLOW_CONTROL
|
||||||
if (this->flow_control_pin_ != nullptr) {
|
if (this->flow_control_pin_ != nullptr) {
|
||||||
this->hw_serial_->setPins(-1, -1, -1, flow_control);
|
this->hw_serial_->setPins(-1, -1, -1, this->flow_control_pin_->get_pin());
|
||||||
this->hw_serial_->setMode(UART_MODE_RS485_HALF_DUPLEX);
|
this->hw_serial_->setMode(UART_MODE_RS485_HALF_DUPLEX);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,7 +101,7 @@ void IDFUARTComponent::setup() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = uart_set_pin(this->uart_num_, tx, rx, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
|
err = uart_set_pin(this->uart_num_, tx, rx, flow_control, UART_PIN_NO_CHANGE);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGW(TAG, "uart_set_pin failed: %s", esp_err_to_name(err));
|
ESP_LOGW(TAG, "uart_set_pin failed: %s", esp_err_to_name(err));
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
|
Loading…
Reference in New Issue
Block a user