From 99bb6977bf9dad2b43c8455dfc65ffc36f03d979 Mon Sep 17 00:00:00 2001 From: Staars Date: Fri, 18 Jan 2019 22:10:22 +0100 Subject: [PATCH] make tsl2561 compatible with SHT3x --- sonoff/xsns_16_tsl2561.ino | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sonoff/xsns_16_tsl2561.ino b/sonoff/xsns_16_tsl2561.ino index 063adfb87..07c95941e 100644 --- a/sonoff/xsns_16_tsl2561.ino +++ b/sonoff/xsns_16_tsl2561.ino @@ -48,7 +48,6 @@ bool Tsl2561Read(void) uint16_t scaledFull, scaledIr; uint32_t full, ir; - if (Tsl.available()) { if (Tsl.on()) { if (Tsl.id(id) && Tsl2561Util::autoGain(Tsl, gain, exposure, scaledFull, scaledIr) @@ -58,7 +57,6 @@ bool Tsl2561Read(void) tsl2561_milliLux = 0; } } - } tsl2561_valid = SENSOR_MAX_MISS; return true; } @@ -67,9 +65,9 @@ void Tsl2561Detect(void) { if (tsl2561_type) { return; } - if (!Tsl.available()) { + if (I2cDevice(0x29) || I2cDevice(0x39) || I2cDevice(0x49)) { Tsl.begin(); - if (Tsl.available()) { + if (Tsl.on()) { tsl2561_type = 1; snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, tsl2561_types, Tsl.address()); AddLog(LOG_LEVEL_DEBUG); @@ -88,7 +86,7 @@ void Tsl2561EverySecond(void) if (tsl2561_type) { if (!Tsl2561Read()) { AddLogMissed(tsl2561_types, tsl2561_valid); -// if (!tsl2561_valid) { tsl2561_type = 0; } + if (!tsl2561_valid) { tsl2561_type = 0; } } } }