mirror of https://github.com/arendst/Tasmota.git
Add support for HardwareSerial invert (#15461)
This commit is contained in:
parent
3e3bfccb58
commit
f065d74293
|
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
||||||
### Added
|
### Added
|
||||||
- Berry `debug.caller` (#20470)
|
- Berry `debug.caller` (#20470)
|
||||||
- GPIO Viewer user selection of assets website now defaults to `https://ota.tasmota.com/tasmota|tasmota32/gpio_viewer/assets`
|
- GPIO Viewer user selection of assets website now defaults to `https://ota.tasmota.com/tasmota|tasmota32/gpio_viewer/assets`
|
||||||
|
- Support for HardwareSerial invert (#15461)
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||||
- NeoPool hydrolysis FL1 and Redox flag [#20258](https://github.com/arendst/Tasmota/issues/20258)
|
- NeoPool hydrolysis FL1 and Redox flag [#20258](https://github.com/arendst/Tasmota/issues/20258)
|
||||||
- Support negative power on BL0942 using index 5..8 [#20322](https://github.com/arendst/Tasmota/issues/20322)
|
- Support negative power on BL0942 using index 5..8 [#20322](https://github.com/arendst/Tasmota/issues/20322)
|
||||||
- Support for pipsolar inverter [#20408](https://github.com/arendst/Tasmota/issues/20408)
|
- Support for pipsolar inverter [#20408](https://github.com/arendst/Tasmota/issues/20408)
|
||||||
|
- Support for HardwareSerial invert [#15461](https://github.com/arendst/Tasmota/issues/15461)
|
||||||
- ESP32 used UART information
|
- ESP32 used UART information
|
||||||
- ESP32 experimental support GPIOViewer when ``define USE_ESP32_GPIO_VIEWER`` is enabled
|
- ESP32 experimental support GPIOViewer when ``define USE_ESP32_GPIO_VIEWER`` is enabled
|
||||||
- Berry GPIO viewer initial version using async webserver [#20416](https://github.com/arendst/Tasmota/issues/20416)
|
- Berry GPIO viewer initial version using async webserver [#20416](https://github.com/arendst/Tasmota/issues/20416)
|
||||||
|
|
|
@ -46,11 +46,12 @@ static uint32_t tasmota_serial_uart_bitmap = 0; // Assigned UARTs
|
||||||
|
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
||||||
TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fallback, int nwmode, int buffer_size) {
|
TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fallback, int nwmode, int buffer_size, bool invert) {
|
||||||
m_valid = false;
|
m_valid = false;
|
||||||
m_hardserial = false;
|
m_hardserial = false;
|
||||||
m_hardswap = false;
|
m_hardswap = false;
|
||||||
m_overflow = false;
|
m_overflow = false;
|
||||||
|
m_invert = invert;
|
||||||
m_data_bits = 8;
|
m_data_bits = 8;
|
||||||
m_stop_bits = 1;
|
m_stop_bits = 1;
|
||||||
m_nwmode = nwmode;
|
m_nwmode = nwmode;
|
||||||
|
@ -155,7 +156,7 @@ bool TasmotaSerial::freeUart(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TasmotaSerial::Esp32Begin(void) {
|
void TasmotaSerial::Esp32Begin(void) {
|
||||||
TSerial->begin(m_speed, m_config, m_rx_pin, m_tx_pin);
|
TSerial->begin(m_speed, m_config, m_rx_pin, m_tx_pin, m_invert);
|
||||||
// For low bit rate, below 9600, set the Full RX threshold at 10 bytes instead of the default 120
|
// For low bit rate, below 9600, set the Full RX threshold at 10 bytes instead of the default 120
|
||||||
if (m_speed <= 9600) {
|
if (m_speed <= 9600) {
|
||||||
// At 9600, 10 chars are ~10ms
|
// At 9600, 10 chars are ~10ms
|
||||||
|
@ -219,7 +220,7 @@ bool TasmotaSerial::begin(uint32_t speed, uint32_t config) {
|
||||||
}
|
}
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
Serial.begin(speed, (SerialConfig)config);
|
Serial.begin(speed, (SerialConfig)config, SERIAL_FULL, m_tx_pin, m_invert);
|
||||||
if (m_hardswap) {
|
if (m_hardswap) {
|
||||||
Serial.swap();
|
Serial.swap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
class TasmotaSerial : public Stream {
|
class TasmotaSerial : public Stream {
|
||||||
public:
|
public:
|
||||||
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, bool invert = false);
|
||||||
virtual ~TasmotaSerial();
|
virtual ~TasmotaSerial();
|
||||||
void setTransmitEnablePin(int tx_enable_pin);
|
void setTransmitEnablePin(int tx_enable_pin);
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ class TasmotaSerial : public Stream {
|
||||||
bool m_overflow;
|
bool m_overflow;
|
||||||
bool m_high_speed = false;
|
bool m_high_speed = false;
|
||||||
bool m_very_high_speed = false; // above 100000 bauds
|
bool m_very_high_speed = false; // above 100000 bauds
|
||||||
|
bool m_invert;
|
||||||
uint8_t *m_buffer = nullptr;
|
uint8_t *m_buffer = nullptr;
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
uint32_t m_speed;
|
uint32_t m_speed;
|
||||||
|
|
Loading…
Reference in New Issue