Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Min and Max Temperature coding error #170

Open
Nateonas opened this issue May 5, 2024 · 0 comments
Open

Min and Max Temperature coding error #170

Nateonas opened this issue May 5, 2024 · 0 comments

Comments

@Nateonas
Copy link
Contributor

Nateonas commented May 5, 2024

Today I set my Mishubishi Heavy Heatpump to cooling at 17C. In stead of cooling it started heating to 30C. What happened!?

I did a code-review on MitsubishiHeavyHeatpumpIR.cpp and found:

uint8_t temperature = 23;
...
if ( temperatureCmd > 17 && temperatureCmd < 31)
{
temperature = (~((temperatureCmd - 17) << 4)) & 0xF0;
}

I believe this is incorrect: temperature is binary operated, but ONLY if it meets the conditions >17 and <31. Otherwise it just remains 23 (B00010111 in stead of B01100000)! Later on, when operating byte 9, the (unadjusted) temperature is controlling operatingMode and powerMode:
...
MitsubishiHeavyZJTemplate[9] |= operatingMode | powerMode | temperature;
...

This should be corrected, for example:

uint8_t temperature = ( ~ ((23 - 17) << 4)) & 0xF0; // default for 23C = B01100000
...
// temperature must be between 18 and 30 degrees
if ( temperatureCmd < 18)
{
temperatureCmd = 18;
}
if (temperatureCmd > 30)
{
temperatureCmd = 30;
}
temperature = (~((temperatureCmd - 17) << 4)) & 0xF0;

I see this error not only with Mitsubishi heavy and also in other xxx-heatpumpIR sources! I currently don't have a development environment set up, so I log the error here for reference. The workaround is to prevent sending temperature-commands below 18C or over 30C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant