[Bugfix] Make BMP180 sensor code work

The variable name was wrong, and Wire wasn’t initialized when the sensor was enabled.
This commit is contained in:
Gergely Polonkai 2021-02-01 15:24:29 +01:00
parent b5dae4a1ce
commit f69efbd224
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
1 changed files with 4 additions and 2 deletions

View File

@ -60,7 +60,7 @@ BH1750 light;
#endif // HAVE_BH1750 #endif // HAVE_BH1750
#ifdef HAVE_BMP180 #ifdef HAVE_BMP180
Adafruit_BMP085 BMP; Adafruit_BMP085 bmp;
#endif // HAVE_BMP180 #endif // HAVE_BMP180
#if SYSTEM_MODE & MODE_PROM_PULL #if SYSTEM_MODE & MODE_PROM_PULL
@ -152,9 +152,11 @@ setup()
pinMode(RAIN_PIN, INPUT); pinMode(RAIN_PIN, INPUT);
#endif // RAIN_PIN #endif // RAIN_PIN
#ifdef HAVE_BH1750 #if defined(HAVE_BMP180) || defined(HAVE_BH1750)
Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN); Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
#endif // HAVE_BMP180 || HAVE_BH1750
#ifdef HAVE_BH1750
if (!light.begin()) { if (!light.begin()) {
Serial.println("Could not find the BH1750 sensor!"); Serial.println("Could not find the BH1750 sensor!");
stop(); stop();