mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
fix tmp102 negative calculation (#6320)
This commit is contained in:
parent
1aab87b41c
commit
63cce916e2
1 changed files with 0 additions and 3 deletions
|
@ -39,9 +39,6 @@ void TMP102Component::update() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
raw_temperature = i2c::i2ctohs(raw_temperature);
|
raw_temperature = i2c::i2ctohs(raw_temperature);
|
||||||
if (raw_temperature & 0x8000) {
|
|
||||||
raw_temperature |= 0xF000;
|
|
||||||
}
|
|
||||||
raw_temperature = raw_temperature >> 4;
|
raw_temperature = raw_temperature >> 4;
|
||||||
float temperature = raw_temperature * TMP102_CONVERSION_FACTOR;
|
float temperature = raw_temperature * TMP102_CONVERSION_FACTOR;
|
||||||
ESP_LOGD(TAG, "Got Temperature=%.1f°C", temperature);
|
ESP_LOGD(TAG, "Got Temperature=%.1f°C", temperature);
|
||||||
|
|
Loading…
Reference in a new issue