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

[BUG] Ensure IRCoolixAC::toCommon() returns kNoTempValue correctly. #2015

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/ir_Coolix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ stdAc::state_t IRCoolixAC::toCommon(const stdAc::state_t *prev) const {
result.mode = toCommonMode(getMode());
result.degrees = getTemp();
result.sensorTemperature = getSensorTemp();
if (result.sensorTemperature == kCoolixSensorTempIgnoreCode) {
result.sensorTemperature = kNoTempValue;
}
result.iFeel = getZoneFollow();
result.fanspeed = toCommonFanSpeed(getFan());
return result;
Expand Down
36 changes: 36 additions & 0 deletions test/ir_Coolix_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ TEST(TestCoolixACClass, SetGetClearSensorTempAndZoneFollow) {
EXPECT_EQ(
"Power: On, Mode: 3 (Heat), Fan: 6 (Zone Follow), Temp: 24C, "
"Zone Follow: On, Sensor Temp: 19C", ac.toString());
// For #Issue2012
EXPECT_EQ(19, ac.getSensorTemp());
EXPECT_EQ(19, ac.toCommon().sensorTemperature);
}

TEST(TestCoolixACClass, SpecialModesAndReset) {
Expand Down Expand Up @@ -1068,3 +1071,36 @@ TEST(TestDecodeCoolix48, SyntheticSelfDecode) {
"m552s5244",
irsend.outputStr());
}

// Test for issue https://github.com/crankyoldgit/IRremoteESP8266/issues/2012#issuecomment-1650098971
TEST(TestCoolixACClass, Issue2012) {
IRrecv irrecv(kGpioUnused);
IRCoolixAC ac(kGpioUnused);

ac.stateReset();
ac.setRaw(0xB21FD8);
EXPECT_EQ(
"Power: On, Mode: 2 (Auto), Fan: 0 (Auto0), Temp: 26C, "
"Zone Follow: Off, Sensor Temp: Off",
ac.toString());
EXPECT_EQ(kNoTempValue, ac.toCommon().sensorTemperature);

ac.setRaw(0xB21F98);
EXPECT_EQ(
"Power: On, Mode: 2 (Auto), Fan: 0 (Auto0), Temp: 27C, "
"Zone Follow: Off, Sensor Temp: Off",
ac.toString());
EXPECT_EQ(kNoTempValue, ac.toCommon().sensorTemperature);

ac.setRaw(0xB21F88);
EXPECT_EQ(
"Power: On, Mode: 2 (Auto), Fan: 0 (Auto0), Temp: 28C, "
"Zone Follow: Off, Sensor Temp: Off",
ac.toString());
EXPECT_EQ(kNoTempValue, ac.toCommon().sensorTemperature);
ac.setRaw(0xB27BE0);
EXPECT_EQ(
"Power: Off",
ac.toString());
EXPECT_EQ(kNoTempValue, ac.toCommon().sensorTemperature);
}
Loading