Merge pull request #13874 from perexg/zigbee-serial-reset

ZigBee serial: always initialize RST pins (for TCP serial server)
This commit is contained in:
s-hadinger 2021-11-30 22:38:00 +01:00 committed by GitHub
commit e951fa9f31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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