mirror of
https://github.com/esphome/esphome.git
synced 2024-11-12 10:16:02 +01:00
Apparently no TX buffer for esp8266, and fix whitespace
This commit is contained in:
parent
4dd7d61049
commit
408a212eef
@ -72,7 +72,6 @@ void ESP8266UartComponent::setup() {
|
||||
) {
|
||||
this->hw_serial_ = &Serial;
|
||||
this->hw_serial_->begin(this->baud_rate_, config);
|
||||
this->hw_serial_->setTxBufferSize(this->tx_buffer_size_);
|
||||
this->hw_serial_->setRxBufferSize(this->rx_buffer_size_);
|
||||
ESP8266UartComponent::serial0_in_use = true;
|
||||
} else if (!ESP8266UartComponent::serial0_in_use && (tx_pin_ == nullptr || tx_pin_->get_pin() == 15) &&
|
||||
@ -85,14 +84,12 @@ void ESP8266UartComponent::setup() {
|
||||
) {
|
||||
this->hw_serial_ = &Serial;
|
||||
this->hw_serial_->begin(this->baud_rate_, config);
|
||||
this->hw_serial_->setTxBufferSize(this->tx_buffer_size_);
|
||||
this->hw_serial_->setRxBufferSize(this->rx_buffer_size_);
|
||||
this->hw_serial_->swap();
|
||||
ESP8266UartComponent::serial0_in_use = true;
|
||||
} else if ((tx_pin_ == nullptr || tx_pin_->get_pin() == 2) && (rx_pin_ == nullptr || rx_pin_->get_pin() == 8)) {
|
||||
this->hw_serial_ = &Serial1;
|
||||
this->hw_serial_->begin(this->baud_rate_, config);
|
||||
this->hw_serial_->setTxBufferSize(this->tx_buffer_size_);
|
||||
this->hw_serial_->setRxBufferSize(this->rx_buffer_size_);
|
||||
} else {
|
||||
this->sw_serial_ = new ESP8266SoftwareSerial(); // NOLINT
|
||||
@ -106,7 +103,6 @@ void ESP8266UartComponent::load_settings(bool dump_config) {
|
||||
if (this->hw_serial_ != nullptr) {
|
||||
SerialConfig config = static_cast<SerialConfig>(get_config());
|
||||
this->hw_serial_->begin(this->baud_rate_, config);
|
||||
this->hw_serial_->setTxBufferSize(this->tx_buffer_size_);
|
||||
this->hw_serial_->setRxBufferSize(this->rx_buffer_size_);
|
||||
} else {
|
||||
this->sw_serial_->setup(this->tx_pin_, this->rx_pin_, this->baud_rate_, this->stop_bits_, this->data_bits_,
|
||||
@ -122,9 +118,6 @@ void ESP8266UartComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "UART Bus:");
|
||||
LOG_PIN(" TX Pin: ", this->tx_pin_);
|
||||
LOG_PIN(" RX Pin: ", this->rx_pin_);
|
||||
if (this->tx_pin_ != nullptr) {
|
||||
ESP_LOGCONFIG(TAG, " TX Buffer Size: %u", this->tx_buffer_size_); // NOLINT
|
||||
}
|
||||
if (this->rx_pin_ != nullptr) {
|
||||
ESP_LOGCONFIG(TAG, " RX Buffer Size: %u", this->rx_buffer_size_); // NOLINT
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user