Merge pull request #746 from adafruit/745-update-v1-codebase-to-use-latest-release-of-pm25-library-is_pm1006-flag

Update PM2.5 begin_UART call for PM1006 (PM25AQI v2.0.0)
This commit is contained in:
Tyeth Gundry 2025-05-12 17:37:40 +01:00 committed by GitHub
commit bcf1d08d58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,14 +81,17 @@ public:
/*******************************************************************************/
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