Removed 2 unneeded values from HA reporting, fixed mV reporting value

This commit is contained in:
2026-05-26 16:03:25 +02:00
parent 91f3f69bd9
commit e5104fc005
2 changed files with 13 additions and 16 deletions
+13
View File
@@ -277,6 +277,19 @@ class Meter {
float calc_display_value_() const {
if (this->overload) return NAN;
if (this->is_plus) {
uint16_t pair1 = static_cast<uint16_t>(this->raw_[0]) | (static_cast<uint16_t>(this->raw_[1]) << 8);
uint8_t decimal = pair1 & 0x07;
if (decimal >= 7) return NAN;
uint16_t pair3 = static_cast<uint16_t>(this->raw_[4]) | (static_cast<uint16_t>(this->raw_[5]) << 8);
bool negative = pair3 >= 0x7FFF;
uint16_t digits = negative ? (pair3 & 0x7FFF) : pair3;
float v = static_cast<float>(digits) / std::pow(10.0f, decimal);
return negative ? -v : v;
}
uint8_t decimal = 0;
switch (this->value_[REGPOINT] & 0x07) {
case 0b001: decimal = 1; break;