Skip to content

Commit

Permalink
Zigbee avoid disabling console serial on ESP32 and improved log messa…
Browse files Browse the repository at this point in the history
…ges (#22082)
  • Loading branch information
s-hadinger authored Sep 3, 2024
1 parent b6e81c1 commit 4164887
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_9_serial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4164887

Please sign in to comment.