Update TasmotaSerial to 2.3.0

Update TasmotaSerial to 2.3.0
This commit is contained in:
Theo Arends 2019-02-05 15:05:40 +01:00
parent 9c8af6428e
commit c998760deb
7 changed files with 9 additions and 8 deletions

View File

@ -14,6 +14,7 @@ TasmotaSerial KEYWORD1
#######################################
begin KEYWORD2
hardwareSerial KEYWORD2
read KEYWORD2
write KEYWORD2
available KEYWORD2

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/*
TasmotaSerial.cpp - Minimal implementation of software serial for Tasmota
Copyright (C) 2018 Theo Arends
Copyright (C) 2019 Theo Arends
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -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 = ESP.getCpuFreqMHz() *1000000 /TM_SERIAL_BAUDRATE;
m_bit_time = F_CPU / 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,7 +145,7 @@ bool TasmotaSerial::begin(long speed, int stop_bits) {
}
} else {
// Use getCycleCount() loop to get as exact timing as possible
m_bit_time = ESP.getCpuFreqMHz() *1000000 /speed;
m_bit_time = F_CPU / speed;
m_high_speed = (speed > 9600);
}
return m_valid;
@ -257,7 +257,7 @@ void TasmotaSerial::rxRead()
TM_SERIAL_WAIT;
}
// Store the received value in the buffer unless we have an overflow
int next = (m_in_pos+1) % TM_SERIAL_BUFFER_SIZE;
unsigned int next = (m_in_pos+1) % TM_SERIAL_BUFFER_SIZE;
if (next != (int)m_out_pos) {
m_buffer[m_in_pos] = rec;
m_in_pos = next;

View File

@ -1,7 +1,7 @@
/*
TasmotaSerial.h - Minimal implementation of software serial for Tasmota
Copyright (C) 2018 Theo Arends
Copyright (C) 2019 Theo Arends
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@
/*********************************************************************************************\
* TasmotaSerial supports up to 115200 baud with fixed buffer size of 64 bytes using optional no iram
*
* Based on EspSoftwareSerial v3.3.1 by Peter Lerup (https://github.com/plerup/espsoftwareserial)
* Based on EspSoftwareSerial v3.4.3 by Peter Lerup (https://github.com/plerup/espsoftwareserial)
\*********************************************************************************************/
#define TM_SERIAL_BAUDRATE 9600 // Default baudrate