Update IRRemoteESP8266 version to 2.5.5

factorize IR send signal function between the 2 types of receiving
Add new IRRemoteESP8266 protocols
replace pins on mega according schema
remove unecessaries spaces
This commit is contained in:
Florian committed 2019-02-08 16:50:37 +01:00
1 parent 0180a0dbd5
commit f0305236db
149 files changed
+20957 -7850

No files matched your search

+89 -37
View File
@@ -41,14 +41,14 @@ TEST(ReverseBitsTest, LessBitsReversedThanInputHasSet) {
// Tests for uint64ToString()
TEST(TestUint64ToString, TrivialCases) {
EXPECT_EQ("0", uint64ToString(0)); // Default base (10)
EXPECT_EQ("0", uint64ToString(0, 2)); // Base-2
EXPECT_EQ("0", uint64ToString(0, 8)); // Base-8
EXPECT_EQ("0", uint64ToString(0)); // Default base (10)
EXPECT_EQ("0", uint64ToString(0, 2)); // Base-2
EXPECT_EQ("0", uint64ToString(0, 8)); // Base-8
EXPECT_EQ("0", uint64ToString(0, 10)); // Base-10
EXPECT_EQ("0", uint64ToString(0, 16)); // Base-16
EXPECT_EQ("1", uint64ToString(1, 2)); // Base-2
EXPECT_EQ("2", uint64ToString(2, 8)); // Base-8
EXPECT_EQ("1", uint64ToString(1, 2)); // Base-2
EXPECT_EQ("2", uint64ToString(2, 8)); // Base-8
EXPECT_EQ("3", uint64ToString(3, 10)); // Base-10
EXPECT_EQ("4", uint64ToString(4, 16)); // Base-16
}
@@ -65,17 +65,17 @@ TEST(TestUint64ToString, NormalUse) {
TEST(TestUint64ToString, Max64Bit) {
EXPECT_EQ("18446744073709551615", uint64ToString(UINT64_MAX)); // Default
EXPECT_EQ("1111111111111111111111111111111111111111111111111111111111111111",
uint64ToString(UINT64_MAX, 2)); // Base-2
uint64ToString(UINT64_MAX, 2)); // Base-2
EXPECT_EQ("1777777777777777777777", uint64ToString(UINT64_MAX, 8)); // Base-8
EXPECT_EQ("18446744073709551615", uint64ToString(UINT64_MAX, 10)); // Base-10
EXPECT_EQ("FFFFFFFFFFFFFFFF", uint64ToString(UINT64_MAX, 16)); // Base-16
EXPECT_EQ("FFFFFFFFFFFFFFFF", uint64ToString(UINT64_MAX, 16)); // Base-16
}
TEST(TestUint64ToString, Max32Bit) {
EXPECT_EQ("4294967295", uint64ToString(UINT32_MAX)); // Default
EXPECT_EQ("4294967295", uint64ToString(UINT32_MAX)); // Default
EXPECT_EQ("37777777777", uint64ToString(UINT32_MAX, 8)); // Base-8
EXPECT_EQ("4294967295", uint64ToString(UINT32_MAX, 10)); // Base-10
EXPECT_EQ("FFFFFFFF", uint64ToString(UINT32_MAX, 16)); // Base-16
EXPECT_EQ("FFFFFFFF", uint64ToString(UINT32_MAX, 16)); // Base-16
}
TEST(TestUint64ToString, InterestingCases) {
@@ -89,8 +89,8 @@ TEST(TestUint64ToString, SillyBases) {
EXPECT_EQ("12345", uint64ToString(12345, 0)); // Super silly, makes no sense.
EXPECT_EQ("12345", uint64ToString(12345, 1)); // We don't do unary.
EXPECT_EQ("12345", uint64ToString(12345, 100)); // We can't print base-100.
EXPECT_EQ("12345", uint64ToString(12345, 37)); // Base-37 is one to far.
EXPECT_EQ("9IX", uint64ToString(12345, 36)); // But we *can* do base-36.
EXPECT_EQ("12345", uint64ToString(12345, 37)); // Base-37 is one to far.
EXPECT_EQ("9IX", uint64ToString(12345, 36)); // But we *can* do base-36.
}
TEST(TestGetCorrectedRawLength, NoLargeValues) {
@@ -115,7 +115,7 @@ TEST(TestGetCorrectedRawLength, WithLargeValues) {
irsend.makeDecodeResult();
irrecv.decode(&irsend.capture);
irsend.capture.rawbuf[3] = 60000;
ASSERT_EQ(2, RAWTICK); // The following values rely on RAWTICK being 2.
ASSERT_EQ(2, kRawTick); // The following values rely on kRawTick being 2.
EXPECT_EQ(7 + 2, getCorrectedRawLength(&irsend.capture));
irsend.capture.rawbuf[4] = UINT16_MAX - 1;
EXPECT_EQ(7 + 2 * 2, getCorrectedRawLength(&irsend.capture));
@@ -132,18 +132,22 @@ TEST(TestResultToSourceCode, SimpleTests) {
irsend.sendRaw(test_data, 7, 38000);
irsend.makeDecodeResult();
irrecv.decode(&irsend.capture);
EXPECT_EQ("uint16_t rawData[7] = {10, 20, 30, 40, 50, 60, 70};"
" // UNKNOWN A5E5F35D\n", resultToSourceCode(&irsend.capture));
EXPECT_EQ(
"uint16_t rawData[7] = {10, 20, 30, 40, 50, 60, 70};"
" // UNKNOWN A5E5F35D\n",
resultToSourceCode(&irsend.capture));
// Stick in some large values.
irsend.capture.rawbuf[3] = 60000;
EXPECT_EQ("uint16_t rawData[9] = {10, 20, 65535, 0, 54465, 40,"
" 50, 60, 70}; // UNKNOWN A5E5F35D\n",
resultToSourceCode(&irsend.capture));
EXPECT_EQ(
"uint16_t rawData[9] = {10, 20, 65535, 0, 54465, 40,"
" 50, 60, 70}; // UNKNOWN A5E5F35D\n",
resultToSourceCode(&irsend.capture));
irsend.capture.rawbuf[5] = UINT16_MAX;
EXPECT_EQ("uint16_t rawData[11] = {10, 20, 65535, 0, 54465, 40,"
" 65535, 0, 65535, 60, 70}; // UNKNOWN A5E5F35D\n",
resultToSourceCode(&irsend.capture));
EXPECT_EQ(
"uint16_t rawData[11] = {10, 20, 65535, 0, 54465, 40,"
" 65535, 0, 65535, 60, 70}; // UNKNOWN A5E5F35D\n",
resultToSourceCode(&irsend.capture));
// Reset and put the large value in a space location.
irsend.reset();
@@ -151,9 +155,10 @@ TEST(TestResultToSourceCode, SimpleTests) {
irsend.makeDecodeResult();
irrecv.decode(&irsend.capture);
irsend.capture.rawbuf[4] = UINT16_MAX - 1;
EXPECT_EQ("uint16_t rawData[9] = {10, 20, 30, 65535, 0, 65533,"
" 50, 60, 70}; // UNKNOWN A5E5F35D\n",
resultToSourceCode(&irsend.capture));
EXPECT_EQ(
"uint16_t rawData[9] = {10, 20, 30, 65535, 0, 65533,"
" 50, 60, 70}; // UNKNOWN A5E5F35D\n",
resultToSourceCode(&irsend.capture));
}
TEST(TestResultToSourceCode, SimpleProtocols) {
@@ -167,7 +172,7 @@ TEST(TestResultToSourceCode, SimpleProtocols) {
irsend.makeDecodeResult();
ASSERT_TRUE(irrecv.decode(&irsend.capture));
ASSERT_EQ(NEC, irsend.capture.decode_type);
ASSERT_EQ(NEC_BITS, irsend.capture.bits);
ASSERT_EQ(kNECBits, irsend.capture.bits);
EXPECT_EQ(
"uint16_t rawData[68] = {8960, 4480, 560, 560, 560, 560, 560, 560, "
"560, 560, 560, 1680, 560, 560, 560, 560, 560, 560, 560, 1680, "
@@ -178,7 +183,8 @@ TEST(TestResultToSourceCode, SimpleProtocols) {
"}; // NEC 8F704FB\n"
"uint32_t address = 0x10;\n"
"uint32_t command = 0x20;\n"
"uint64_t data = 0x8F704FB;\n", resultToSourceCode(&irsend.capture));
"uint64_t data = 0x8F704FB;\n",
resultToSourceCode(&irsend.capture));
// Generate a code which DOESN'T have address & command values.
irsend.reset();
@@ -186,7 +192,7 @@ TEST(TestResultToSourceCode, SimpleProtocols) {
irsend.makeDecodeResult();
ASSERT_TRUE(irrecv.decode(&irsend.capture));
ASSERT_EQ(NIKAI, irsend.capture.decode_type);
ASSERT_EQ(NIKAI_BITS, irsend.capture.bits);
ASSERT_EQ(kNikaiBits, irsend.capture.bits);
EXPECT_EQ(
"uint16_t rawData[52] = {4000, 4000, 500, 2000, 500, 2000, "
"500, 2000, 500, 2000, 500, 1000, 500, 1000, 500, 2000, 500, 1000, "
@@ -194,7 +200,8 @@ TEST(TestResultToSourceCode, SimpleProtocols) {
"500, 1000, 500, 1000, 500, 2000, 500, 2000, 500, 1000, 500, 2000, "
"500, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 8500 };"
" // NIKAI D0F2F\n"
"uint64_t data = 0xD0F2F;\n", resultToSourceCode(&irsend.capture));
"uint64_t data = 0xD0F2F;\n",
resultToSourceCode(&irsend.capture));
}
TEST(TestResultToSourceCode, ComplexProtocols) {
@@ -202,15 +209,15 @@ TEST(TestResultToSourceCode, ComplexProtocols) {
IRrecv irrecv(1);
irsend.begin();
uint8_t state[TOSHIBA_AC_STATE_LENGTH] = {
0xF2, 0x0D, 0x03, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x01};
uint8_t state[kToshibaACStateLength] = {0xF2, 0x0D, 0x03, 0xFC, 0x01,
0x00, 0x00, 0x00, 0x01};
irsend.reset();
irsend.sendToshibaAC(state);
irsend.makeDecodeResult();
ASSERT_TRUE(irrecv.decode(&irsend.capture));
ASSERT_EQ(TOSHIBA_AC, irsend.capture.decode_type);
ASSERT_EQ(TOSHIBA_AC_BITS, irsend.capture.bits);
ASSERT_EQ(kToshibaACBits, irsend.capture.bits);
EXPECT_EQ(
"uint16_t rawData[296] = {4400, 4300, 542, 1622, 542, 1622, "
"542, 1622, 542, 1622, 542, 472, 542, 472, 542, 1622, 542, 472, "
@@ -239,7 +246,8 @@ TEST(TestResultToSourceCode, ComplexProtocols) {
"542, 472, 542, 472, 542, 472, 542, 472, 542, 472, 542, 1622, "
"542, 7048 }; // TOSHIBA_AC\n"
"uint8_t state[9] = {0xF2, 0x0D, 0x03, 0xFC, 0x01, 0x00, 0x00, 0x00, "
"0x01};\n", resultToSourceCode(&irsend.capture));
"0x01};\n",
resultToSourceCode(&irsend.capture));
}
TEST(TestResultToTimingInfo, General) {
@@ -252,7 +260,7 @@ TEST(TestResultToTimingInfo, General) {
irsend.makeDecodeResult();
ASSERT_TRUE(irrecv.decode(&irsend.capture));
ASSERT_EQ(NEC, irsend.capture.decode_type);
ASSERT_EQ(NEC_BITS, irsend.capture.bits);
ASSERT_EQ(kNECBits, irsend.capture.bits);
EXPECT_EQ(
"Raw Timing[68]:\n"
" + 8960, - 4480, + 560, - 560, + 560, - 560,"
@@ -297,7 +305,7 @@ TEST(TestResultToHumanReadableBasic, SimpleCodes) {
irsend.makeDecodeResult();
ASSERT_TRUE(irrecv.decode(&irsend.capture));
ASSERT_EQ(NEC, irsend.capture.decode_type);
ASSERT_EQ(NEC_BITS, irsend.capture.bits);
ASSERT_EQ(kNECBits, irsend.capture.bits);
EXPECT_EQ(
"Encoding : NEC\n"
"Code : 8F704FB (32 bits)\n",
@@ -309,16 +317,15 @@ TEST(TestResultToHumanReadableBasic, ComplexCodes) {
IRrecv irrecv(1);
irsend.begin();
uint8_t state[TOSHIBA_AC_STATE_LENGTH] = {
0xF2, 0x0D, 0x03, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x01};
uint8_t state[kToshibaACStateLength] = {0xF2, 0x0D, 0x03, 0xFC, 0x01,
0x00, 0x00, 0x00, 0x01};
irsend.reset();
irsend.sendToshibaAC(state);
irsend.makeDecodeResult();
ASSERT_TRUE(irrecv.decode(&irsend.capture));
ASSERT_EQ(TOSHIBA_AC, irsend.capture.decode_type);
ASSERT_EQ(TOSHIBA_AC_BITS, irsend.capture.bits);
ASSERT_EQ(kToshibaACBits, irsend.capture.bits);
EXPECT_EQ(
"Encoding : TOSHIBA_AC\n"
"Code : F20D03FC0100000001 (72 bits)\n",
@@ -343,3 +350,48 @@ TEST(TestInvertBits, MoreThan64Bits) {
ASSERT_EQ(0xAAAA5555AAAA5555, invertBits(0x5555AAAA5555AAAA, 70));
ASSERT_EQ(0xFFFFFFFFFFFFFFFF, invertBits(0x0, 128));
}
TEST(TestCountBits, Pointer) {
uint8_t data[14] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
ASSERT_EQ(0, countBits(data, 0));
ASSERT_EQ(0, countBits(data, 1));
ASSERT_EQ(0, countBits(data, 1, true));
ASSERT_EQ(8, countBits(data, 1, false));
ASSERT_EQ(1, countBits(data, 2));
ASSERT_EQ(15, countBits(data, 2, false));
ASSERT_EQ(1, countBits(data + 1, 1));
ASSERT_EQ(2, countBits(data, 3));
ASSERT_EQ(4, countBits(data, 4));
ASSERT_EQ(25, countBits(data, 14));
ASSERT_EQ(25, countBits(data, 14));
ASSERT_EQ(14 * 8, countBits(data, 14, true) + countBits(data, 14, false));
ASSERT_EQ(125, countBits(data, 14, true, 100));
}
TEST(TestCountBits, Integer) {
uint64_t data = 0xAAAAAAAAAAAAAAAA;
ASSERT_EQ(0, countBits(data, 0));
ASSERT_EQ(0, countBits(data, 1));
ASSERT_EQ(0, countBits(data, 1, true));
ASSERT_EQ(1, countBits(data, 1, false));
ASSERT_EQ(1, countBits(data, 3));
ASSERT_EQ(2, countBits(data, 3, false));
ASSERT_EQ(4, countBits(data, 8));
ASSERT_EQ(4, countBits(data, 8, false));
ASSERT_EQ(32, countBits(data, 64));
ASSERT_EQ(32, countBits(data, 64, false));
data = 0;
ASSERT_EQ(0, countBits(data, 1, true));
ASSERT_EQ(1, countBits(data, 1, false));
ASSERT_EQ(0, countBits(data, 64));
ASSERT_EQ(64, countBits(data, 64, false));
data = 0xFFFFFFFFFFFFFFFF;
ASSERT_EQ(1, countBits(data, 1, true));
ASSERT_EQ(0, countBits(data, 1, false));
ASSERT_EQ(64, countBits(data, 64));
ASSERT_EQ(0, countBits(data, 64, false));
}