From 4b884679e6bebedfda82a64902aeca5e0765f6e2 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 7 Nov 2019 14:28:35 +0100 Subject: [PATCH] Fix Valid data reading Fix Valid data reading (#6808) --- tasmota/xsns_55_hih_series.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasmota/xsns_55_hih_series.ino b/tasmota/xsns_55_hih_series.ino index 39990c259..298bb54d2 100644 --- a/tasmota/xsns_55_hih_series.ino +++ b/tasmota/xsns_55_hih_series.ino @@ -46,10 +46,9 @@ struct HIH6 { bool Hih6Read(void) { Wire.beginTransmission(HIH6_ADDR); -// Wire.write(0x00); // Select data register if (Wire.endTransmission() != 0) { return false; } // In case of error -// delay(40); // Wait for Valid data or use Stale data + delay(40); // Wait for Valid data (Stale data doesn't work. See #6808) uint8_t data[4]; Wire.requestFrom(HIH6_ADDR, 4); @@ -76,10 +75,12 @@ bool Hih6Read(void) void Hih6Detect(void) { if (Hih6.type) { return; } + if (I2cActive(HIH6_ADDR)) { return; } if (uptime < 2) { delay(20); } // Skip entering power on comand mode Hih6.type = Hih6Read(); if (Hih6.type) { + I2cSetActive(HIH6_ADDR); AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, Hih6.types, HIH6_ADDR); } }