Merge pull request #4986 from Staars/development

make tsl2561 compatible with SHT3x
This commit is contained in:
Theo Arends 2019-01-20 14:46:56 +01:00 committed by GitHub
commit a0559080b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -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; }
}
}
}