From 919058ebfdf6b7d27a228917730031ba10dc2bb6 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 5 Mar 2021 14:36:39 +0100 Subject: [PATCH] Add TasmotaSerial valid pin chk --- lib/default/TasmotaSerial-3.3.0/src/TasmotaSerial.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/default/TasmotaSerial-3.3.0/src/TasmotaSerial.cpp b/lib/default/TasmotaSerial-3.3.0/src/TasmotaSerial.cpp index 253c3094b..921ebff30 100644 --- a/lib/default/TasmotaSerial-3.3.0/src/TasmotaSerial.cpp +++ b/lib/default/TasmotaSerial-3.3.0/src/TasmotaSerial.cpp @@ -68,6 +68,7 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fal m_hardswap = true; } else { + if ((m_rx_pin < 0) && (m_tx_pin < 0)) { return; } if (m_rx_pin > -1) { m_buffer = (uint8_t*)malloc(serial_buffer_size); if (m_buffer == NULL) return; @@ -110,6 +111,7 @@ bool TasmotaSerial::isValidGPIOpin(int pin) { } bool TasmotaSerial::begin(uint32_t speed, uint32_t config) { + if (!m_valid) { return false; } if (config > 2) { // Legacy support where software serial fakes two stop bits if either stop bits is 2 or parity is not None m_stop_bits = ((config &0x30) >> 5) +1;