From 59cba62e203ce0bf230d4cc3eb5112144aa53c95 Mon Sep 17 00:00:00 2001 From: Michael Doppler <76885460+mdop@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:44:24 +0200 Subject: [PATCH] Revert "fix negative anwser interpretation" This reverts commit 7eac405ed84d0be3ddd668005947378cf143cbe3. --- esphome/components/mcp3428/mcp3428.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/esphome/components/mcp3428/mcp3428.cpp b/esphome/components/mcp3428/mcp3428.cpp index fe515b386f..57048da85e 100644 --- a/esphome/components/mcp3428/mcp3428.cpp +++ b/esphome/components/mcp3428/mcp3428.cpp @@ -102,12 +102,6 @@ float MCP3428Component::request_measurement(MCP3428Multiplexer multiplexer, MCP3 } // got valid measurement, clean up unused bits from the anwser code and prepare tick size - bool negative = false; - if (anwser[0] & 0b10000000 != 0) { - // negative number, clean up bit and mark as negative - negative = true; - anwser[0] &= 0b01111111; - } float tick_voltage = 2.048f / 32768; // ref voltage 2.048V/non-sign bits, default 15 bits switch (resolution) { case MCP3428Resolution::MCP3428_12_BITS: @@ -138,9 +132,6 @@ float MCP3428Component::request_measurement(MCP3428Multiplexer multiplexer, MCP3 } // convert code (first 2 bytes of cleaned up anwser) into voltage ticks int16_t ticks = anwser[0] << 8 | anwser[1]; - if (negative) { - ticks *= (-1); - } this->status_clear_warning(); return tick_voltage * ticks;