Merge pull request #3408 from andrethomas/development

Fix detection of LM75AD
This commit is contained in:
Theo Arends 2018-08-04 21:15:52 +02:00 committed by GitHub
commit fe5bec26b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -48,19 +48,20 @@ uint8_t lm75ad_addresses[] = { LM75AD_ADDRESS1, LM75AD_ADDRESS2, LM75AD_ADDRESS3
void LM75ADDetect()
{
uint8_t buffer;
if (lm75ad_type) { return; }
uint16_t buffer;
for (byte i = 0; i < sizeof(lm75ad_addresses); i++) {
lm75ad_address = lm75ad_addresses[i];
if (I2cValidRead8(&buffer, lm75ad_address, LM75_CONF_REGISTER)) {
if (I2cValidRead16(&buffer, lm75ad_address, LM75_THYST_REGISTER)) {
if (buffer == 0x4B00) {
lm75ad_type = 1;
snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "LM75AD", lm75ad_address);
AddLog(LOG_LEVEL_DEBUG);
break;
}
}
}
}
float LM75ADGetTemp() {