mirror of https://github.com/arendst/Tasmota.git
make tsl2561 compatible with SHT3x
This commit is contained in:
parent
b5824fc361
commit
99bb6977bf
|
@ -48,7 +48,6 @@ bool Tsl2561Read(void)
|
||||||
uint16_t scaledFull, scaledIr;
|
uint16_t scaledFull, scaledIr;
|
||||||
uint32_t full, ir;
|
uint32_t full, ir;
|
||||||
|
|
||||||
if (Tsl.available()) {
|
|
||||||
if (Tsl.on()) {
|
if (Tsl.on()) {
|
||||||
if (Tsl.id(id)
|
if (Tsl.id(id)
|
||||||
&& Tsl2561Util::autoGain(Tsl, gain, exposure, scaledFull, scaledIr)
|
&& Tsl2561Util::autoGain(Tsl, gain, exposure, scaledFull, scaledIr)
|
||||||
|
@ -58,7 +57,6 @@ bool Tsl2561Read(void)
|
||||||
tsl2561_milliLux = 0;
|
tsl2561_milliLux = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
tsl2561_valid = SENSOR_MAX_MISS;
|
tsl2561_valid = SENSOR_MAX_MISS;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -67,9 +65,9 @@ void Tsl2561Detect(void)
|
||||||
{
|
{
|
||||||
if (tsl2561_type) { return; }
|
if (tsl2561_type) { return; }
|
||||||
|
|
||||||
if (!Tsl.available()) {
|
if (I2cDevice(0x29) || I2cDevice(0x39) || I2cDevice(0x49)) {
|
||||||
Tsl.begin();
|
Tsl.begin();
|
||||||
if (Tsl.available()) {
|
if (Tsl.on()) {
|
||||||
tsl2561_type = 1;
|
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());
|
||||||
AddLog(LOG_LEVEL_DEBUG);
|
AddLog(LOG_LEVEL_DEBUG);
|
||||||
|
@ -88,7 +86,7 @@ void Tsl2561EverySecond(void)
|
||||||
if (tsl2561_type) {
|
if (tsl2561_type) {
|
||||||
if (!Tsl2561Read()) {
|
if (!Tsl2561Read()) {
|
||||||
AddLogMissed(tsl2561_types, tsl2561_valid);
|
AddLogMissed(tsl2561_types, tsl2561_valid);
|
||||||
// if (!tsl2561_valid) { tsl2561_type = 0; }
|
if (!tsl2561_valid) { tsl2561_type = 0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue