Skip to content

Commit

Permalink
fixed issue on BME280 init (issue #184)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpsaturn committed Nov 19, 2023
1 parent bd5e28b commit 2ed621d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1561,13 +1561,16 @@ void Sensors::sht31Init() {
}

void Sensors::bme280Init() {
sensorAnnounce(SENSORS::SBME280);
#ifndef Wire1
if (!bme280.begin()) return;
#else
if (!bme280.begin() && !bme280.begin(BME280_ADDRESS,&Wire1)) return;
#endif
sensorRegister(SENSORS::SBME280);
sensorAnnounce(SENSORS::SBME280);
#ifndef Wire1
if (!bme280.begin() && !bme280.begin(BME280_ADDRESS_ALTERNATE)) return;
#else
if (!bme280.begin() &&
!bme280.begin(BME280_ADDRESS_ALTERNATE) &&
!bme280.begin(BME280_ADDRESS, &Wire1) &&
!bme280.begin(BME280_ADDRESS_ALTERNATE, &Wire1)) return;
#endif
sensorRegister(SENSORS::SBME280);
}

/// Environment BMP280 sensor init
Expand Down

0 comments on commit 2ed621d

Please sign in to comment.