Improved for zigbee

This commit is contained in:
Stephan Hadinger 2021-11-11 19:22:15 +01:00
parent 75b749c67e
commit a36331fe47

View File

@ -159,11 +159,21 @@ bool TasmotaSerial::begin(uint32_t speed, uint32_t config) {
} }
// 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 (speed <= 9600) { if (speed <= 9600) {
// At 9600, 10 chars are ~10ms
uart_set_rx_full_threshold(m_uart, 10); uart_set_rx_full_threshold(m_uart, 10);
} else if (speed < 115200) {
// At 19200, 120 chars are ~60ms
// At 76800, 120 chars are ~15ms
uart_set_rx_full_threshold(m_uart, 120);
} else {
// At 115200, 256 chars are ~20ms
// Zigbee requires to keep frames together, i.e. 256 bytes max
uart_set_rx_full_threshold(m_uart, 256);
} }
// For bitrate below 115200, set the Rx time out to 5 chars instead of the default 10 // For bitrate below 115200, set the Rx time out to 6 chars instead of the default 10
if (speed < 115200) { if (speed < 115200) {
uart_set_rx_timeout(m_uart, 5); // At 76800 the timeout is ~1ms
uart_set_rx_timeout(m_uart, 6);
} }
} else { } else {
m_valid = false; m_valid = false;