Skip to content

Commit

Permalink
Remove Light setting from Type 2 messages
Browse files Browse the repository at this point in the history
For #1528
  • Loading branch information
crankyoldgit committed Jul 10, 2021
1 parent 127befb commit e5c2523
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/ir_Tcl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,12 @@ void IRTcl112Ac::send(const uint16_t repeat) {
if (_quiet != _quiet_prev) {
// Backup the current state.
std::memcpy(save, _.raw, kTcl112AcStateLength);
bool light_save = getLight();
const uint8_t quiet_off[kTcl112AcStateLength] = {
0x23, 0xCB, 0x26, 0x02, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65};
// Use a known good quiet/mute off/type 2 state for the time being.
// Ref: https://github.com/crankyoldgit/IRremoteESP8266/issues/1528#issuecomment-876989044
setRaw(quiet_off);
// Copy in the light and quiet states.
setLight(light_save);
setQuiet(_quiet);
// Send it.
_irsend.sendTcl112Ac(getRaw(), kTcl112AcStateLength, repeat);
Expand Down Expand Up @@ -355,7 +352,6 @@ stdAc::state_t IRTcl112Ac::toCommon(const stdAc::state_t *prev) const {
if (prev != NULL) result = *prev;
result.protocol = decode_type_t::TCL112AC;
result.model = -1; // Not supported.
result.light = getLight();
result.quiet = getQuiet(result.quiet);
// The rest only get updated if it is a "normal" message.
if (_.MsgType == kTcl112AcNormal) {
Expand All @@ -369,6 +365,7 @@ stdAc::state_t IRTcl112Ac::toCommon(const stdAc::state_t *prev) const {
result.turbo = _.Turbo;
result.filter = _.Health;
result.econo = _.Econo;
result.light = getLight();
}
// Not supported.
result.clean = false;
Expand Down Expand Up @@ -398,12 +395,12 @@ String IRTcl112Ac::toString(void) const {
result += addBoolToString(_.Turbo, kTurboStr);
result += addBoolToString(_.SwingH, kSwingHStr);
result += addBoolToString(_.SwingV, kSwingVStr);
result += addBoolToString(getLight(), kLightStr);
break;
case kTcl112AcSpecial:
result += addBoolToString(_.Quiet, kQuietStr);
break;
}
result += addBoolToString(getLight(), kLightStr);
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion test/IRac_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ TEST(TestIRac, Tcl112) {
ASSERT_EQ(TCL112AC, ac._irsend.capture.decode_type);
ASSERT_EQ(kTcl112AcBits, ac._irsend.capture.bits);
ASSERT_EQ(
"Type: 2, Quiet: On, Light: On",
"Type: 2, Quiet: On",
IRAcUtils::resultAcToString(&ac._irsend.capture));
// TCL112 uses the Mitsubishi112 decoder.
// Skip first message.
Expand Down
2 changes: 1 addition & 1 deletion test/ir_Tcl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,6 @@ TEST(TestDecodeTcl112Ac, Issue1528) {
EXPECT_EQ(kTcl112AcBits, irsend.capture.bits);
EXPECT_STATE_EQ(expectedState, irsend.capture.state, irsend.capture.bits);
EXPECT_EQ(
"Type: 2, Quiet: On, Light: Off",
"Type: 2, Quiet: On",
IRAcUtils::resultAcToString(&irsend.capture));
}

0 comments on commit e5c2523

Please sign in to comment.