Skip to content

Commit

Permalink
Teknopoint: Disable string output for Econo, Turbo, Health, & Light
Browse files Browse the repository at this point in the history
* When we detect the correct model, disable these settings as they don't appear to be functional on these devices. Per user request.
* Update unit tests.
* Add minimum (night) fan speed) to string output.

For #1486
  • Loading branch information
crankyoldgit committed Sep 12, 2021
1 parent 450ab07 commit 61d459a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 36 deletions.
15 changes: 9 additions & 6 deletions src/ir_Tcl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ stdAc::state_t IRTcl112Ac::toCommon(const stdAc::state_t *prev) const {
String IRTcl112Ac::toString(void) const {
String result = "";
result.reserve(220); // Reserve some heap for the string to reduce fragging.
result += addModelToString(decode_type_t::TCL112AC, getModel(), false);
tcl_ac_remote_model_t model = getModel();
result += addModelToString(decode_type_t::TCL112AC, model, false);
result += addIntToString(_.MsgType, D_STR_TYPE);
switch (_.MsgType) {
case kTcl112AcNormal:
Expand All @@ -486,11 +487,8 @@ String IRTcl112Ac::toString(void) const {
kTcl112AcHeat, kTcl112AcDry, kTcl112AcFan);
result += addTempFloatToString(getTemp());
result += addFanToString(_.Fan, kTcl112AcFanHigh, kTcl112AcFanLow,
kTcl112AcFanAuto, kTcl112AcFanAuto,
kTcl112AcFanAuto, kTcl112AcFanMin,
kTcl112AcFanMed);
result += addBoolToString(_.Econo, kEconoStr);
result += addBoolToString(_.Health, kHealthStr);
result += addBoolToString(_.Turbo, kTurboStr);
result += addBoolToString(_.SwingH, kSwingHStr);
result += addSwingVToString(_.SwingV, kTcl112AcSwingVOff,
kTcl112AcSwingVHighest,
Expand All @@ -503,7 +501,12 @@ String IRTcl112Ac::toString(void) const {
kTcl112AcSwingVOff,
kTcl112AcSwingVOn, // Swing
0xFF, 0xFF); // Both Unused
result += addBoolToString(getLight(), kLightStr);
if (model != tcl_ac_remote_model_t::GZ055BE1) {
result += addBoolToString(_.Econo, kEconoStr);
result += addBoolToString(_.Health, kHealthStr);
result += addBoolToString(_.Turbo, kTurboStr);
result += addBoolToString(getLight(), kLightStr);
}
result += addLabeledString(
_.OnTimerEnabled ? minsToString(getOnTimer()) : kOffStr,
kOnTimerStr);
Expand Down
4 changes: 2 additions & 2 deletions test/IRac_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1642,8 +1642,8 @@ TEST(TestIRac, Tcl112) {
IRrecv capture(kGpioUnused);
char expected[] =
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 20C, "
"Fan: 3 (Medium), Econo: On, Health: On, Turbo: Off, "
"Swing(H): On, Swing(V): 0 (Auto), Light: On, "
"Fan: 3 (Medium), Swing(H): On, Swing(V): 0 (Auto), "
"Econo: On, Health: On, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off";

ac.begin();
Expand Down
48 changes: 24 additions & 24 deletions test/ir_Tcl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ TEST(TestDecodeTcl112Ac, DecodeRealExample) {
EXPECT_STATE_EQ(expectedState, irsend.capture.state, irsend.capture.bits);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 24C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
IRAcUtils::resultAcToString(&irsend.capture));
}
Expand Down Expand Up @@ -118,29 +118,29 @@ TEST(TestTcl112AcClass, Temperature) {
ac.setRaw(temp16C);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 16C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());
ac.setRaw(temp16point5C);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 16.5C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());
ac.setRaw(temp19point5C);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 19.5C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());
ac.setRaw(temp31C);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 31C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());

Expand Down Expand Up @@ -222,8 +222,8 @@ TEST(TestTcl112AcClass, OperatingMode) {
ac.setRaw(automode);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 8 (Auto), Temp: 24C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());
}
Expand Down Expand Up @@ -253,8 +253,8 @@ TEST(TestTcl112AcClass, Power) {
ac.setRaw(on);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 16C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());

Expand All @@ -264,8 +264,8 @@ TEST(TestTcl112AcClass, Power) {
ac.setRaw(off);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: Off, Mode: 3 (Cool), Temp: 24C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());
}
Expand All @@ -282,15 +282,15 @@ TEST(TestTcl112AcClass, Checksum) {
ac.setRaw(temp16C);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 16C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());
ac.setRaw(temp31C);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 31C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());
EXPECT_EQ(0xBC, ac.calcChecksum(temp31C));
Expand Down Expand Up @@ -517,8 +517,8 @@ TEST(TestDecodeTcl112Ac, Issue744) {
ac.setRaw(irsend.capture.state);
EXPECT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 23C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: On, "
"On Timer: Off, Off Timer: Off",
ac.toString());
}
Expand Down Expand Up @@ -600,8 +600,8 @@ TEST(TestTcl112AcClass, SendingQuiet) {
EXPECT_EQ(kTcl112AcBits, ac._irsend.capture.bits);
ASSERT_EQ(
"Model: 1 (TAC09CHSD), Type: 1, Power: On, Mode: 3 (Cool), Temp: 24C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 0 (Auto), Light: Off, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 0 (Auto), "
"Econo: Off, Health: Off, Turbo: Off, Light: Off, "
"On Timer: Off, Off Timer: Off",
IRAcUtils::resultAcToString(&ac._irsend.capture));
}
Expand Down
6 changes: 2 additions & 4 deletions test/ir_Teknopoint_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ TEST(TestDecodeTeknopoint, RealExample) {
EXPECT_STATE_EQ(expectedState, irsend.capture.state, irsend.capture.bits);
EXPECT_EQ(
"Model: 2 (GZ055BE1), Type: 1, Power: On, Mode: 3 (Cool), Temp: 16C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 1 (Highest), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 1 (Highest), "
"On Timer: Off, Off Timer: Off",
IRAcUtils::resultAcToString(&irsend.capture));
}
Expand All @@ -71,8 +70,7 @@ TEST(TestDecodeTeknopoint, SyntheticExample) {
EXPECT_STATE_EQ(expectedState, irsend.capture.state, irsend.capture.bits);
EXPECT_EQ(
"Model: 2 (GZ055BE1), Type: 1, Power: On, Mode: 3 (Cool), Temp: 16C, "
"Fan: 0 (Auto), Econo: Off, Health: Off, Turbo: Off, "
"Swing(H): Off, Swing(V): 1 (Highest), Light: On, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 1 (Highest), "
"On Timer: Off, Off Timer: Off",
IRAcUtils::resultAcToString(&irsend.capture));

Expand Down

0 comments on commit 61d459a

Please sign in to comment.