From d61bd381ff75449f4626d4d45c1a8648a6d53e94 Mon Sep 17 00:00:00 2001 From: zdroyer Date: Thu, 10 Oct 2019 17:42:02 +0200 Subject: [PATCH] Fix for #513 : checking presence of Si7021 in case HTU21D is not detected. Added include for axTLS. Si7021 is compatible with HTU21D, but it returns 0x3A instead of 0x2 on I2C command 0xE7, thats why the .begin() function failed --- airrohr-firmware/airrohr-firmware.ino | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/airrohr-firmware/airrohr-firmware.ino b/airrohr-firmware/airrohr-firmware.ino index f805c5518..0ce37fe0d 100644 --- a/airrohr-firmware/airrohr-firmware.ino +++ b/airrohr-firmware/airrohr-firmware.ino @@ -105,7 +105,7 @@ * ************************************************************************/ // increment on change -#define SOFTWARE_VERSION_STR "NRZ-2019-124-B8" +#define SOFTWARE_VERSION_STR "NRZ-2019-124-B8.1" const String SOFTWARE_VERSION(SOFTWARE_VERSION_STR); /***************************************************************** @@ -128,6 +128,7 @@ const String SOFTWARE_VERSION(SOFTWARE_VERSION_STR); #if defined(ESP8266) #include // must be first +#include #include #include #include @@ -3935,8 +3936,17 @@ static void powerOnTestSensors() { if (cfg::htu21d_read) { debug_outln_info(F("Read HTU21D...")); if (!htu21d.begin()) { - debug_outln_error(F("Check HTU21D wiring")); - htu21d_init_failed = true; + debug_outln_info(F("Read Si7021 replacement for HTU21D ...")); + Wire.beginTransmission(HTU21DF_I2CADDR); + Wire.write(HTU21DF_READREG); + Wire.endTransmission(); + Wire.requestFrom(HTU21DF_I2CADDR, 1); + if( Wire.read() == 0x3A){ + debug_outln_error(F("Found Si7120 instead of HTU21D")); + } else { + debug_outln_error(F("Check HTU21D wiring")); + htu21d_init_failed = true; + } } }