diff --git a/tasmota/xsns_48_chirp.ino b/tasmota/xsns_48_chirp.ino index a7a88846b..84fcd4f66 100644 --- a/tasmota/xsns_48_chirp.ino +++ b/tasmota/xsns_48_chirp.ino @@ -40,6 +40,8 @@ * !! The I2C-soil-moisture-sensor is the preferred one !! * * I2C Address: 0x20 - standard address, is changeable + * - Uses I2C clock stretching + * - Scans all I2C addresses \*********************************************************************************************/ #define XSNS_48 48 diff --git a/tasmota/xsns_55_hih_series.ino b/tasmota/xsns_55_hih_series.ino index 5ac484e91..0707e0ed7 100644 --- a/tasmota/xsns_55_hih_series.ino +++ b/tasmota/xsns_55_hih_series.ino @@ -74,7 +74,6 @@ 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 @@ -86,17 +85,10 @@ void Hih6Detect(void) void Hih6EverySecond(void) { - if ((100 - XSNS_55) == (uptime %100)) { - // 1mS - Hih6Detect(); - } - else if (uptime &1) { + if (uptime &1) { // HIH6130: 30mS - if (Hih6.type) { - if (!Hih6Read()) { - AddLogMissed(Hih6.types, Hih6.valid); -// if (!Hih6.valid) { Hih6.type = 0; } - } + if (!Hih6Read()) { + AddLogMissed(Hih6.types, Hih6.valid); } } } @@ -141,21 +133,23 @@ bool Xsns55(uint8_t function) bool result = false; - switch (function) { - case FUNC_EVERY_SECOND: - Hih6EverySecond(); - break; - case FUNC_JSON_APPEND: - Hih6Show(1); - break; -#ifdef USE_WEBSERVER - case FUNC_WEB_SENSOR: - Hih6Show(0); - break; -#endif // USE_WEBSERVER - case FUNC_INIT: - Hih6Detect(); - break; + if (FUNC_INIT == function) { + Hih6Detect(); + } + else if (Hih6.type) { + switch (function) { + case FUNC_EVERY_SECOND: + Hih6EverySecond(); + break; + case FUNC_JSON_APPEND: + Hih6Show(1); + break; + #ifdef USE_WEBSERVER + case FUNC_WEB_SENSOR: + Hih6Show(0); + break; + #endif // USE_WEBSERVER + } } return result; } diff --git a/tasmota/xsns_57_tsl2591.ino b/tasmota/xsns_57_tsl2591.ino index 4e2abb409..e3cedc26f 100644 --- a/tasmota/xsns_57_tsl2591.ino +++ b/tasmota/xsns_57_tsl2591.ino @@ -41,9 +41,8 @@ float tsl2591_lux = 0; void Tsl2591Init(void) { - if (tsl2591_type) { return; } - - if (I2cSetDevice(0x29) || I2cSetDevice(0x39) || I2cSetDevice(0x49)) { +// if (I2cSetDevice(0x29) || I2cSetDevice(0x39) || I2cSetDevice(0x49)) { + if (I2cSetDevice(0x29)) { if (tsl.begin()) { tsl.setGain(TSL2591_GAIN_MED); tsl.setTiming(TSL2591_INTEGRATIONTIME_300MS); @@ -65,9 +64,7 @@ bool Tsl2591Read(void) void Tsl2591EverySecond(void) { - if (tsl2591_type) { - Tsl2591Read(); - } + Tsl2591Read(); } #ifdef USE_WEBSERVER @@ -103,21 +100,23 @@ bool Xsns57(uint8_t function) bool result = false; - switch (function) { - case FUNC_EVERY_SECOND: - Tsl2591EverySecond(); - break; - case FUNC_JSON_APPEND: - Tsl2591Show(1); - break; + if (FUNC_INIT == function) { + Tsl2591Init(); + } + else if (tsl2591_type) { + switch (function) { + case FUNC_EVERY_SECOND: + Tsl2591EverySecond(); + break; + case FUNC_JSON_APPEND: + Tsl2591Show(1); + break; #ifdef USE_WEBSERVER - case FUNC_WEB_SENSOR: - Tsl2591Show(0); - break; + case FUNC_WEB_SENSOR: + Tsl2591Show(0); + break; #endif // USE_WEBSERVER - case FUNC_INIT: - Tsl2591Init(); - break; + } } return result; }