From f8be7182b90ae1b3fc15e3db5b089863201cd2bf Mon Sep 17 00:00:00 2001 From: ElVit Date: Tue, 4 Feb 2025 16:14:15 +0100 Subject: [PATCH] Removed unused function getLeft5bits --- components/panasonic_heatpump/decode.cpp | 12 ++---------- components/panasonic_heatpump/decode.h | 5 ++--- components/panasonic_heatpump/panasonic_heatpump.cpp | 4 ++-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/components/panasonic_heatpump/decode.cpp b/components/panasonic_heatpump/decode.cpp index 0efff0d..0926dcc 100644 --- a/components/panasonic_heatpump/decode.cpp +++ b/components/panasonic_heatpump/decode.cpp @@ -113,12 +113,7 @@ namespace esphome return ((input >> 3) & 0b111) - 1; } - int PanasonicDecode::getLeft5bits(uint8_t input) - { - return (input >> 3) - 1; - } - - int PanasonicDecode::getRight3bits(uint8_t input) + int PanasonicDecode::getRight3Bits(uint8_t input) { return (input & 0b111) - 1; } @@ -133,7 +128,6 @@ namespace esphome return (int)input - 128; } - // TOP127, TOP128 // float PanasonicDecode::getIntMinus1Div2(uint8_t input) { return ((float)input - 1) / 2; @@ -159,7 +153,6 @@ namespace esphome return ((int)input - 1) * 50; } - // TOP15, TOP16, TOP38, TOP39, TOP40, TOP41 // int PanasonicDecode::getIntMinus1Times200(uint8_t input) { return ((int)input - 1) * 200; @@ -182,8 +175,7 @@ namespace esphome int PanasonicDecode::getUintt16(uint8_t input1, uint8_t input2) { - uint16_t value = static_cast((input2 << 8) | input1); - return (value - 1); + return (static_cast((input2 << 8) | input1)) - 1; } // TOP4 // diff --git a/components/panasonic_heatpump/decode.h b/components/panasonic_heatpump/decode.h index 446a8da..0d52e7f 100644 --- a/components/panasonic_heatpump/decode.h +++ b/components/panasonic_heatpump/decode.h @@ -22,8 +22,7 @@ namespace esphome static int getBit5and6(uint8_t input); static int getBit7and8(uint8_t input); static int getBit3and4and5(uint8_t input); - static int getLeft5bits(uint8_t input); - static int getRight3bits(uint8_t input); + static int getRight3Bits(uint8_t input); static int getIntMinus1(uint8_t input); static int getIntMinus128(uint8_t input); static float getIntMinus1Div2(uint8_t input); @@ -61,7 +60,7 @@ namespace esphome static const constexpr char* const ZonesSensorType[] = { "4", "Water Temperature", "External Thermostat", "Internal Thermostat", "Thermistor" }; static const constexpr char* const Quietmode[] = { "4", "Off", "Level 1", "Level 2", "Level 3" }; static const constexpr char* const Powerfulmode[] = { "4", "Off", "30min", "60min", "90min" }; - static const constexpr char* const OpModeDesc[] = { "9", "Heat only", "Cool only", "Auto", "Auto(heat)", "Auto(cool)", "DHW only", "Heat+DHW", "Cool+DHW", "Auto+DHW", "Auto(heat)+DHW", "Auto(cool)+DHW" }; + static const constexpr char* const OpModeDesc[] = { "11", "Heat only", "Cool only", "Auto", "Auto(heat)", "Auto(cool)", "DHW only", "Heat+DHW", "Cool+DHW", "Auto+DHW", "Auto(heat)+DHW", "Auto(cool)+DHW" }; static const constexpr char* const ZonesState[] = { "3", "Zone 1", "Zone 2", "Zone 1 & 2" }; static const constexpr char* const ExtPadHeaterType[] = { "3", "Disabled", "Type-A", "Type-B" }; static const constexpr char* const Bivalent[] = { "3", "Alternative", "Parallel", "Advanced Parallel" }; diff --git a/components/panasonic_heatpump/panasonic_heatpump.cpp b/components/panasonic_heatpump/panasonic_heatpump.cpp index 91b2cc1..92e7d6c 100644 --- a/components/panasonic_heatpump/panasonic_heatpump.cpp +++ b/components/panasonic_heatpump/panasonic_heatpump.cpp @@ -493,7 +493,7 @@ namespace esphome #endif #ifdef USE_TEXT_SENSOR if (this->top4_text_sensor_) this->top4_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::OpModeDesc, PanasonicDecode::getOpMode(bytes[6]))); - if (this->top17_text_sensor_) this->top17_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Powerfulmode, PanasonicDecode::getRight3bits(bytes[7]))); + if (this->top17_text_sensor_) this->top17_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Powerfulmode, PanasonicDecode::getRight3Bits(bytes[7]))); if (this->top18_text_sensor_) this->top18_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Quietmode, PanasonicDecode::getBit3and4and5(bytes[7]))); if (this->top19_text_sensor_) this->top19_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::HolidayState, PanasonicDecode::getBit3and4(bytes[5]))); if (this->top20_text_sensor_) this->top20_text_sensor_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Valve, PanasonicDecode::getBit7and8(bytes[111]))); @@ -551,7 +551,7 @@ namespace esphome #endif #ifdef USE_SELECT if (this->set9_select_) this->set9_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::OpModeDesc, PanasonicDecode::getOpMode(bytes[6]))); - if (this->set4_select_) this->set4_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Powerfulmode, PanasonicDecode::getRight3bits(bytes[7]))); + if (this->set4_select_) this->set4_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Powerfulmode, PanasonicDecode::getRight3Bits(bytes[7]))); if (this->set3_select_) this->set3_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::Quietmode, PanasonicDecode::getBit3and4and5(bytes[7]))); if (this->set2_select_) this->set2_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::HolidayState, PanasonicDecode::getBit3and4(bytes[5]))); if (this->set17_select_) this->set17_select_->publish_state(PanasonicDecode::getTextState(PanasonicDecode::ZonesState, PanasonicDecode::getBit1and2(bytes[6])));