mirror of https://github.com/arendst/Tasmota.git
PMS5003 RX TX pin handling in PmsInit
This commit is contained in:
parent
8d1322984c
commit
ffd5338150
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue