mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
fix value calculation
This commit is contained in:
parent
f12c304d93
commit
32ce8e9bc4
2 changed files with 1 additions and 3 deletions
|
@ -26,7 +26,7 @@ float MCP3221Sensor::sample() {
|
|||
return NAN;
|
||||
}
|
||||
|
||||
uint16_t value = (data[0] << 8) | data[1];
|
||||
uint16_t value = encode_uint16(data[0], data[1]);
|
||||
float voltage = value * this->reference_voltage_ / 4096.0f;
|
||||
|
||||
return voltage;
|
||||
|
|
|
@ -12,8 +12,6 @@ from esphome.const import (
|
|||
AUTO_LOAD = ["voltage_sampler"]
|
||||
DEPENDENCIES = ["i2c"]
|
||||
|
||||
# CONF_CONTINUOUS_MODE = "continuous_mode"
|
||||
|
||||
|
||||
mcp3221_ns = cg.esphome_ns.namespace("mcp3221")
|
||||
MCP3221Sensor = mcp3221_ns.class_(
|
||||
|
|
Loading…
Reference in a new issue