From 5e27d3ebf42ff70979c651cfd5c0205b3ca75d8f Mon Sep 17 00:00:00 2001 From: Ollo Date: Sun, 12 Dec 2021 15:28:24 +0100 Subject: [PATCH] specific message for each Bosch sensor --- platformio.ini | 2 +- src/main.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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); }