Fix BME280 (#962)

Fix log output, since %H never prints anything
This commit is contained in:
spacemanspiff2007 authored and GitHub committed 2021-05-30 11:34:15 -05:00
1 parent 3f4ac8bbd3
commit cd09476807
2 files changed
+19 -2

No files matched your search

+15 -2
View File
@@ -49,9 +49,16 @@
BME280 mySensor;
void setupZsensorBME280() {
# if defined(ESP8266) || defined(ESP32)
// Allow custom pins on ESP Platforms
Wire.begin(BME280_PIN_SDA, BME280_PIN_SCL);
# else
Wire.begin();
# endif
mySensor.settings.commInterface = I2C_MODE;
mySensor.settings.I2CAddress = BME280_i2c_addr;
Log.notice(F("Setup BME280 on adress: %H" CR), BME280_i2c_addr);
Log.notice(F("Setup BME280 on adress: %X" CR), BME280_i2c_addr);
//***Operation settings*****************************//
// runMode Setting - Values:
@@ -101,7 +108,13 @@ void setupZsensorBME280() {
mySensor.settings.humidOverSample = 1;
delay(10); // Gives the Sensor enough time to turn on (The BME280 requires 2ms to start up)
Log.notice(F("Bosch BME280 Initialized - Result of .begin(): 0x %h" CR), mySensor.begin());
int ret = mySensor.begin();
if (ret == 0x60) {
Log.notice(F("Bosch BME280 successfully initialized: %X" CR), ret);
} else {
Log.notice(F("Bosch BME280 failed: %X" CR), ret);
}
}
void MeasureTempHumAndPressure() {
+4
View File
@@ -58,4 +58,8 @@ extern void BME280toMQTT();
unsigned long timebme280 = 0;
int BME280_i2c_addr = 0x76; // Bosch BME280 I2C Address
// Only supported for ESP
int BME280_PIN_SDA = 21; // PIN SDA
int BME280_PIN_SCL = 22; // PIN SCL
#endif