mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 03:36:42 +00:00
Change TasmotaSerial library from v3.2.0 to v3.3.0
Change TasmotaSerial library from v3.2.0 to v3.3.0
This commit is contained in:
parent
185c46e81a
commit
2057912276
@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- TuyaMcu dimmer timeout (#11121)
|
- TuyaMcu dimmer timeout (#11121)
|
||||||
|
- TasmotaSerial library from v3.2.0 to v3.3.0
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Refactor acceleration function for shutter stepper and servo (#11088)
|
- Refactor acceleration function for shutter stepper and servo (#11088)
|
||||||
|
@ -87,6 +87,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- TuyaMcu dimmer timeout [#11121](https://github.com/arendst/Tasmota/issues/11121)
|
- TuyaMcu dimmer timeout [#11121](https://github.com/arendst/Tasmota/issues/11121)
|
||||||
|
- TasmotaSerial library from v3.2.0 to v3.3.0
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Refactor acceleration function for shutter stepper and servo [#11088](https://github.com/arendst/Tasmota/issues/11088)
|
- Refactor acceleration function for shutter stepper and servo [#11088](https://github.com/arendst/Tasmota/issues/11088)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TasmotaSerial",
|
"name": "TasmotaSerial",
|
||||||
"version": "3.2.0",
|
"version": "3.3.0",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"serial", "io", "TasmotaSerial"
|
"serial", "io", "TasmotaSerial"
|
||||||
],
|
],
|
@ -1,5 +1,5 @@
|
|||||||
name=TasmotaSerial
|
name=TasmotaSerial
|
||||||
version=3.2.0
|
version=3.3.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 and ESP32.
|
sentence=Implementation of software serial with hardware serial fallback for ESP8266 and ESP32.
|
@ -109,16 +109,27 @@ bool TasmotaSerial::isValidGPIOpin(int pin) {
|
|||||||
return (pin >= -1 && pin <= 5) || (pin >= 12 && pin <= 15);
|
return (pin >= -1 && pin <= 5) || (pin >= 12 && pin <= 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TasmotaSerial::begin(long speed, int stop_bits) {
|
bool TasmotaSerial::begin(uint32_t speed, uint32_t config) {
|
||||||
m_stop_bits = ((stop_bits -1) &1) +1;
|
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;
|
||||||
|
if ((1 == m_stop_bits) && (config &0x03)) {
|
||||||
|
m_stop_bits++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m_stop_bits = ((config -1) &1) +1;
|
||||||
|
#ifdef ESP8266
|
||||||
|
config = (2 == m_stop_bits) ? (uint32_t)SERIAL_8N2 : (uint32_t)SERIAL_8N1;
|
||||||
|
#endif // ESP8266
|
||||||
|
#ifdef ESP32
|
||||||
|
config = (2 == m_stop_bits) ? SERIAL_8N2 : SERIAL_8N1;
|
||||||
|
#endif // ESP32
|
||||||
|
}
|
||||||
|
|
||||||
if (m_hardserial) {
|
if (m_hardserial) {
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
if (2 == m_stop_bits) {
|
Serial.begin(speed, (SerialConfig)config);
|
||||||
Serial.begin(speed, SERIAL_8N2);
|
|
||||||
} else {
|
|
||||||
Serial.begin(speed, SERIAL_8N1);
|
|
||||||
}
|
|
||||||
if (m_hardswap) {
|
if (m_hardswap) {
|
||||||
Serial.swap();
|
Serial.swap();
|
||||||
}
|
}
|
||||||
@ -131,11 +142,7 @@ bool TasmotaSerial::begin(long speed, int stop_bits) {
|
|||||||
m_uart = tasmota_serial_index;
|
m_uart = tasmota_serial_index;
|
||||||
tasmota_serial_index--;
|
tasmota_serial_index--;
|
||||||
TSerial = new HardwareSerial(m_uart);
|
TSerial = new HardwareSerial(m_uart);
|
||||||
if (2 == m_stop_bits) {
|
TSerial->begin(speed, config, m_rx_pin, m_tx_pin);
|
||||||
TSerial->begin(speed, SERIAL_8N2, m_rx_pin, m_tx_pin);
|
|
||||||
} else {
|
|
||||||
TSerial->begin(speed, SERIAL_8N1, m_rx_pin, m_tx_pin);
|
|
||||||
}
|
|
||||||
if (serial_buffer_size > 256) {
|
if (serial_buffer_size > 256) {
|
||||||
TSerial->setRxBufferSize(serial_buffer_size);
|
TSerial->setRxBufferSize(serial_buffer_size);
|
||||||
}
|
}
|
||||||
@ -154,10 +161,6 @@ bool TasmotaSerial::begin(long speed, int stop_bits) {
|
|||||||
return m_valid;
|
return m_valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TasmotaSerial::begin(void) {
|
|
||||||
return begin(TM_SERIAL_BAUDRATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TasmotaSerial::hardwareSerial(void) {
|
bool TasmotaSerial::hardwareSerial(void) {
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
return m_hardserial;
|
return m_hardserial;
|
@ -40,8 +40,7 @@ class TasmotaSerial : public Stream {
|
|||||||
TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fallback = 0, int nwmode = 0, int buffer_size = TM_SERIAL_BUFFER_SIZE);
|
TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fallback = 0, int nwmode = 0, int buffer_size = TM_SERIAL_BUFFER_SIZE);
|
||||||
virtual ~TasmotaSerial();
|
virtual ~TasmotaSerial();
|
||||||
|
|
||||||
bool begin(long speed, int stop_bits = 1);
|
bool begin(uint32_t speed = TM_SERIAL_BAUDRATE, uint32_t config = SERIAL_8N1);
|
||||||
bool begin(void);
|
|
||||||
bool hardwareSerial(void);
|
bool hardwareSerial(void);
|
||||||
int peek(void);
|
int peek(void);
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user