UART flow control: Fix forgotten change to esp_idf and improve esp32-arduino

This commit is contained in:
brambo123 2024-03-14 13:45:45 +01:00
parent d92a57db75
commit 168ea40da6
2 changed files with 2 additions and 3 deletions

View File

@ -120,7 +120,6 @@ void ESP32ArduinoUARTComponent::setup() {
void ESP32ArduinoUARTComponent::load_settings(bool dump_config) {
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 flow_control = this->flow_control_pin_ != nullptr ? this->flow_control_pin_->get_pin() : -1;
bool invert = false;
if (tx_pin_ != nullptr && tx_pin_->is_inverted())
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);
#ifdef USE_UART_FLOW_CONTROL
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);
}
#endif

View File

@ -101,7 +101,7 @@ void IDFUARTComponent::setup() {
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) {
ESP_LOGW(TAG, "uart_set_pin failed: %s", esp_err_to_name(err));
this->mark_failed();