[FL-1956] Fix long packets bug, fix Manchester overrun (#766)

Also fix RC6 test to detect this manchester bug
This commit is contained in:
Albert Kharisov
2021-10-16 16:00:21 +04:00
committed by GitHub
parent 2255060d52
commit 98830a8a41
12 changed files with 174 additions and 38 deletions

View File

@@ -247,6 +247,11 @@ MU_TEST(test_decoder_necext1) {
RUN_DECODER(test_decoder_necext_input1, test_decoder_necext_expected1);
}
MU_TEST(test_decoder_long_packets_with_nec_start) {
RUN_DECODER(test_decoder_nec42ext_input1, test_decoder_nec42ext_expected1);
RUN_DECODER(test_decoder_nec42ext_input2, test_decoder_nec42ext_expected2);
}
MU_TEST(test_encoder_sirc) {
RUN_ENCODER(test_encoder_sirc_input1, test_encoder_sirc_expected1);
RUN_ENCODER(test_encoder_sirc_input2, test_encoder_sirc_expected2);
@@ -310,6 +315,7 @@ MU_TEST_SUITE(test_irda_decoder_encoder) {
MU_RUN_TEST(test_decoder_rc6);
MU_RUN_TEST(test_encoder_rc6);
MU_RUN_TEST(test_decoder_unexpected_end_in_sequence);
MU_RUN_TEST(test_decoder_long_packets_with_nec_start);
MU_RUN_TEST(test_decoder_nec);
MU_RUN_TEST(test_decoder_samsung32);
MU_RUN_TEST(test_decoder_necext1);

View File

@@ -306,3 +306,36 @@ const IrdaMessage test_nec42ext[] = {
{IrdaProtocolNEC42ext, 0x1555555, 0x5555, true},
};
const uint32_t test_decoder_nec42ext_input1[] = {
2000000, 9000, 4500, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 8
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 16
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 24
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 32
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 40
560, 560, 560, 560, 560, // 42
};
const uint32_t test_decoder_nec42ext_input2[] = {
2000000, 9000, 4500, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 8
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 16
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 24
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 32
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 40
560, 560, 560, 560, 560, 560, 560, // 43 - failed
2000000, 9000, 4500, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 8
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 16
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 24
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 32
560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, // 40
560, 560, 560, 560, 560, 10000, 560, // 42 OK + 1 failed
};
const IrdaMessage test_decoder_nec42ext_expected1[] = {
{IrdaProtocolNEC42ext, 0x00, 0, false},
};
const IrdaMessage test_decoder_nec42ext_expected2[] = {
{IrdaProtocolNEC42ext, 0x00, 0, false},
};

View File

@@ -1,45 +1,95 @@
/*
_____---------______--____--__--__--____------____--__----____--__----__--__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
_____---------______--____--__--__------____--____--__----____--__----__--__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
_____---------______--____--__--__--____------____--__----____--__----__--__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
_____---------______--____--__--__--____------____--__----____--__----__--__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
_____---------______--____--__--__--____------____--__----____--__----__--__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
_____---------______--____--__--__------____--____--__----____--__----__--__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 93 A0 0
s m2 m1 m0 T | address | command |
// 93 A0 0
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
//27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888,
// --__----__--__--
// 0 | 0 | 1 | 1 | 1
//444, 444, 888, 444, 444, 444, 444,
//888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
_____---------______--____--__--__------____--____--__----____--__----__--__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 93 A0 1
// 93 A0 1
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
//27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888,
//444, 444, 888, 444, 444, 444, 444,
//888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
_____---------______--____--__--__--____------____--__----____----____--__----____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 94 A0 0
// 94 A0 0
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 888, 888, 444, 444, 888, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
//27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888,
//----____--__----
//0 | 1 | 0 | 0 | 1
//888, 888, 444, 444, 888,
//888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
_____---------______--____--__--__------____--____--__----____----____--__----____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 94 A0 1
// 94 A0 1
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 888, 888, 444, 444, 888, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
//27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888,
//888, 888, 444, 444, 888,
//888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
_____---------______--____--__--__--____------____--__----____----____----__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 95 A0 0
// 95 A0 0
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 888, 888, 888, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
//27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888,
//----____----__--
//0 | 1 | 0 | 1 | 1
//888, 888, 888, 444, 444,
//888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
_____---------______--____--__--__------____--____--__----____----____----__--____----____--__--__--__--__--___________
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 95 A0 1
// 95 A0 1
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 888, 888, 888, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
//27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888,
//888, 888, 888, 444, 444,
//888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
*/
const uint32_t test_decoder_rc6_input1[] = {
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
// 94 A0 0
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 888, 888, 444, 444, 888, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
// 93 A0 1
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 888, // failed
// failed 95
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 888, 888, 888, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 888,
// 93 A0 0
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 888, // failed
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 888,
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 888, // failed
// 94 A0 1
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 888, 888, 444, 444, 888, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
// 95 A0 0
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444, 444 + 444, 888 + 444, 888, 444, 444, 888, 888, 888, 888, 888, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
// failed 93 + 1 sample
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, 444,
// failed 93
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 888, 444, 444,
// failed 93
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 444, 444, 888, 444, 444, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 888,
// 95 A0 1
27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 888, 888, 888, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
};
const IrdaMessage test_decoder_rc6_expected1[] = {
{IrdaProtocolRC6, 0x93, 0xA0, false}, // toggle 0
{IrdaProtocolRC6, 0x94, 0xA0, false}, // toggle 0
{IrdaProtocolRC6, 0x93, 0xA0, false}, // toggle 1
// {IrdaProtocolRC6, 0x93, 0xA0, false},
// {IrdaProtocolRC6, 0x95, 0xA0, false}, failed
{IrdaProtocolRC6, 0x93, 0xA0, false}, // toggle 0
{IrdaProtocolRC6, 0x93, 0xA0, true}, // toggle 0
{IrdaProtocolRC6, 0x93, 0xA0, true}, // toggle 0
{IrdaProtocolRC6, 0x93, 0xA0, false}, // toggle 1
// {IrdaProtocolRC6, 0x93, 0xA0, false},
{IrdaProtocolRC6, 0x93, 0xA0, false}, // toggle 0
{IrdaProtocolRC6, 0x93, 0xA1, false}, // toggle 1
// {IrdaProtocolRC6, 0x93, 0xA0, false},
{IrdaProtocolRC6, 0x94, 0xA0, false}, // toggle 1
{IrdaProtocolRC6, 0x95, 0xA0, false}, // toggle 0
// {IrdaProtocolRC6, 0x93, 0xA0, false}, failed
// {IrdaProtocolRC6, 0x93, 0xA0, false}, failed
// {IrdaProtocolRC6, 0x93, 0xA0, false}, failed
{IrdaProtocolRC6, 0x95, 0xA0, false}, // toggle 1
};
const IrdaMessage test_encoder_rc6_input1[] = {