13
13
// Tests for encodePanasonic().
14
14
15
15
TEST (TestEncodePanasonic, General) {
16
- IRsendTest irsend (4 );
16
+ IRsendTest irsend (kGpioUnused );
17
17
EXPECT_EQ (0x0 , irsend.encodePanasonic (0 , 0 , 0 , 0 ));
18
18
EXPECT_EQ (0x101010101 , irsend.encodePanasonic (1 , 1 , 1 , 1 ));
19
19
EXPECT_EQ (0xFFFF , irsend.encodePanasonic (0 , 0 , 0 , 0xFF ));
@@ -28,7 +28,7 @@ TEST(TestEncodePanasonic, General) {
28
28
29
29
// Test sending typical data only.
30
30
TEST (TestSendPanasonic64, SendDataOnly) {
31
- IRsendTest irsend (4 );
31
+ IRsendTest irsend (kGpioUnused );
32
32
irsend.begin ();
33
33
34
34
irsend.reset ();
@@ -76,7 +76,7 @@ TEST(TestSendPanasonic64, SendDataOnly) {
76
76
77
77
// Test sending with different repeats.
78
78
TEST (TestSendPanasonic64, SendWithRepeats) {
79
- IRsendTest irsend (4 );
79
+ IRsendTest irsend (kGpioUnused );
80
80
irsend.begin ();
81
81
82
82
irsend.reset ();
@@ -147,7 +147,7 @@ TEST(TestSendPanasonic64, SendWithRepeats) {
147
147
148
148
// Test sending an atypical data size.
149
149
TEST (TestSendPanasonic64, SendUnusualSize) {
150
- IRsendTest irsend (4 );
150
+ IRsendTest irsend (kGpioUnused );
151
151
irsend.begin ();
152
152
153
153
irsend.reset ();
@@ -213,8 +213,8 @@ TEST(TestSendPanasonic, CompareToSendPanasonic64) {
213
213
214
214
// Decode normal Panasonic messages.
215
215
TEST (TestDecodePanasonic, NormalDecodeWithStrict) {
216
- IRsendTest irsend (4 );
217
- IRrecv irrecv (4 );
216
+ IRsendTest irsend (kGpioUnused );
217
+ IRrecv irrecv (kGpioUnused );
218
218
irsend.begin ();
219
219
220
220
// Normal Panasonic 48-bit message.
@@ -259,8 +259,8 @@ TEST(TestDecodePanasonic, NormalDecodeWithStrict) {
259
259
260
260
// Decode normal repeated Panasonic messages.
261
261
TEST (TestDecodePanasonic, NormalDecodeWithRepeatAndStrict) {
262
- IRsendTest irsend (4 );
263
- IRrecv irrecv (4 );
262
+ IRsendTest irsend (kGpioUnused );
263
+ IRrecv irrecv (kGpioUnused );
264
264
irsend.begin ();
265
265
266
266
// Normal Panasonic 48-bit message with 2 repeats.
@@ -293,8 +293,8 @@ TEST(TestDecodePanasonic, NormalDecodeWithRepeatAndStrict) {
293
293
294
294
// Decode Panasonic messages with unsupported values.
295
295
TEST (TestDecodePanasonic, DecodeWithNonStrictValues) {
296
- IRsendTest irsend (4 );
297
- IRrecv irrecv (4 );
296
+ IRsendTest irsend (kGpioUnused );
297
+ IRrecv irrecv (kGpioUnused );
298
298
irsend.begin ();
299
299
300
300
irsend.reset ();
@@ -331,8 +331,8 @@ TEST(TestDecodePanasonic, DecodeWithNonStrictValues) {
331
331
332
332
// Decode Panasonic messages with unsupported size/lengths.
333
333
TEST (TestDecodePanasonic, DecodeWithNonStrictSize) {
334
- IRsendTest irsend (4 );
335
- IRrecv irrecv (4 );
334
+ IRsendTest irsend (kGpioUnused );
335
+ IRrecv irrecv (kGpioUnused );
336
336
irsend.begin ();
337
337
338
338
irsend.reset ();
@@ -375,8 +375,8 @@ TEST(TestDecodePanasonic, DecodeWithNonStrictSize) {
375
375
376
376
// Decode (non-standard) 64-bit messages.
377
377
TEST (TestDecodePanasonic, Decode64BitMessages) {
378
- IRsendTest irsend (4 );
379
- IRrecv irrecv (4 );
378
+ IRsendTest irsend (kGpioUnused );
379
+ IRrecv irrecv (kGpioUnused );
380
380
irsend.begin ();
381
381
382
382
irsend.reset ();
@@ -395,8 +395,8 @@ TEST(TestDecodePanasonic, Decode64BitMessages) {
395
395
396
396
// Decode a 'real' example via GlobalCache
397
397
TEST (TestDecodePanasonic, DecodeGlobalCacheExample) {
398
- IRsendTest irsend (4 );
399
- IRrecv irrecv (4 );
398
+ IRsendTest irsend (kGpioUnused );
399
+ IRrecv irrecv (kGpioUnused );
400
400
irsend.begin ();
401
401
402
402
irsend.reset ();
@@ -432,8 +432,8 @@ TEST(TestDecodePanasonic, DecodeGlobalCacheExample) {
432
432
433
433
// Fail to decode a non-Panasonic example via GlobalCache
434
434
TEST (TestDecodePanasonic, FailToDecodeNonPanasonicExample) {
435
- IRsendTest irsend (4 );
436
- IRrecv irrecv (4 );
435
+ IRsendTest irsend (kGpioUnused );
436
+ IRrecv irrecv (kGpioUnused );
437
437
irsend.begin ();
438
438
439
439
irsend.reset ();
@@ -452,8 +452,8 @@ TEST(TestDecodePanasonic, FailToDecodeNonPanasonicExample) {
452
452
453
453
// Failing to decode Panasonic in Issue #245
454
454
TEST (TestDecodePanasonic, DecodeIssue245) {
455
- IRsendTest irsend (4 );
456
- IRrecv irrecv (4 );
455
+ IRsendTest irsend (kGpioUnused );
456
+ IRrecv irrecv (kGpioUnused );
457
457
irsend.begin ();
458
458
459
459
irsend.reset ();
@@ -813,8 +813,8 @@ TEST(TestIRPanasonicAcClass, HumanReadable) {
813
813
814
814
// Decode normal Panasonic AC messages.
815
815
TEST (TestDecodePanasonicAC, RealExample) {
816
- IRsendTest irsend (4 );
817
- IRrecv irrecv (4 );
816
+ IRsendTest irsend (kGpioUnused );
817
+ IRrecv irrecv (kGpioUnused );
818
818
irsend.begin ();
819
819
820
820
// Data from Issue #525
@@ -1586,3 +1586,73 @@ TEST(TestIRPanasonicAc32Class, HumanReadable) {
1586
1586
" Swing(H): Off, Swing(V): 5 (Lowest)" ,
1587
1587
ac.toString ());
1588
1588
}
1589
+
1590
+ // Decode a 'real' example of a captured 40 bit panasonic message
1591
+ TEST (TestDecodePanasonic, RealPanasonic40BitMesg) {
1592
+ IRsendTest irsend (kGpioUnused );
1593
+ IRrecv irrecv (kGpioUnused );
1594
+ irsend.begin ();
1595
+
1596
+ irsend.reset ();
1597
+ // Panasonic 40 bit code https://github.com/crankyoldgit/IRremoteESP8266/issues/1976#issue-1660147581
1598
+ const uint16_t rawData1[83 ] = {
1599
+ 3486 , 1742 ,
1600
+ 432 , 456 , 406 , 456 , 406 , 1336 , 406 , 1312 , 430 , 456 , 406 , 1334 , 408 , 456 ,
1601
+ 406 , 456 , 408 , 456 , 406 , 1334 , 408 , 456 , 408 , 454 , 408 , 1334 , 408 , 456 ,
1602
+ 406 , 1336 , 406 , 456 , 408 , 1334 , 408 , 456 , 406 , 456 , 408 , 1336 , 406 , 456 ,
1603
+ 408 , 454 , 406 , 456 , 406 , 454 , 408 , 1332 , 410 , 1332 , 408 , 1334 , 408 , 1336 ,
1604
+ 406 , 1334 , 410 , 1332 , 410 , 454 , 406 , 456 , 406 , 456 , 406 , 1332 , 410 , 1334 ,
1605
+ 408 , 454 , 406 , 1336 , 406 , 1336 , 406 , 454 , 410 , 454 , 408 }; // UKN 1D41D404
1606
+
1607
+ irsend.sendRaw (rawData1, 83 , 38 );
1608
+ irsend.makeDecodeResult ();
1609
+
1610
+ ASSERT_TRUE (irrecv.decode (&irsend.capture ));
1611
+ EXPECT_EQ (PANASONIC, irsend.capture .decode_type );
1612
+ EXPECT_EQ (kPanasonic40Bits , irsend.capture .bits );
1613
+ EXPECT_EQ (0x344A90FC6C , irsend.capture .value );
1614
+ EXPECT_EQ (0x34 , irsend.capture .address );
1615
+ EXPECT_EQ (0x4A90FC6C , irsend.capture .command );
1616
+ EXPECT_FALSE (irsend.capture .repeat );
1617
+
1618
+ // night ch3 from https://github.com/crankyoldgit/IRremoteESP8266/issues/1976#issuecomment-1501736104
1619
+ const uint16_t rawData2[83 ] = {
1620
+ 3490 , 1734 ,
1621
+ 440 , 426 , 460 , 400 , 438 , 1304 , 438 , 1302 , 440 , 426 , 436 , 1302 , 464 , 400 ,
1622
+ 462 , 400 , 462 , 402 , 462 , 1278 , 438 , 426 , 438 , 426 , 460 , 1282 , 434 , 428 ,
1623
+ 434 , 1308 , 460 , 402 , 460 , 1280 , 440 , 422 , 438 , 426 , 436 , 1306 , 438 , 424 ,
1624
+ 462 , 402 , 436 , 426 , 462 , 400 , 438 , 426 , 436 , 1304 , 434 , 1308 , 438 , 1304 ,
1625
+ 464 , 1278 , 436 , 1306 , 466 , 398 , 464 , 398 , 466 , 1276 , 466 , 1274 , 464 , 1280 ,
1626
+ 462 , 402 , 436 , 1304 , 466 , 1276 , 440 , 422 , 440 , 424 , 460 }; // UKN DAE32FFC
1627
+ irsend.reset ();
1628
+
1629
+ irsend.sendRaw (rawData2, 83 , 38 );
1630
+ irsend.makeDecodeResult ();
1631
+
1632
+ ASSERT_TRUE (irrecv.decode (&irsend.capture ));
1633
+ EXPECT_EQ (PANASONIC, irsend.capture .decode_type );
1634
+ EXPECT_EQ (kPanasonic40Bits , irsend.capture .bits );
1635
+ EXPECT_EQ (0x344A907CEC , irsend.capture .value );
1636
+ EXPECT_EQ (0x34 , irsend.capture .address );
1637
+ EXPECT_EQ (0x4A907CEC , irsend.capture .command );
1638
+ EXPECT_FALSE (irsend.capture .repeat );
1639
+ }
1640
+
1641
+ // recreate the above real message, synthetically.
1642
+ TEST (TestDecodePanasonic, SynthticPanasonic40BitMesg) {
1643
+ IRsendTest irsend (kGpioUnused );
1644
+ IRrecv irrecv (kGpioUnused );
1645
+ irsend.begin ();
1646
+ irsend.reset ();
1647
+
1648
+ irsend.sendPanasonic64 (0x344A90FC6C , kPanasonic40Bits );
1649
+ irsend.makeDecodeResult ();
1650
+
1651
+ ASSERT_TRUE (irrecv.decode (&irsend.capture ));
1652
+ EXPECT_EQ (PANASONIC, irsend.capture .decode_type );
1653
+ EXPECT_EQ (kPanasonic40Bits , irsend.capture .bits );
1654
+ EXPECT_EQ (0x344A90FC6C , irsend.capture .value );
1655
+ EXPECT_EQ (0x34 , irsend.capture .address );
1656
+ EXPECT_EQ (0x4A90FC6C , irsend.capture .command );
1657
+ EXPECT_FALSE (irsend.capture .repeat );
1658
+ }
0 commit comments