Hide I2C address for single sensors

Hide I2C address for single sensors (#11323)
This commit is contained in:
Theo Arends 2021-03-17 17:51:12 +01:00
parent 2f7eefa8f4
commit e5a566f0bb
2 changed files with 8 additions and 2 deletions

View File

@ -99,7 +99,10 @@ void Sht3xShow(bool json)
float h;
if (Sht3xRead(t, h, sht3x_sensors[i].address)) {
char types[11];
snprintf_P(types, sizeof(types), PSTR("%s%c0x%02X"), sht3x_sensors[i].types, IndexSeparator(), sht3x_sensors[i].address); // "SHT3X-0xXX"
strlcpy(types, sht3x_sensors[i].types, sizeof(types));
if (sht3x_count > 1) {
snprintf_P(types, sizeof(types), PSTR("%s%c%02X"), sht3x_sensors[i].types, IndexSeparator(), sht3x_sensors[i].address); // "SHT3X-0xXX"
}
TempHumDewShow(json, ((0 == TasmotaGlobal.tele_period) && (0 == i)), types, t, h);
}
}

View File

@ -175,7 +175,10 @@ void AHT1XShow(bool json) {
float tem = ConvertTemp(aht1x_sensors[i].temperature);
float hum = ConvertHumidity(aht1x_sensors[i].humidity);
char types[11]; // AHT1X-0x38
snprintf_P(types, sizeof(types), PSTR("%s%c0x%02X"), aht1x_sensors[i].types, IndexSeparator(), aht1x_sensors[i].address); // "X-0xXX"
strlcpy(types, aht1x_sensors[i].types, sizeof(types));
if (aht1x.count > 1) {
snprintf_P(types, sizeof(types), PSTR("%s%c%02X"), aht1x_sensors[i].types, IndexSeparator(), aht1x_sensors[i].address); // "X-0xXX"
}
TempHumDewShow(json, ((0 == TasmotaGlobal.tele_period) && (0 == i)), types, tem, hum);
}
}