Skip to content

Commit

Permalink
Swap position of Timer times in Protocol structure.
Browse files Browse the repository at this point in the history
* Improve timer unit tests with actual data.

For #1486
  • Loading branch information
crankyoldgit committed Sep 12, 2021
1 parent 61d459a commit 31fca9b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ir_Tcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ union Tcl112Protocol{
uint8_t :1;
// Byte 9
uint8_t :1; // 0
uint8_t OffTimer :6;
uint8_t OnTimer :6;
uint8_t :1; // 0
// Byte 10
uint8_t :1; // 0
uint8_t OnTimer :6;
uint8_t OffTimer :6;
uint8_t :1; // 0
// Byte 11
uint8_t :8; // 00000000
Expand Down
26 changes: 26 additions & 0 deletions test/ir_Tcl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,4 +661,30 @@ TEST(TestTcl112AcClass, Timers) {
EXPECT_FALSE(ac._.TimerIndicator);
EXPECT_FALSE(ac._.OnTimerEnabled);
EXPECT_FALSE(ac._.OffTimerEnabled);

// Real messages/states
// Per https://github.com/crankyoldgit/IRremoteESP8266/issues/1486#issuecomment-917545485

const uint8_t offtimer_1h[14] = {
0x23, 0xCB, 0x26, 0x01, 0x00, 0x34, 0x03,
0x00, 0x78, 0x00, 0x06, 0x00, 0x00, 0xCA};
ac.setRaw(offtimer_1h);
EXPECT_EQ(60, ac.getOffTimer());
EXPECT_TRUE(ac._.TimerIndicator);
EXPECT_FALSE(ac._.OnTimerEnabled);
EXPECT_TRUE(ac._.OffTimerEnabled);

const uint8_t offtimer_4h[14] = {
0x23, 0xCB, 0x26, 0x01, 0x00, 0x34, 0x03,
0x00, 0x78, 0x00, 0x18, 0x00, 0x00, 0xDC};
ac.setRaw(offtimer_4h);
EXPECT_EQ(240, ac.getOffTimer());
EXPECT_TRUE(ac._.TimerIndicator);
EXPECT_FALSE(ac._.OnTimerEnabled);
EXPECT_TRUE(ac._.OffTimerEnabled);
EXPECT_EQ(
"Model: 2 (GZ055BE1), Type: 1, Power: On, Mode: 3 (Cool), Temp: 31C, "
"Fan: 0 (Auto), Swing(H): Off, Swing(V): 7 (Swing), "
"On Timer: Off, Off Timer: 04:00",
ac.toString());
}

0 comments on commit 31fca9b

Please sign in to comment.