Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #513 : checking presence of Si7021 in case HTU21D is not dete… #514

Merged
merged 2 commits into from
Oct 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions airrohr-firmware/Versions.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
NRZ-2019-124-B9
* Fix for #513 : checking if Si7021 is present in case HTU21D is not detected

NRZ-2019-124-B8
* bug fixes
* translation updates
Expand Down
16 changes: 13 additions & 3 deletions airrohr-firmware/airrohr-firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
*
************************************************************************/
// increment on change
#define SOFTWARE_VERSION_STR "NRZ-2019-124-B8"
#define SOFTWARE_VERSION_STR "NRZ-2019-124-B9"
const String SOFTWARE_VERSION(SOFTWARE_VERSION_STR);

/*****************************************************************
Expand All @@ -128,6 +128,7 @@ const String SOFTWARE_VERSION(SOFTWARE_VERSION_STR);

#if defined(ESP8266)
#include <FS.h> // must be first
#include <WiFiClientSecureAxTLS.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
Expand Down Expand Up @@ -3935,8 +3936,17 @@ static void powerOnTestSensors() {
if (cfg::htu21d_read) {
debug_outln_info(F("Read HTU21D..."));
if (!htu21d.begin()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to workaround this for now is

if(!... && htu21d.readHumidity() < 1.0f)

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);
Copy link
Collaborator

@dirkmueller dirkmueller Oct 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this seems to be a ugly workaround for
https://github.com/adafruit/Adafruit_HTU21DF_Library/blob/master/Adafruit_HTU21DF.cpp#L49

wouldn't it be better to submit this as a PR to that library? then this code needs no modification and more users of that library also the ability to benefit from your bug fix.

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;
}
}
}

Expand Down