Zigbee avoid disabling console serial on ESP32 and improved log messages (#22082)

This commit is contained in:
s-hadinger 2024-09-03 23:06:07 +02:00 committed by GitHub
parent b6e81c1edd
commit 4164887412
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View File

@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file.
- Matter fail to report Shutter status if no shutter is configured in Tasmota
- Matter fix Waterleak broken after Berry solidification optimisation #21885
- Berry avoid `readbytes()` from crashing when file is too large
- Zigbee avoid disabling console serial on ESP32 and improved log messages
### Removed
- Berry remove reuse of methods for interface-like code reuse #21500

View File

@ -298,13 +298,25 @@ void ZigbeeInitSerial(void)
if (PinUsed(GPIO_ZIGBEE_RX) && PinUsed(GPIO_ZIGBEE_TX)) {
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_ZIGBEE "GPIOs Rx:%d Tx:%d"), Pin(GPIO_ZIGBEE_RX), Pin(GPIO_ZIGBEE_TX));
// if TasmotaGlobal.seriallog_level is 0, we allow GPIO 13/15 to switch to Hardware Serial
ZigbeeSerial = new TasmotaSerial(Pin(GPIO_ZIGBEE_RX), Pin(GPIO_ZIGBEE_TX), TasmotaGlobal.seriallog_level ? 1 : 2, 0, 256); // set a receive buffer of 256 bytes
int32_t uart_num = TasmotaGlobal.seriallog_level ? 1 : 2;
ZigbeeSerial = new TasmotaSerial(Pin(GPIO_ZIGBEE_RX), Pin(GPIO_ZIGBEE_TX), uart_num, 0, 256); // set a receive buffer of 256 bytes
if (ZigbeeSerial == nullptr) {
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Failed to allocate TasmotaSerial - aborting Zigbee"));
return;
}
if (!ZigbeeSerial->isValid()) {
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "Invalid Serial GPIOs - aborting Zigbee"));
delete ZigbeeSerial;
return;
}
ZigbeeSerial->begin(115200);
#ifdef ESP8266
if (ZigbeeSerial->hardwareSerial()) {
ClaimSerial();
}
#endif // ESP8266
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Serial UART%d"), ZigbeeSerial->getUart());
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ZIGBEE "Using Hardware Serial UART%d"), ZigbeeSerial->getUart());
#endif // ESP32
zigbee_buffer = new SBuffer(ZIGBEE_BUFFER_SIZE);