diff --git a/esphome/components/mcp3221/mcp3221_sensor.cpp b/esphome/components/mcp3221/mcp3221_sensor.cpp index 2164bc32ad..674be499c3 100644 --- a/esphome/components/mcp3221/mcp3221_sensor.cpp +++ b/esphome/components/mcp3221/mcp3221_sensor.cpp @@ -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; diff --git a/esphome/components/mcp3221/sensor.py b/esphome/components/mcp3221/sensor.py index a06a0676bc..c32698fdd3 100644 --- a/esphome/components/mcp3221/sensor.py +++ b/esphome/components/mcp3221/sensor.py @@ -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_(