Ir esp8266 lib update and code impacts (#235)
* integrate new IRremoteESP8266 lib 2.4.2 and add new protocols IR_RC6 IR_MITSUBISHI IR_GICABLE IR_MITSUBISHI2 IR_LASERTAG IR_CARRIER_AC IR_MIDEA IR_NIKAI IR_SHERWOOD IR_DENON IR_AIWA_RC_T501 IR_JVC
This commit is contained in:
1 parent
9b258723a8
commit
b12ee19979
130 files changed
+16548
-1693
No files matched your search
@@ -1,5 +1,6 @@
|
||||
// Copyright 2017 David Conran
|
||||
|
||||
#include "IRrecv_test.h"
|
||||
#include "IRremoteESP8266.h"
|
||||
#include "IRrecv.h"
|
||||
#include "IRsend.h"
|
||||
@@ -446,3 +447,128 @@ TEST(TestDecode, DecodeAiwa) {
|
||||
EXPECT_EQ(AIWA_RC_T501_BITS, irsend.capture.bits);
|
||||
EXPECT_EQ(0x7F, irsend.capture.value);
|
||||
}
|
||||
|
||||
// Test matchData() on space encoded data.
|
||||
TEST(TestMatchData, SpaceEncoded) {
|
||||
IRsendTest irsend(0);
|
||||
IRrecv irrecv(1);
|
||||
irsend.begin();
|
||||
|
||||
uint16_t space_encoded_raw[11] = {
|
||||
500, 500,
|
||||
500, 1500,
|
||||
499, 499,
|
||||
501, 1501,
|
||||
499, 1490,
|
||||
500
|
||||
};
|
||||
match_result_t result;
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(space_encoded_raw, 11, 38000);
|
||||
irsend.makeDecodeResult();
|
||||
result = irrecv.matchData(irsend.capture.rawbuf + 1, 5, 500, 1500, 500, 500);
|
||||
ASSERT_TRUE(result.success);
|
||||
EXPECT_EQ(0b01011, result.data);
|
||||
EXPECT_EQ(10, result.used);
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(space_encoded_raw, 11, 38000);
|
||||
irsend.makeDecodeResult();
|
||||
result = irrecv.matchData(irsend.capture.rawbuf + 1, 5, 500, 1000, 500, 500);
|
||||
ASSERT_FALSE(result.success);
|
||||
}
|
||||
|
||||
// Test matchData() on mark encoded data.
|
||||
TEST(TestMatchData, MarkEncoded) {
|
||||
IRsendTest irsend(0);
|
||||
IRrecv irrecv(1);
|
||||
irsend.begin();
|
||||
|
||||
uint16_t mark_encoded_raw[11] = {
|
||||
500, 500,
|
||||
1500, 500,
|
||||
499, 499,
|
||||
1501, 501,
|
||||
1499, 490,
|
||||
500
|
||||
};
|
||||
match_result_t result;
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(mark_encoded_raw, 11, 38000);
|
||||
irsend.makeDecodeResult();
|
||||
result = irrecv.matchData(irsend.capture.rawbuf + 1, 5, 1500, 500, 500, 500);
|
||||
ASSERT_TRUE(result.success);
|
||||
EXPECT_EQ(0b01011, result.data);
|
||||
EXPECT_EQ(10, result.used);
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(mark_encoded_raw, 11, 38000);
|
||||
irsend.makeDecodeResult();
|
||||
result = irrecv.matchData(irsend.capture.rawbuf + 1, 5, 1000, 500, 500, 500);
|
||||
ASSERT_FALSE(result.success);
|
||||
}
|
||||
|
||||
// Test matchData() on "equal total bit time" encoded data.
|
||||
TEST(TestMatchData, EqualTotalBitTimeEncoded) {
|
||||
IRsendTest irsend(0);
|
||||
IRrecv irrecv(1);
|
||||
irsend.begin();
|
||||
|
||||
uint16_t equal_encoded_raw[11] = {
|
||||
500, 1500,
|
||||
1500, 500,
|
||||
499, 1499,
|
||||
1501, 501,
|
||||
1499, 490,
|
||||
500
|
||||
};
|
||||
match_result_t result;
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(equal_encoded_raw, 11, 38000);
|
||||
irsend.makeDecodeResult();
|
||||
result = irrecv.matchData(irsend.capture.rawbuf + 1, 5, 1500, 500, 500, 1500);
|
||||
ASSERT_TRUE(result.success);
|
||||
EXPECT_EQ(0b01011, result.data);
|
||||
EXPECT_EQ(10, result.used);
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(equal_encoded_raw, 11, 38000);
|
||||
irsend.makeDecodeResult();
|
||||
result = irrecv.matchData(irsend.capture.rawbuf + 1, 5, 1000, 500, 500, 1000);
|
||||
ASSERT_FALSE(result.success);
|
||||
}
|
||||
|
||||
// Test matchData() on arbitrary encoded data.
|
||||
TEST(TestMatchData, ArbitraryEncoded) {
|
||||
IRsendTest irsend(0);
|
||||
IRrecv irrecv(1);
|
||||
irsend.begin();
|
||||
|
||||
uint16_t arbitrary_encoded_raw[11] = {
|
||||
500, 1500,
|
||||
3000, 1000,
|
||||
499, 1499,
|
||||
3001, 1001,
|
||||
2999, 990,
|
||||
500
|
||||
};
|
||||
match_result_t result;
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(arbitrary_encoded_raw, 11, 38000);
|
||||
irsend.makeDecodeResult();
|
||||
result = irrecv.matchData(irsend.capture.rawbuf + 1, 5,
|
||||
3000, 1000, 500, 1500);
|
||||
ASSERT_TRUE(result.success);
|
||||
EXPECT_EQ(0b01011, result.data);
|
||||
EXPECT_EQ(10, result.used);
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(arbitrary_encoded_raw, 11, 38000);
|
||||
irsend.makeDecodeResult();
|
||||
result = irrecv.matchData(irsend.capture.rawbuf + 1, 5, 1000, 500, 500, 1000);
|
||||
ASSERT_FALSE(result.success);
|
||||
}
|
||||
Reference in new issue
Block a user