diff --git a/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.cpp b/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.cpp index 42253ade6..0b5db85bb 100644 --- a/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.cpp +++ b/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.cpp @@ -80,6 +80,7 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, bool hardware_fa { m_valid = false; m_hardserial = 0; + m_hardswap = 0; m_stop_bits = 1; if (!((isValidGPIOpin(receive_pin)) && (isValidGPIOpin(transmit_pin) || transmit_pin == 16))) { return; @@ -89,6 +90,9 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, bool hardware_fa m_in_pos = m_out_pos = 0; if (hardware_fallback && (((3 == m_rx_pin) && (1 == m_tx_pin)) || ((3 == m_rx_pin) && (-1 == m_tx_pin)) || ((-1 == m_rx_pin) && (1 == m_tx_pin)))) { m_hardserial = 1; + } else if (hardware_fallback && (((13 == m_rx_pin) && (15 == m_tx_pin)) || ((13 == m_rx_pin) && (-1 == m_tx_pin)) || ((-1 == m_rx_pin) && (15 == m_tx_pin)))) { + m_hardserial = 1; + m_hardswap = 1; } else { if (m_rx_pin > -1) { m_buffer = (uint8_t*)malloc(TM_SERIAL_BUFFER_SIZE); @@ -134,6 +138,9 @@ bool TasmotaSerial::begin(long speed, int stop_bits) { } else { Serial.begin(speed, SERIAL_8N1); } + if(m_hardswap) { + Serial.swap(); + } } else { // Use getCycleCount() loop to get as exact timing as possible m_bit_time = ESP.getCpuFreqMHz() *1000000 /speed; diff --git a/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.h b/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.h index e40c34ee8..3136a8e46 100644 --- a/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.h +++ b/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.h @@ -62,6 +62,7 @@ class TasmotaSerial : public Stream { // Member variables bool m_valid; bool m_hardserial; + bool m_hardswap; bool m_high_speed; int m_rx_pin; int m_tx_pin;