Skip to content

Commit

Permalink
IRac: Change Coolix to send special messages after a normal message. (#…
Browse files Browse the repository at this point in the history
…1502)

Sending a special message after a normal message ensures the unit is on.
Reports are that if a state with special setting (e.g. Turbo) and turning the unit on, the special message is ignored because the unit must be powered on before it will accept it.
So, change the order, send the normal state first, then the special message/settings, except for "Off" of course.

Fixes #1501
  • Loading branch information
crankyoldgit authored Jun 23, 2021
1 parent b86aa36 commit 609abce
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 24 deletions.
8 changes: 7 additions & 1 deletion src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,13 @@ void IRac::coolix(IRCoolixAC *ac,
// No Clock setting available.
// No Econo setting available.
// No Quiet setting available.
ac->send(); // Send the state, which will also power on the unit.
// The following are all options/settings that create their own special
// messages. Often they only make sense to be sent after the unit is turned
// on. For instance, assuming a person wants to have the a/c on and in turbo
// mode. If we send the turbo message, it is ignored if the unit is off.
// Hence we send the special mode/setting messages after a normal message
// which will turn on the device.
if (swingv != stdAc::swingv_t::kOff || swingh != stdAc::swingh_t::kOff) {
// Swing has a special command that needs to be sent independently.
ac->setSwing();
Expand All @@ -475,7 +482,6 @@ void IRac::coolix(IRCoolixAC *ac,
ac->setClean();
ac->send();
}
ac->send();
}
#endif // SEND_COOLIX

Expand Down
53 changes: 30 additions & 23 deletions test/IRac_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2148,37 +2148,28 @@ TEST(TestIRac, Issue821) {
result.mode, // Mode
result.degrees, // Celsius
result.fanspeed, // Fan speed
result.swingv, // Vertical swing
result.swingh, // Horizontal swing
result.turbo, // Turbo
result.light, // Light
result.clean, // Clean
-1); // Sleep
ac._irsend.makeDecodeResult();
result.swingv, // Vertical swing
result.swingh, // Horizontal swing
result.turbo, // Turbo
result.light, // Light
result.clean, // Clean
-1); // Sleep
ac._irsend.makeDecodeResult();
// We expect a normal state message, followed by the special "light" message.
EXPECT_TRUE(capture.decode(&ac._irsend.capture));
ASSERT_EQ(COOLIX, ac._irsend.capture.decode_type);
ASSERT_EQ(kCoolixBits, ac._irsend.capture.bits);
ASSERT_EQ("Power: On, Mode: 2 (Auto), Fan: 0 (Auto0), Temp: 24C, "
"Zone Follow: Off, Sensor Temp: Off",
IRAcUtils::resultAcToString(&ac._irsend.capture));
EXPECT_TRUE(capture.decodeCOOLIX(&ac._irsend.capture, 201));
ASSERT_EQ(COOLIX, ac._irsend.capture.decode_type);
ASSERT_EQ(kCoolixBits, ac._irsend.capture.bits);
ASSERT_EQ("Power: On, Light: Toggle",
IRAcUtils::resultAcToString(&ac._irsend.capture));
EXPECT_EQ(
"f38000d50"
"m4692s4416"
"m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s552m552s1656"
"m552s552m552s1656m552s552m552s552m552s1656m552s552m552s1656m552s552"
"m552s1656m552s1656m552s1656m552s1656m552s552m552s1656m552s552m552s1656"
"m552s552m552s552m552s552m552s552m552s1656m552s552m552s1656m552s552"
"m552s1656m552s552m552s1656m552s552m552s552m552s1656m552s552m552s1656"
"m552s552m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s552"
"m552s5244"
"m4692s4416"
"m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s552m552s1656"
"m552s552m552s1656m552s552m552s552m552s1656m552s552m552s1656m552s552"
"m552s1656m552s1656m552s1656m552s1656m552s552m552s1656m552s552m552s1656"
"m552s552m552s552m552s552m552s552m552s1656m552s552m552s1656m552s552"
"m552s1656m552s552m552s1656m552s552m552s552m552s1656m552s552m552s1656"
"m552s552m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s552"
"m552s105244"
"m4692s4416"
"m552s1656m552s552m552s1656m552s1656m552s552m552s552m552s1656m552s552"
"m552s552m552s1656m552s552m552s552m552s1656m552s1656m552s552m552s1656"
"m552s552m552s552m552s552m552s1656m552s1656m552s1656m552s1656m552s1656"
Expand All @@ -2193,6 +2184,22 @@ TEST(TestIRac, Issue821) {
"m552s1656m552s1656m552s1656m552s552m552s552m552s552m552s552m552s552"
"m552s552m552s1656m552s552m552s552m552s1656m552s552m552s552m552s552"
"m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s1656m552s1656"
"m552s105244"
"m4692s4416"
"m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s552m552s1656"
"m552s552m552s1656m552s552m552s552m552s1656m552s552m552s1656m552s552"
"m552s1656m552s1656m552s1656m552s1656m552s552m552s1656m552s552m552s1656"
"m552s552m552s552m552s552m552s552m552s1656m552s552m552s1656m552s552"
"m552s1656m552s552m552s1656m552s552m552s552m552s1656m552s552m552s1656"
"m552s552m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s552"
"m552s5244"
"m4692s4416"
"m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s552m552s1656"
"m552s552m552s1656m552s552m552s552m552s1656m552s552m552s1656m552s552"
"m552s1656m552s1656m552s1656m552s1656m552s552m552s1656m552s552m552s1656"
"m552s552m552s552m552s552m552s552m552s1656m552s552m552s1656m552s552"
"m552s1656m552s552m552s1656m552s552m552s552m552s1656m552s552m552s1656"
"m552s552m552s1656m552s552m552s1656m552s1656m552s552m552s1656m552s552"
"m552s105244",
ac._irsend.outputStr());
}
Expand Down

0 comments on commit 609abce

Please sign in to comment.