diff --git a/platformio.ini b/platformio.ini index dcb8698..205ea9e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,7 +12,7 @@ platform = espressif8266 board = d1_mini framework = arduino -build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY -D BMP280 +build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY -DBMP280 ; build_flag needs define the Bosch sensor... ; -D BMP280 ;or diff --git a/src/main.cpp b/src/main.cpp index c6ce8aa..c0bad67 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -224,8 +224,17 @@ void onHomieEvent(const HomieEvent &event) case HomieEventType::MQTT_READY: mConnected=true; if (mFailedI2Cinitialization) { - log(MQTT_LEVEL_DEBUG, F("Could not find a valid BME680 sensor, check wiring or " - "try a different address!"), MQTT_LOG_I2CINIT); + log(MQTT_LEVEL_DEBUG, +#ifdef BME680 + "Could not find a valid BME680 sensor, check wiring or try a different address!" +#else +#ifdef BMP280 + "Could not find a valid BMP280 sensor, check wiring or try a different address!" +#else + "no I2C sensor defined" +#endif +#endif + , MQTT_LOG_I2CINIT); } else { log(MQTT_LEVEL_INFO, F("BME680 sensor found"), MQTT_LOG_I2CINIT); }