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

Daikin: Support setting temperature in 0.5 C unit #2036

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

k-takata
Copy link
Contributor

Daikin 280-bit A/C protocol can set the temperature in 0.5 C unit. However, IRDaikinESP didn't support it.
This PR allows to set and get the temperature in 0.5 C unit.

It looks like some other Daikin protocols also support setting the temperature in 0.5 C unit:

  • Daikin2
  • Daikin216
  • Daikin160
  • Daikin176
  • Daikin152

However, they are not implemented in this PR, because I cannot test them.

Daikin 280-bit A/C protocol can set the temperature in 0.5 C unit.
However, IRDaikinESP didn't support it.
This PR allows to set and get the temperature in 0.5 C unit.

It looks like some other Daikin protocols also support setting the
temperature in 0.5 C unit:
* Daikin2
* Daikin216
* Daikin160
* Daikin176
* Daikin152

However, they are not implemented in this PR, because I cannot test them.
src/ir_Daikin.h Outdated
@@ -99,8 +99,7 @@ union DaikinESPProtocol{
uint64_t Mode :3;
uint64_t :1;
// Byte 22
uint64_t :1;
uint64_t Temp :7; // Temp should be between 10 - 32
uint64_t Temp2 :8; // Temp2 should be between 20 - 64 (10 C - 32 C)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep it as Temp, not Temp2

void IRDaikinESP::setTemp(const float temp) {
float degrees = std::max(temp, static_cast<float>(kDaikinMinTemp));
degrees = std::min(degrees, static_cast<float>(kDaikinMaxTemp));
_.Temp2 = degrees * 2.0f;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temp, not Temp2 please

}

/// Get the current temperature setting.
/// @return The current setting for temp. in degrees celsius.
uint8_t IRDaikinESP::getTemp(void) const { return _.Temp; }
float IRDaikinESP::getTemp(void) const { return _.Temp2 / 2.0f; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temp, not Temp2 please

@@ -563,7 +564,7 @@ String IRDaikinESP::toString(void) const {
result += addBoolToString(_.Power, kPowerStr, false);
result += addModeToString(_.Mode, kDaikinAuto, kDaikinCool, kDaikinHeat,
kDaikinDry, kDaikinFan);
result += addTempToString(_.Temp);
result += addTempFloatToString(_.Temp2 / 2.0f);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use:

  result += addTempFloatToString(getTemp());

* Use `Temp`, not `Temp2`.
* Use `getTemp()`.
@k-takata
Copy link
Contributor Author

Thank you for the review. Updated as suggested.

Copy link
Owner

@crankyoldgit crankyoldgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good to me.

@crankyoldgit crankyoldgit merged commit f67948f into crankyoldgit:master Dec 11, 2023
42 checks passed
@crankyoldgit crankyoldgit self-assigned this Dec 11, 2023
@k-takata k-takata deleted the daikin-support-0.5C branch December 11, 2023 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants