From 838ac68a84b41d0ecf682f4c2b62f41c27962b9b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 30 Nov 2021 18:27:13 +0100 Subject: [PATCH] ZigBee serial: always initialize RST pins (for TCP serial server) --- tasmota/xdrv_23_zigbee_9_serial.ino | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tasmota/xdrv_23_zigbee_9_serial.ino b/tasmota/xdrv_23_zigbee_9_serial.ino index 3eaea4048..2d054aebb 100644 --- a/tasmota/xdrv_23_zigbee_9_serial.ino +++ b/tasmota/xdrv_23_zigbee_9_serial.ino @@ -282,6 +282,17 @@ void ZigbeeInputLoop(void) { void ZigbeeInitSerial(void) { zigbee.active = false; + + // always initialize reset pins for TCP serial server + if (PinUsed(GPIO_ZIGBEE_RST)) { + pinMode(Pin(GPIO_ZIGBEE_RST), OUTPUT); + digitalWrite(Pin(GPIO_ZIGBEE_RST), 1); + } + if (PinUsed(GPIO_ZIGBEE_RST, 1)) { + pinMode(Pin(GPIO_ZIGBEE_RST, 1), OUTPUT); + digitalWrite(Pin(GPIO_ZIGBEE_RST, 1), 1); + } + 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 @@ -295,15 +306,6 @@ void ZigbeeInitSerial(void) zigbee_buffer = new SBuffer(ZIGBEE_BUFFER_SIZE); } - if (PinUsed(GPIO_ZIGBEE_RST)) { - pinMode(Pin(GPIO_ZIGBEE_RST), OUTPUT); - digitalWrite(Pin(GPIO_ZIGBEE_RST), 1); - } - if (PinUsed(GPIO_ZIGBEE_RST, 1)) { - pinMode(Pin(GPIO_ZIGBEE_RST, 1), OUTPUT); - digitalWrite(Pin(GPIO_ZIGBEE_RST, 1), 1); - } - zigbee.active = true; zigbee.init_phase = true; // start the state machine zigbee.state_machine = true; // start the state machine