diff --git a/examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp b/examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp index 682fdee38810c3..b14e525260cbfb 100644 --- a/examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp @@ -316,11 +316,11 @@ uint16_t WaterHeaterManagementDelegate::GetActiveTargetWaterTemperature() const uint8_t WaterHeaterManagementDelegate::CalculateTankPercentage() const { - int16_t tankPercentage = 100 * (static_cast(mWaterTemperature) - static_cast(mColdWaterTemperature)) / - (static_cast(GetActiveTargetWaterTemperature()) - static_cast(mColdWaterTemperature)); + int32_t tankPercentage = 100 * (static_cast(mWaterTemperature) - static_cast(mColdWaterTemperature)) / + (static_cast(GetActiveTargetWaterTemperature()) - static_cast(mColdWaterTemperature)); - tankPercentage = std::min(tankPercentage, static_cast(100)); - tankPercentage = std::max(tankPercentage, static_cast(0)); + tankPercentage = std::min(tankPercentage, static_cast(100)); + tankPercentage = std::max(tankPercentage, static_cast(0)); return static_cast(tankPercentage); } @@ -356,7 +356,7 @@ void WaterHeaterManagementDelegate::DrawOffHotWater(Percent percentageReplaced, { // First calculate the new average water temperature mWaterTemperature = - (mWaterTemperature * static_cast(100 - percentageReplaced) + replacedWaterTemperature * percentageReplaced) / 100; + static_cast(mWaterTemperature * (100 - percentageReplaced) + replacedWaterTemperature * percentageReplaced) / 100; // Replaces percentageReplaced% of the water in the tank with water of a temperature replacedWaterTemperature // Only supported if the kTankPercent feature is supported. diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index 3cafc7727f7271..784667d0696083 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -32,7 +32,6 @@ import time import chip.clusters as Clusters -from chip.clusters.Types import NullValue from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts from TC_EWATERHTRBase import EWATERHTRBase