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
This commit is contained in:
Theo Arends 2018-11-06 11:27:19 +01:00
parent ca1cf987c7
commit 49acf4a7d3
8 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "TasmotaSerial", "name": "TasmotaSerial",
"version": "2.1.0", "version": "2.2.0",
"keywords": [ "keywords": [
"serial", "io", "TasmotaSerial" "serial", "io", "TasmotaSerial"
], ],

View File

@ -1,5 +1,5 @@
name=TasmotaSerial name=TasmotaSerial
version=2.1.0 version=2.2.0
author=Theo Arends author=Theo Arends
maintainer=Theo Arends <theo@arends.com> maintainer=Theo Arends <theo@arends.com>
sentence=Implementation of software serial with hardware serial fallback for ESP8266. sentence=Implementation of software serial with hardware serial fallback for ESP8266.

View File

@ -90,10 +90,12 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, bool hardware_fa
m_in_pos = m_out_pos = 0; 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)))) { 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; 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_hardserial = 1;
m_hardswap = 1; m_hardswap = 1;
} else { }
else {
if (m_rx_pin > -1) { if (m_rx_pin > -1) {
m_buffer = (uint8_t*)malloc(TM_SERIAL_BUFFER_SIZE); m_buffer = (uint8_t*)malloc(TM_SERIAL_BUFFER_SIZE);
if (m_buffer == NULL) return; if (m_buffer == NULL) return;
@ -138,7 +140,7 @@ bool TasmotaSerial::begin(long speed, int stop_bits) {
} else { } else {
Serial.begin(speed, SERIAL_8N1); Serial.begin(speed, SERIAL_8N1);
} }
if(m_hardswap) { if (m_hardswap) {
Serial.swap(); Serial.swap();
} }
} else { } else {

View File

@ -1,6 +1,8 @@
/* 6.3.0.3 20181105 /* 6.3.0.3 20181105
* Fix hardware serial pin configuration. To keep using hardware serial swap current Rx/Tx pin configuration only (#4280) * 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 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 * 6.3.0.2 20181101
* Add minutes to commands Timezone to allow all possible world timezones * Add minutes to commands Timezone to allow all possible world timezones