Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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