From a03c1c90c7749f45ede573cc61ee5db2efc06cdb Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 18 Apr 2019 10:22:05 +0200 Subject: [PATCH] Change disable interrupts during SerialSend from 9600 bps and up (#5528) Change disable interrupts during SerialSend from 9600 bps and up (#5528) --- lib/{TasmotaSerial-2.3.0 => TasmotaSerial-2.3.1}/README.md | 0 .../examples/swsertest/swsertest.ino | 0 .../keywords.txt | 0 .../library.json | 0 .../library.properties | 0 .../src/TasmotaSerial.cpp | 6 +++--- .../src/TasmotaSerial.h | 0 7 files changed, 3 insertions(+), 3 deletions(-) rename lib/{TasmotaSerial-2.3.0 => TasmotaSerial-2.3.1}/README.md (100%) rename lib/{TasmotaSerial-2.3.0 => TasmotaSerial-2.3.1}/examples/swsertest/swsertest.ino (100%) rename lib/{TasmotaSerial-2.3.0 => TasmotaSerial-2.3.1}/keywords.txt (100%) rename lib/{TasmotaSerial-2.3.0 => TasmotaSerial-2.3.1}/library.json (100%) rename lib/{TasmotaSerial-2.3.0 => TasmotaSerial-2.3.1}/library.properties (100%) rename lib/{TasmotaSerial-2.3.0 => TasmotaSerial-2.3.1}/src/TasmotaSerial.cpp (97%) rename lib/{TasmotaSerial-2.3.0 => TasmotaSerial-2.3.1}/src/TasmotaSerial.h (100%) diff --git a/lib/TasmotaSerial-2.3.0/README.md b/lib/TasmotaSerial-2.3.1/README.md similarity index 100% rename from lib/TasmotaSerial-2.3.0/README.md rename to lib/TasmotaSerial-2.3.1/README.md diff --git a/lib/TasmotaSerial-2.3.0/examples/swsertest/swsertest.ino b/lib/TasmotaSerial-2.3.1/examples/swsertest/swsertest.ino similarity index 100% rename from lib/TasmotaSerial-2.3.0/examples/swsertest/swsertest.ino rename to lib/TasmotaSerial-2.3.1/examples/swsertest/swsertest.ino diff --git a/lib/TasmotaSerial-2.3.0/keywords.txt b/lib/TasmotaSerial-2.3.1/keywords.txt similarity index 100% rename from lib/TasmotaSerial-2.3.0/keywords.txt rename to lib/TasmotaSerial-2.3.1/keywords.txt diff --git a/lib/TasmotaSerial-2.3.0/library.json b/lib/TasmotaSerial-2.3.1/library.json similarity index 100% rename from lib/TasmotaSerial-2.3.0/library.json rename to lib/TasmotaSerial-2.3.1/library.json diff --git a/lib/TasmotaSerial-2.3.0/library.properties b/lib/TasmotaSerial-2.3.1/library.properties similarity index 100% rename from lib/TasmotaSerial-2.3.0/library.properties rename to lib/TasmotaSerial-2.3.1/library.properties diff --git a/lib/TasmotaSerial-2.3.0/src/TasmotaSerial.cpp b/lib/TasmotaSerial-2.3.1/src/TasmotaSerial.cpp similarity index 97% rename from lib/TasmotaSerial-2.3.0/src/TasmotaSerial.cpp rename to lib/TasmotaSerial-2.3.1/src/TasmotaSerial.cpp index eecdeb124..d99137edc 100644 --- a/lib/TasmotaSerial-2.3.0/src/TasmotaSerial.cpp +++ b/lib/TasmotaSerial-2.3.1/src/TasmotaSerial.cpp @@ -100,7 +100,7 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fal m_buffer = (uint8_t*)malloc(TM_SERIAL_BUFFER_SIZE); if (m_buffer == NULL) return; // Use getCycleCount() loop to get as exact timing as possible - m_bit_time = F_CPU / TM_SERIAL_BAUDRATE; + m_bit_time = ESP.getCpuFreqMHz() * 1000000 / TM_SERIAL_BAUDRATE; pinMode(m_rx_pin, INPUT); tms_obj_list[m_rx_pin] = this; attachInterrupt(m_rx_pin, ISRList[m_rx_pin], FALLING); @@ -145,8 +145,8 @@ bool TasmotaSerial::begin(long speed, int stop_bits) { } } else { // Use getCycleCount() loop to get as exact timing as possible - m_bit_time = F_CPU / speed; - m_high_speed = (speed > 9600); + m_bit_time = ESP.getCpuFreqMHz() * 1000000 / speed; + m_high_speed = (speed >= 9600); } return m_valid; } diff --git a/lib/TasmotaSerial-2.3.0/src/TasmotaSerial.h b/lib/TasmotaSerial-2.3.1/src/TasmotaSerial.h similarity index 100% rename from lib/TasmotaSerial-2.3.0/src/TasmotaSerial.h rename to lib/TasmotaSerial-2.3.1/src/TasmotaSerial.h