From 58c7fac140ccdee8a53acb06a7a017ea3ca2ab1e Mon Sep 17 00:00:00 2001 From: Kevin Baluha Date: Thu, 7 Feb 2019 03:40:44 -0700 Subject: [PATCH] check id reg --- sonoff/xsns_16_tsl2561.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sonoff/xsns_16_tsl2561.ino b/sonoff/xsns_16_tsl2561.ino index a31debac6..fecedd26e 100644 --- a/sonoff/xsns_16_tsl2561.ino +++ b/sonoff/xsns_16_tsl2561.ino @@ -64,11 +64,14 @@ bool Tsl2561Read(void) void Tsl2561Detect(void) { if (tsl2561_type) { return; } + uint8_t id; - if ((I2cDevice(0x29) || I2cDevice(0x39) || I2cDevice(0x49))&&Tsl.begin()) { + if (I2cDevice(0x29) || I2cDevice(0x39) || I2cDevice(0x49)) { + if (!Tsl.id(&id)) return; + Tsl.begin(); if (Tsl.on()) { tsl2561_type = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, tsl2561_types, Tsl.address()); + snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, tsl2561_types, Tsl.address(), id); AddLog(LOG_LEVEL_DEBUG); } }