From 49acf4a7d31ffc001737c5d63d4557e112f3d6b5 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 6 Nov 2018 11:27:19 +0100 Subject: [PATCH] Add optional hardware serial * Add optional hardware serial when GPIO13(Rx) and GPIO15(Tx) are selected removing hardware serial from GPIO01(Tx) and GPIO03(Rx) (#4288) * Bump TasmotaSerial version from 2.1.0 to 2.2.0 --- .../README.md | 0 .../examples/swsertest/swsertest.ino | 0 .../keywords.txt | 0 .../library.json | 2 +- .../library.properties | 2 +- .../src/TasmotaSerial.cpp | 8 +++++--- .../src/TasmotaSerial.h | 0 sonoff/_changelog.ino | 2 ++ 8 files changed, 9 insertions(+), 5 deletions(-) rename lib/{TasmotaSerial-2.1.0 => TasmotaSerial-2.2.0}/README.md (100%) rename lib/{TasmotaSerial-2.1.0 => TasmotaSerial-2.2.0}/examples/swsertest/swsertest.ino (100%) rename lib/{TasmotaSerial-2.1.0 => TasmotaSerial-2.2.0}/keywords.txt (100%) rename lib/{TasmotaSerial-2.1.0 => TasmotaSerial-2.2.0}/library.json (94%) rename lib/{TasmotaSerial-2.1.0 => TasmotaSerial-2.2.0}/library.properties (94%) rename lib/{TasmotaSerial-2.1.0 => TasmotaSerial-2.2.0}/src/TasmotaSerial.cpp (97%) rename lib/{TasmotaSerial-2.1.0 => TasmotaSerial-2.2.0}/src/TasmotaSerial.h (100%) diff --git a/lib/TasmotaSerial-2.1.0/README.md b/lib/TasmotaSerial-2.2.0/README.md similarity index 100% rename from lib/TasmotaSerial-2.1.0/README.md rename to lib/TasmotaSerial-2.2.0/README.md diff --git a/lib/TasmotaSerial-2.1.0/examples/swsertest/swsertest.ino b/lib/TasmotaSerial-2.2.0/examples/swsertest/swsertest.ino similarity index 100% rename from lib/TasmotaSerial-2.1.0/examples/swsertest/swsertest.ino rename to lib/TasmotaSerial-2.2.0/examples/swsertest/swsertest.ino diff --git a/lib/TasmotaSerial-2.1.0/keywords.txt b/lib/TasmotaSerial-2.2.0/keywords.txt similarity index 100% rename from lib/TasmotaSerial-2.1.0/keywords.txt rename to lib/TasmotaSerial-2.2.0/keywords.txt diff --git a/lib/TasmotaSerial-2.1.0/library.json b/lib/TasmotaSerial-2.2.0/library.json similarity index 94% rename from lib/TasmotaSerial-2.1.0/library.json rename to lib/TasmotaSerial-2.2.0/library.json index 59d06ad5f..23a2ddab9 100644 --- a/lib/TasmotaSerial-2.1.0/library.json +++ b/lib/TasmotaSerial-2.2.0/library.json @@ -1,6 +1,6 @@ { "name": "TasmotaSerial", - "version": "2.1.0", + "version": "2.2.0", "keywords": [ "serial", "io", "TasmotaSerial" ], diff --git a/lib/TasmotaSerial-2.1.0/library.properties b/lib/TasmotaSerial-2.2.0/library.properties similarity index 94% rename from lib/TasmotaSerial-2.1.0/library.properties rename to lib/TasmotaSerial-2.2.0/library.properties index 93f4a1d39..54c79e218 100644 --- a/lib/TasmotaSerial-2.1.0/library.properties +++ b/lib/TasmotaSerial-2.2.0/library.properties @@ -1,5 +1,5 @@ name=TasmotaSerial -version=2.1.0 +version=2.2.0 author=Theo Arends maintainer=Theo Arends sentence=Implementation of software serial with hardware serial fallback for ESP8266. diff --git a/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.cpp b/lib/TasmotaSerial-2.2.0/src/TasmotaSerial.cpp similarity index 97% rename from lib/TasmotaSerial-2.1.0/src/TasmotaSerial.cpp rename to lib/TasmotaSerial-2.2.0/src/TasmotaSerial.cpp index 0b5db85bb..7e6ddf72f 100644 --- a/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.cpp +++ b/lib/TasmotaSerial-2.2.0/src/TasmotaSerial.cpp @@ -90,10 +90,12 @@ 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)))) { + } + 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 { + } + else { if (m_rx_pin > -1) { m_buffer = (uint8_t*)malloc(TM_SERIAL_BUFFER_SIZE); if (m_buffer == NULL) return; @@ -138,7 +140,7 @@ bool TasmotaSerial::begin(long speed, int stop_bits) { } else { Serial.begin(speed, SERIAL_8N1); } - if(m_hardswap) { + if (m_hardswap) { Serial.swap(); } } else { diff --git a/lib/TasmotaSerial-2.1.0/src/TasmotaSerial.h b/lib/TasmotaSerial-2.2.0/src/TasmotaSerial.h similarity index 100% rename from lib/TasmotaSerial-2.1.0/src/TasmotaSerial.h rename to lib/TasmotaSerial-2.2.0/src/TasmotaSerial.h diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 0750b4d06..58e084d34 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,6 +1,8 @@ /* 6.3.0.3 20181105 * Fix hardware serial pin configuration. To keep using hardware serial swap current Rx/Tx pin configuration only (#4280) * Add more strict checks for GPIO selections + * Add optional hardware serial when GPIO13(Rx) and GPIO15(Tx) are selected removing hardware serial from GPIO01(Tx) and GPIO03(Rx) (#4288) + * Bump TasmotaSerial version from 2.1.0 to 2.2.0 * * 6.3.0.2 20181101 * Add minutes to commands Timezone to allow all possible world timezones