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:
1 parent
0180a0dbd5
commit
f0305236db
149 files changed
+20957
-7850
No files matched your search
@@ -11,24 +11,25 @@
|
||||
#include "IRsend_test.h"
|
||||
#include "IRutils.h"
|
||||
|
||||
#define MAX_GC_CODE_LENGTH 10000
|
||||
const uint16_t kMaxGcCodeLength = 10000;
|
||||
|
||||
void str_to_uint16(char *str, uint16_t *res, uint8_t base) {
|
||||
char *end;
|
||||
errno = 0;
|
||||
intmax_t val = strtoimax(str, &end, base);
|
||||
if (errno == ERANGE || val < 0 || val > UINT16_MAX ||
|
||||
end == str || *end != '\0')
|
||||
if (errno == ERANGE || val < 0 || val > UINT16_MAX || end == str ||
|
||||
*end != '\0')
|
||||
return;
|
||||
*res = (uint16_t) val;
|
||||
*res = (uint16_t)val;
|
||||
}
|
||||
|
||||
void usage_error(char * name) {
|
||||
void usage_error(char *name) {
|
||||
std::cerr << "Usage: " << name << " [-raw] <global_code>" << std::endl
|
||||
<< "Usage: " << name << " -prontohex [-raw] <prontohex_code>" << std::endl;
|
||||
<< "Usage: " << name << " -prontohex [-raw] <prontohex_code>"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
int main(int argc, char *argv[]) {
|
||||
int argv_offset = 1;
|
||||
bool dumpraw = false;
|
||||
bool prontohex = false;
|
||||
@@ -52,7 +53,7 @@ int main(int argc, char * argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint16_t gc_test[MAX_GC_CODE_LENGTH];
|
||||
uint16_t gc_test[kMaxGcCodeLength];
|
||||
int index = 0;
|
||||
char *pch;
|
||||
char *saveptr1;
|
||||
@@ -60,12 +61,12 @@ int main(int argc, char * argv[]) {
|
||||
int codebase = 10;
|
||||
|
||||
if (prontohex) {
|
||||
sep = const_cast<char *>(" ");
|
||||
codebase = 16;
|
||||
sep = const_cast<char *>(" ");
|
||||
codebase = 16;
|
||||
}
|
||||
|
||||
pch = strtok_r(argv[argv_offset], sep, &saveptr1);
|
||||
while (pch != NULL && index < MAX_GC_CODE_LENGTH) {
|
||||
while (pch != NULL && index < kMaxGcCodeLength) {
|
||||
str_to_uint16(pch, &gc_test[index], codebase);
|
||||
pch = strtok_r(NULL, sep, &saveptr1);
|
||||
index++;
|
||||
@@ -77,32 +78,32 @@ int main(int argc, char * argv[]) {
|
||||
irsend.reset();
|
||||
|
||||
if (prontohex) {
|
||||
irsend.sendPronto(gc_test, index);
|
||||
irsend.sendPronto(gc_test, index);
|
||||
} else {
|
||||
irsend.sendGC(gc_test, index);
|
||||
irsend.sendGC(gc_test, index);
|
||||
}
|
||||
irsend.makeDecodeResult();
|
||||
irrecv.decode(&irsend.capture);
|
||||
|
||||
std::cout << "Code length " << index << std::endl
|
||||
<< "Code type " << irsend.capture.decode_type
|
||||
<< " (" << typeToString(irsend.capture.decode_type) << ")" << std::endl
|
||||
<< "Code bits " << irsend.capture.bits << std::endl;
|
||||
<< "Code type " << irsend.capture.decode_type << " ("
|
||||
<< typeToString(irsend.capture.decode_type) << ")" << std::endl
|
||||
<< "Code bits " << irsend.capture.bits << std::endl;
|
||||
if (hasACState(irsend.capture.decode_type)) {
|
||||
std::cout << "State value 0x";
|
||||
for (uint16_t i = 0; i < irsend.capture.bits / 8; i++)
|
||||
printf("%02X", irsend.capture.state[i]);
|
||||
std::cout << std::endl;
|
||||
} else {
|
||||
std::cout << "Code value 0x" <<
|
||||
std::hex << irsend.capture.value << std::endl <<
|
||||
"Code address 0x" << std::hex << irsend.capture.address << std::endl
|
||||
<< "Code command 0x" << std::hex << irsend.capture.command <<
|
||||
std::endl;
|
||||
std::cout << "Code value 0x" << std::hex << irsend.capture.value
|
||||
<< std::endl
|
||||
<< "Code address 0x" << std::hex << irsend.capture.address
|
||||
<< std::endl
|
||||
<< "Code command 0x" << std::hex << irsend.capture.command
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
if (dumpraw || irsend.capture.decode_type == UNKNOWN)
|
||||
irsend.dumpRawResult();
|
||||
if (dumpraw || irsend.capture.decode_type == UNKNOWN) irsend.dumpRawResult();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user