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:
Florian authored and GitHub committed 2018-07-22 16:44:10 +02:00
1 parent 9b258723a8
commit b12ee19979
130 files changed
+16548 -1693

No files matched your search

+61 -13
View File
@@ -10,9 +10,16 @@
#include <string>
#include "IRrecv.h"
#include "IRsend.h"
#include "IRtimer.h"
#define OUTPUT_BUF 10000U
#define RAW_BUF 10000U
#ifdef UNIT_TEST
// Used to help simulate elapsed time in unit tests.
uint32_t _IRtimer_unittest_now = 0;
#endif // UNIT_TEST
#define OUTPUT_BUF 1000U
#define RAW_BUF 1000U
class IRsendTest: public IRsend {
public:
uint32_t output[OUTPUT_BUF];
@@ -20,13 +27,17 @@ class IRsendTest: public IRsend {
uint16_t rawbuf[RAW_BUF];
decode_results capture;
explicit IRsendTest(uint16_t x, bool i = false) : IRsend(x, i) {
explicit IRsendTest(uint16_t x, bool i = false, bool j = true) :
IRsend(x, i, j) {
reset();
}
void reset() {
last = 0;
output[last] = 0;
for (uint16_t i = 0; i < OUTPUT_BUF; i++)
output[i] = 0;
for (uint16_t i = 0; i < RAW_BUF; i++)
rawbuf[i] = 0;
}
std::string outputStr() {
@@ -47,7 +58,7 @@ class IRsendTest: public IRsend {
void makeDecodeResult(uint16_t offset = 0) {
capture.decode_type = UNKNOWN;
capture.bits = 0;
capture.rawlen = last + 1 - offset;
capture.rawlen = last + 2 - offset;
capture.overflow = (last - offset >= (int16_t) RAW_BUF);
capture.repeat = false;
capture.address = 0;
@@ -64,16 +75,18 @@ class IRsendTest: public IRsend {
}
void dumpRawResult() {
std::cout << "uint16_t rawbuf["<< capture.rawlen << "] =\n";
for (uint16_t i = 0; i < capture.rawlen; i++) {
std::cout << std::dec;
if (capture.rawlen == 0) return;
std::cout << "uint16_t rawbuf["<< capture.rawlen - 1 << "] = {";
for (uint16_t i = 1; i < capture.rawlen; i++) {
if (i % 8 == 1)
std::cout << std::endl << " ";
std::cout << (capture.rawbuf[i] * RAWTICK);
std::cout << "(";
std::cout << capture.rawbuf[i];
std::cout << "), ";
if (i % 8 == 7)
std::cout << "\n";
// std::cout << "(" << capture.rawbuf[i] << ")";
if (i < capture.rawlen - 1)
std::cout << ", ";
}
std::cout << "\n";
std::cout << "};" << std::endl;
}
void addGap(uint32_t usecs) {
@@ -82,6 +95,7 @@ class IRsendTest: public IRsend {
protected:
uint16_t mark(uint16_t usec) {
IRtimer::add(usec);
if (last >= OUTPUT_BUF)
return 0;
if (last & 1) // Is odd? (i.e. last call was a space())
@@ -92,6 +106,7 @@ class IRsendTest: public IRsend {
}
void space(uint32_t time) {
IRtimer::add(time);
if (last >= OUTPUT_BUF)
return;
if (last & 1) { // Is odd? (i.e. last call was a space())
@@ -101,4 +116,37 @@ class IRsendTest: public IRsend {
}
}
};
#ifdef UNIT_TEST
class IRsendLowLevelTest: public IRsend {
public:
std::string low_level_sequence;
explicit IRsendLowLevelTest(uint16_t x, bool i = false, bool j = true) :
IRsend(x, i, j) {
reset();
}
void reset() {
low_level_sequence = "";
}
protected:
void _delayMicroseconds(uint32_t usec) {
_IRtimer_unittest_now += usec;
std::ostringstream Convert;
Convert << usec;
low_level_sequence += Convert.str() + "usecs";
}
void ledOff() {
low_level_sequence += "[Off]";
}
void ledOn() {
low_level_sequence += "[On]";
}
};
#endif // UNIT_TEST
#endif // TEST_IRSEND_TEST_H_