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
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* IRremoteESP8266: IRrecvDumpV2 - dump details of IR codes with IRrecv
|
||||
* An IR detector/demodulator must be connected to the input RECV_PIN.
|
||||
* An IR detector/demodulator must be connected to the input kRecvPin.
|
||||
*
|
||||
* Copyright 2009 Ken Shirriff, http://arcfn.com
|
||||
* Copyright 2017 David Conran
|
||||
@@ -9,6 +9,8 @@
|
||||
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-receiving
|
||||
*
|
||||
* Changes:
|
||||
* Version 0.4 July, 2018
|
||||
* - Minor improvements and more A/C unit support.
|
||||
* Version 0.3 November, 2017
|
||||
* - Support for A/C decoding for some protcols.
|
||||
* Version 0.2 April, 2017
|
||||
@@ -20,36 +22,43 @@
|
||||
#ifndef UNIT_TEST
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
#include <IRremoteESP8266.h>
|
||||
#include <IRrecv.h>
|
||||
#include <IRremoteESP8266.h>
|
||||
#include <IRutils.h>
|
||||
#if DECODE_AC
|
||||
// The following are only needed for extended decoding of A/C Messages
|
||||
#include <ir_Coolix.h>
|
||||
#include <ir_Daikin.h>
|
||||
#include <ir_Fujitsu.h>
|
||||
#include <ir_Gree.h>
|
||||
#include <ir_Haier.h>
|
||||
#include <ir_Hitachi.h>
|
||||
#include <ir_Kelvinator.h>
|
||||
#include <ir_Midea.h>
|
||||
#include <ir_Mitsubishi.h>
|
||||
#include <ir_Panasonic.h>
|
||||
#include <ir_Samsung.h>
|
||||
#include <ir_Toshiba.h>
|
||||
#endif // DECODE_AC
|
||||
#include <ir_Vestel.h>
|
||||
#include <ir_Whirlpool.h>
|
||||
|
||||
|
||||
// ==================== start of TUNEABLE PARAMETERS ====================
|
||||
// An IR detector/demodulator is connected to GPIO pin 14
|
||||
// e.g. D5 on a NodeMCU board.
|
||||
#define RECV_PIN 14
|
||||
const uint16_t kRecvPin = 14;
|
||||
|
||||
// The Serial connection baud rate.
|
||||
// i.e. Status message will be sent to the PC at this baud rate.
|
||||
// Try to avoid slow speeds like 9600, as you will miss messages and
|
||||
// cause other problems. 115200 (or faster) is recommended.
|
||||
// NOTE: Make sure you set your Serial Monitor to the same speed.
|
||||
#define BAUD_RATE 115200
|
||||
const uint32_t kBaudRate = 115200;
|
||||
|
||||
// As this program is a special purpose capture/decoder, let us use a larger
|
||||
// than normal buffer so we can handle Air Conditioner remote codes.
|
||||
#define CAPTURE_BUFFER_SIZE 1024
|
||||
const uint16_t kCaptureBufferSize = 1024;
|
||||
|
||||
// TIMEOUT is the Nr. of milli-Seconds of no-more-data before we consider a
|
||||
// kTimeout is the Nr. of milli-Seconds of no-more-data before we consider a
|
||||
// message ended.
|
||||
// This parameter is an interesting trade-off. The longer the timeout, the more
|
||||
// complex a message it can capture. e.g. Some device protocols will send
|
||||
@@ -61,33 +70,34 @@
|
||||
// them is often also around 20+ms. This can result in the raw data be 2-3+
|
||||
// times larger than needed as it has captured 2-3+ messages in a single
|
||||
// capture. Setting a low timeout value can resolve this.
|
||||
// So, choosing the best TIMEOUT value for your use particular case is
|
||||
// So, choosing the best kTimeout value for your use particular case is
|
||||
// quite nuanced. Good luck and happy hunting.
|
||||
// NOTE: Don't exceed MAX_TIMEOUT_MS. Typically 130ms.
|
||||
// NOTE: Don't exceed kMaxTimeoutMs. Typically 130ms.
|
||||
#if DECODE_AC
|
||||
#define TIMEOUT 50U // Some A/C units have gaps in their protocols of ~40ms.
|
||||
// e.g. Kelvinator
|
||||
// A value this large may swallow repeats of some protocols
|
||||
#else // DECODE_AC
|
||||
#define TIMEOUT 15U // Suits most messages, while not swallowing many repeats.
|
||||
// Some A/C units have gaps in their protocols of ~40ms. e.g. Kelvinator
|
||||
// A value this large may swallow repeats of some protocols
|
||||
const uint8_t kTimeout = 50;
|
||||
#else // DECODE_AC
|
||||
// Suits most messages, while not swallowing many repeats.
|
||||
const uint8_t kTimeout = 15;
|
||||
#endif // DECODE_AC
|
||||
// Alternatives:
|
||||
// #define TIMEOUT 90U // Suits messages with big gaps like XMP-1 & some aircon
|
||||
// units, but can accidentally swallow repeated messages
|
||||
// in the rawData[] output.
|
||||
// #define TIMEOUT MAX_TIMEOUT_MS // This will set it to our currently allowed
|
||||
// maximum. Values this high are problematic
|
||||
// because it is roughly the typical boundary
|
||||
// where most messages repeat.
|
||||
// e.g. It will stop decoding a message and
|
||||
// start sending it to serial at precisely
|
||||
// the time when the next message is likely
|
||||
// to be transmitted, and may miss it.
|
||||
// const uint8_t kTimeout = 90;
|
||||
// Suits messages with big gaps like XMP-1 & some aircon units, but can
|
||||
// accidentally swallow repeated messages in the rawData[] output.
|
||||
//
|
||||
// const uint8_t kTimeout = kMaxTimeoutMs;
|
||||
// This will set it to our currently allowed maximum.
|
||||
// Values this high are problematic because it is roughly the typical boundary
|
||||
// where most messages repeat.
|
||||
// e.g. It will stop decoding a message and start sending it to serial at
|
||||
// precisely the time when the next message is likely to be transmitted,
|
||||
// and may miss it.
|
||||
|
||||
// Set the smallest sized "UNKNOWN" message packets we actually care about.
|
||||
// This value helps reduce the false-positive detection rate of IR background
|
||||
// noise as real messages. The chances of background IR noise getting detected
|
||||
// as a message increases with the length of the TIMEOUT value. (See above)
|
||||
// as a message increases with the length of the kTimeout value. (See above)
|
||||
// The downside of setting this message too large is you can miss some valid
|
||||
// short messages for protocols that this library doesn't yet decode.
|
||||
//
|
||||
@@ -96,12 +106,11 @@
|
||||
// Set lower if you are sure your setup is working, but it doesn't see messages
|
||||
// from your device. (e.g. Other IR remotes work.)
|
||||
// NOTE: Set this value very high to effectively turn off UNKNOWN detection.
|
||||
#define MIN_UNKNOWN_SIZE 12
|
||||
const uint16_t kMinUnknownSize = 12;
|
||||
// ==================== end of TUNEABLE PARAMETERS ====================
|
||||
|
||||
|
||||
// Use turn on the save buffer feature for more complete capture coverage.
|
||||
IRrecv irrecv(RECV_PIN, CAPTURE_BUFFER_SIZE, TIMEOUT, true);
|
||||
IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true);
|
||||
|
||||
decode_results results; // Somewhere to store the results
|
||||
|
||||
@@ -115,6 +124,13 @@ void dumpACInfo(decode_results *results) {
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_DAIKIN
|
||||
#if DECODE_DAIKIN2
|
||||
if (results->decode_type == DAIKIN2) {
|
||||
IRDaikin2 ac(0);
|
||||
ac.setRaw(results->state);
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_DAIKIN2
|
||||
#if DECODE_FUJITSU_AC
|
||||
if (results->decode_type == FUJITSU_AC) {
|
||||
IRFujitsuAC ac(0);
|
||||
@@ -129,6 +145,13 @@ void dumpACInfo(decode_results *results) {
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_KELVINATOR
|
||||
#if DECODE_MITSUBISHI_AC
|
||||
if (results->decode_type == MITSUBISHI_AC) {
|
||||
IRMitsubishiAC ac(0);
|
||||
ac.setRaw(results->state);
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_MITSUBISHI_AC
|
||||
#if DECODE_TOSHIBA_AC
|
||||
if (results->decode_type == TOSHIBA_AC) {
|
||||
IRToshibaAC ac(0);
|
||||
@@ -157,23 +180,73 @@ void dumpACInfo(decode_results *results) {
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_HAIER_AC
|
||||
#if DECODE_HAIER_AC_YRW02
|
||||
if (results->decode_type == HAIER_AC_YRW02) {
|
||||
IRHaierACYRW02 ac(0);
|
||||
ac.setRaw(results->state);
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_HAIER_AC_YRW02
|
||||
#if DECODE_SAMSUNG_AC
|
||||
if (results->decode_type == SAMSUNG_AC) {
|
||||
IRSamsungAc ac(0);
|
||||
ac.setRaw(results->state, results->bits / 8);
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_SAMSUNG_AC
|
||||
#if DECODE_COOLIX
|
||||
if (results->decode_type == COOLIX) {
|
||||
IRCoolixAC ac(0);
|
||||
ac.setRaw(results->value); // Coolix uses value instead of state.
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_COOLIX
|
||||
#if DECODE_PANASONIC_AC
|
||||
if (results->decode_type == PANASONIC_AC &&
|
||||
results->bits > kPanasonicAcShortBits) {
|
||||
IRPanasonicAc ac(0);
|
||||
ac.setRaw(results->state);
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_PANASONIC_AC
|
||||
#if DECODE_HITACHI_AC
|
||||
if (results->decode_type == HITACHI_AC) {
|
||||
IRHitachiAc ac(0);
|
||||
ac.setRaw(results->state);
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_HITACHI_AC
|
||||
#if DECODE_WHIRLPOOL_AC
|
||||
if (results->decode_type == WHIRLPOOL_AC) {
|
||||
IRWhirlpoolAc ac(0);
|
||||
ac.setRaw(results->state);
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_WHIRLPOOL_AC
|
||||
#if DECODE_VESTEL_AC
|
||||
if (results->decode_type == VESTEL_AC) {
|
||||
IRVestelAC ac(0);
|
||||
ac.setRaw(results->value); // Like Coolix, use value instead of state.
|
||||
description = ac.toString();
|
||||
}
|
||||
#endif // DECODE_VESTEL_AC
|
||||
// If we got a human-readable description of the message, display it.
|
||||
if (description != "") Serial.println("Mesg Desc.: " + description);
|
||||
if (description != "") Serial.println("Mesg Desc.: " + description);
|
||||
}
|
||||
|
||||
// The section of code run only once at start-up.
|
||||
void setup() {
|
||||
Serial.begin(BAUD_RATE, SERIAL_8N1, SERIAL_TX_ONLY);
|
||||
Serial.begin(kBaudRate, SERIAL_8N1, SERIAL_TX_ONLY);
|
||||
while (!Serial) // Wait for the serial connection to be establised.
|
||||
delay(50);
|
||||
Serial.println();
|
||||
Serial.print("IRrecvDumpV2 is now running and waiting for IR input on Pin ");
|
||||
Serial.println(RECV_PIN);
|
||||
Serial.println(kRecvPin);
|
||||
|
||||
#if DECODE_HASH
|
||||
// Ignore messages with less than minimum on or off pulses.
|
||||
irrecv.setUnknownThreshold(MIN_UNKNOWN_SIZE);
|
||||
#endif // DECODE_HASH
|
||||
irrecv.setUnknownThreshold(kMinUnknownSize);
|
||||
#endif // DECODE_HASH
|
||||
irrecv.enableIRIn(); // Start the receiver
|
||||
}
|
||||
|
||||
@@ -186,10 +259,11 @@ void loop() {
|
||||
uint32_t now = millis();
|
||||
Serial.printf("Timestamp : %06u.%03u\n", now / 1000, now % 1000);
|
||||
if (results.overflow)
|
||||
Serial.printf("WARNING: IR code is too big for buffer (>= %d). "
|
||||
"This result shouldn't be trusted until this is resolved. "
|
||||
"Edit & increase CAPTURE_BUFFER_SIZE.\n",
|
||||
CAPTURE_BUFFER_SIZE);
|
||||
Serial.printf(
|
||||
"WARNING: IR code is too big for buffer (>= %d). "
|
||||
"This result shouldn't be trusted until this is resolved. "
|
||||
"Edit & increase kCaptureBufferSize.\n",
|
||||
kCaptureBufferSize);
|
||||
// Display the basic output of what we found.
|
||||
Serial.print(resultToHumanReadableBasic(&results));
|
||||
dumpACInfo(&results); // Display any extra A/C info if we have it.
|
||||
@@ -207,6 +281,6 @@ void loop() {
|
||||
// Output the results as source code
|
||||
Serial.println(resultToSourceCode(&results));
|
||||
Serial.println(""); // Blank line between entries
|
||||
yield(); // Feed the WDT (again)
|
||||
yield(); // Feed the WDT (again)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user