diff --git a/src/components/uart/drivers/ws_uart_drv_pm25aqi.h b/src/components/uart/drivers/ws_uart_drv_pm25aqi.h index 4eb4c0c92..a5623f65b 100644 --- a/src/components/uart/drivers/ws_uart_drv_pm25aqi.h +++ b/src/components/uart/drivers/ws_uart_drv_pm25aqi.h @@ -81,14 +81,17 @@ class ws_uart_drv_pm25aqi : public ws_uart_drv { /*******************************************************************************/ bool begin() override { _aqi = new Adafruit_PM25AQI(); + bool is_pm1006 = (strcmp(getDriverID(), "pm1006") == 0); #ifdef USE_SW_UART if (!_aqi->begin_UART( - _swSerial)) { // connect to the sensor over software serial + _swSerial, // connect to the sensor over software serial + is_pm1006)) { return false; } #else if (!_aqi->begin_UART( - _hwSerial)) { // connect to the sensor over hardware serial + _hwSerial, // connect to the sensor over hardware serial + is_pm1006)) { return false; } #endif