From ffd533815032f4b8e7f960ed6b22c1806a6b0e4d Mon Sep 17 00:00:00 2001 From: gururise Date: Wed, 8 Apr 2020 10:22:32 -0700 Subject: [PATCH] PMS5003 RX TX pin handling in PmsInit --- tasmota/xsns_18_pms5003.ino | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tasmota/xsns_18_pms5003.ino b/tasmota/xsns_18_pms5003.ino index 0909921dc..2f02ff454 100644 --- a/tasmota/xsns_18_pms5003.ino +++ b/tasmota/xsns_18_pms5003.ino @@ -140,13 +140,26 @@ void PmsSecond(void) // Every second void PmsInit(void) { pms_type = 0; - if (pin[GPIO_PMS5003] < 99) { - PmsSerial = new TasmotaSerial(pin[GPIO_PMS5003], -1, 1); + if ((pin[GPIO_PMS5003_RX] < 99) && (pin[GPIO_PMS5003_TX] < 99)) + { + PmsSerial = new TasmotaSerial(pin[GPIO_PMS5003_RX], pin[GPIO_PMS5003_TX], 1); if (PmsSerial->begin(9600)) { if (PmsSerial->hardwareSerial()) { ClaimSerial(); } pms_type = 1; } } + else if ((pin[GPIO_PMS5003_RX] < 99)) + { + PmsSerial = new TasmotaSerial(pin[GPIO_PMS5003_RX], -1, 1); + if (PmsSerial->begin(9600)) + { + if (PmsSerial->hardwareSerial()) + { + ClaimSerial(); + } + pms_type = 1; + } + } } #ifdef USE_WEBSERVER