From 61d459a40b6a51858d34ee064a81cb86c1769916 Mon Sep 17 00:00:00 2001 From: crankyoldgit Date: Sun, 12 Sep 2021 13:47:03 +1000 Subject: [PATCH] Teknopoint: Disable string output for Econo, Turbo, Health, & Light * 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 --- src/ir_Tcl.cpp | 15 +++++++----- test/IRac_test.cpp | 4 ++-- test/ir_Tcl_test.cpp | 48 ++++++++++++++++++------------------- test/ir_Teknopoint_test.cpp | 6 ++--- 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/ir_Tcl.cpp b/src/ir_Tcl.cpp index 5cb7ba5d2..4e3ad7e16 100644 --- a/src/ir_Tcl.cpp +++ b/src/ir_Tcl.cpp @@ -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: @@ -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, @@ -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); diff --git a/test/IRac_test.cpp b/test/IRac_test.cpp index a7078c867..158be7b1c 100644 --- a/test/IRac_test.cpp +++ b/test/IRac_test.cpp @@ -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(); diff --git a/test/ir_Tcl_test.cpp b/test/ir_Tcl_test.cpp index 14b41d330..ae992dbd9 100644 --- a/test/ir_Tcl_test.cpp +++ b/test/ir_Tcl_test.cpp @@ -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)); } @@ -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()); @@ -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()); } @@ -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()); @@ -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()); } @@ -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)); @@ -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()); } @@ -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)); } diff --git a/test/ir_Teknopoint_test.cpp b/test/ir_Teknopoint_test.cpp index 6551ad68f..226b84160 100644 --- a/test/ir_Teknopoint_test.cpp +++ b/test/ir_Teknopoint_test.cpp @@ -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)); } @@ -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));