Skip to content

Commit 22451e7

Browse files
committed
Bumped version to 3.3.0. Added lastDecodedProtocol and CheckForRecordGapsMicros().
1 parent fff3d94 commit 22451e7

26 files changed

+409
-356
lines changed

.github/workflows/LibraryBuild.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ jobs:
109109
- arduino-boards-fqbn: digistump:avr:digispark-tiny:clock=clock1
110110
platform-url: https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
111111
required-libraries: ATtinySerialOut
112-
sketches-exclude: UnitTest,ControlRelay,ReceiveAndSend,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis,IRremoteExtensionTest # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
112+
sketches-exclude: UnitTest,ControlRelay,ReceiveAndSend,SendAndReceive,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis,IRremoteExtensionTest # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
113113
build-properties: # the flags were put in compiler.cpp.extra_flags
114114
All: -DEXCLUDE_EXOTIC_PROTOCOLS -DEXCLUDE_UNIVERSAL_PROTOCOLS
115115

116116
- arduino-boards-fqbn: digistump:avr:MHETtiny88 # ATtiny88 China clone board @16 MHz
117117
platform-url: https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
118118
required-libraries: ATtinySerialOut
119-
sketches-exclude: UnitTest,ControlRelay,ReceiveAndSend,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis,IRremoteExtensionTest # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
119+
sketches-exclude: UnitTest,ControlRelay,ReceiveAndSend,SendAndReceive,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis,IRremoteExtensionTest # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
120120
build-properties: # the flags were put in compiler.cpp.extra_flags
121121
All: -DEXCLUDE_EXOTIC_PROTOCOLS -DEXCLUDE_UNIVERSAL_PROTOCOLS
122122

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ If you see something like `Protocol=UNKNOWN Hash=0x13BD886C 35 bits received` as
122122
- If you have an **odd number of bits** received, it is likely, that your receiver circuit has problems. Maybe because the IR signal is too weak.
123123
- If you see timings like `+ 600,- 600 + 550,- 150 + 200,- 100 + 750,- 550` then one 450 µs space was split into two 150 and 100 µs spaces with a spike / error signal of 200 µs between. Maybe because of a defective receiver or a weak signal in conjunction with another light emitting source nearby.
124124
- If you see timings like `+ 500,- 550 + 450,- 550 + 500,- 500 + 500,-1550`, then marks are generally shorter than spaces and therefore `MARK_EXCESS_MICROS` (specified in your ino file) should be **negative** to compensate for this at decoding.
125-
- If you see rawData[2] it may be that the space after the initial mark is longer than [`RECORD_GAP_MICROS`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremote.h#L127). This was observed for some LG air conditioner protocols. Try again with a line e.g. `#define RECORD_GAP_MICROS 12000` before `#include <IRremote.h>` in yout ino file.
125+
- If you see `Protocol=UNKNOWN Hash=0x0 1 bits received` it may be that the space after the initial mark is longer than [`RECORD_GAP_MICROS`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremote.h#L124). This was observed for some LG air conditioner protocols. Try again with a line e.g. `#define RECORD_GAP_MICROS 12000` before the line `#include <IRremote.h>` in your ino file.
126126
- To see more info supporting you to find the reason for your UNKNOWN protocol, you must enable the line `//#define DEBUG` in IRremoteInt.h.
127127

128128
## How to deal with protocols not supported by IRremote
@@ -179,11 +179,11 @@ Modify it by commenting them out or in, or change the values if applicable. Or d
179179
|-|-|-|-|
180180
| `SEND_PWM_BY_TIMER` | Before `#include <IRremote.h>` | disabled | Disable carrier PWM generation in software and use (restricted) hardware PWM except for ESP32 where both modes are using the flexible `hw_timer_t`. |
181181
| `USE_NO_SEND_PWM` | Before `#include <IRremote.h>` | disabled | Use no carrier PWM, just simulate an active low receiver signal. Overrides `SEND_PWM_BY_TIMER` definition. |
182-
| `RECORD_GAP_MICROS` | Before `#include <IRremote.h>` | 5000 | Minimum gap between IR transmissions, to detect the end of a protocol.<br/>Must be greater than any space of a protocol e.g. the NEC header space of 4500 us.<br/>Must be smaller than any gap between a command and a repeat e.g. the retransmission gap for Sony is around 24 ms.<br/>Keep in mind that this is the delay between the end of the received command and the start of decoding. |
183182
| `NO_LEGACY_COMPATIBILITY` | IRremoteInt.h | disabled | Disables the old decoder for version 2.x compatibility, where all protocols -especially NEC, Panasonic, Sony, Samsung and JVC- were MSB first. Saves around 60 bytes program space and 14 bytes RAM. |
184183
| `EXCLUDE_EXOTIC_PROTOCOLS` | Before `#include <IRremote.h>` | disabled | If activated, BOSEWAVE, MAGIQUEST,WHYNTER and LEGO_PF are excluded in `decode()` and in sending with `IrSender.write()`. Saves up to 900 bytes program space. |
185184
| `EXCLUDE_UNIVERSAL_PROTOCOLS` | Before `#include <IRremote.h>` | disabled | If activated, the universal decoder for pulse width or pulse distance protocols and decodeHash (special decoder for all protocols) are excluded in `decode()`. Saves up to 1000 bytes program space. |
186185
| `MARK_EXCESS_MICROS` | Before `#include <IRremote.h>` | 20 | MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding, to compensate for the signal forming of different IR receiver modules. |
186+
| `RECORD_GAP_MICROS` | Before `#include <IRremote.h>` | 5000 | Minimum gap between IR transmissions, to detect the end of a protocol.<br/>Must be greater than any space of a protocol e.g. the NEC header space of 4500 us.<br/>Must be smaller than any gap between a command and a repeat; e.g. the retransmission gap for Sony is around 24 ms.<br/>Keep in mind, that this is the delay between the end of the received command and the start of decoding. |
187187
| `FEEDBACK_LED_IS_ACTIVE_LOW` | Before `#include <IRremote.h>` | disabled | Required on some boards (like my BluePill and my ESP8266 board), where the feedback LED is active low. |
188188
| `DISABLE_LED_FEEDBACK_FOR_RECEIVE` | Before `#include <IRremote.h>` | disabled | This completely disables the LED feedback code for receive, thus saving around 108 bytes program space and halving the receiver ISR processing time. |
189189
| `IR_INPUT_IS_ACTIVE_HIGH` | Before `#include <IRremote.h>` | disabled | Enable it if you use a RF receiver, which has an active HIGH output signal. |

examples/ReceiveDemo/ReceiveDemo.ino

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
// to compensate for the signal forming of different IR receiver modules.
5555
#define MARK_EXCESS_MICROS 20 // 20 is recommended for the cheap VS1838 modules
5656

57-
//#define DEBUG // Activate this for lots of lovely debug outputs.
5857
//#define RECORD_GAP_MICROS 12000 // Activate it for some LG air conditioner protocols
5958

6059
/*
@@ -112,6 +111,8 @@ void setup() {
112111
#endif
113112

114113
// infos for receive
114+
Serial.print(RECORD_GAP_MICROS);
115+
Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed"));
115116
Serial.print(MARK_EXCESS_MICROS);
116117
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
117118
}
@@ -154,13 +155,17 @@ void loop() {
154155
}
155156

156157
# if !defined(ESP32) && !defined(ESP8266) && !defined(NRF5)
157-
/*
158-
* Play tone, wait and restore IR timer
159-
*/
160-
IrReceiver.stop();
161-
tone(TONE_PIN, 2200, 10);
162-
delay(8);
163-
IrReceiver.start(8000); // to compensate for 11 ms stop of receiver. This enables a correct gap measurement.
158+
if (IrReceiver.decodedIRData.protocol != UNKNOWN) {
159+
/*
160+
* Play tone, wait and restore IR timer, if a valid protocol was received
161+
* Otherwise do not disturb the detection of the gap between transmissions. This will give
162+
* the next printIRResult* call a chance to report about changing the RECORD_GAP_MICROS value.
163+
*/
164+
IrReceiver.stop();
165+
tone(TONE_PIN, 2200, 10);
166+
delay(8);
167+
IrReceiver.start(8000); // to compensate for 8 ms stop of receiver. This enables a correct gap measurement.
168+
}
164169
# endif
165170
#endif // FLASHEND > 0x1FFF
166171

examples/ReceiveDump/ReceiveDump.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
*/
4646
#define MARK_EXCESS_MICROS 20 // recommended for the cheap VS1838 modules
4747

48-
//#define DEBUG // Activate this for lots of lovely debug outputs.
4948
//#define RECORD_GAP_MICROS 12000 // Activate it for some LG air conditioner protocols
5049
#include <IRremote.h>
5150

examples/SendAndReceive/SendAndReceive.cpp renamed to examples/SendAndReceive/SendAndReceive.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ void setup() {
9292
Serial.println(F(" us"));
9393

9494
// infos for receive
95+
Serial.print(RECORD_GAP_MICROS);
96+
Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed"));
9597
Serial.print(MARK_EXCESS_MICROS);
9698
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
9799
#endif

examples/UnitTest/UnitTest.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
#define DECODE_RC5
5353
#define DECODE_RC6
5454
#define DECODE_PANASONIC // the same as DECODE_KASEIKYO
55-
#define DECODE_SAMSUNG
5655
#define DECODE_LG
5756

5857
#define DECODE_DISTANCE // universal decoder for pulse width or pulse distance protocols
5958
#define DECODE_HASH // special decoder for all protocols
6059
#endif
6160

6261
#if FLASHEND >= 0x7FFF // Additional code for less equal than 32k flash, like ATmega328
62+
#define DECODE_SAMSUNG
6363

6464
#define DECODE_BOSEWAVE
6565
#define DECODE_LEGO_PF
@@ -70,7 +70,6 @@
7070
//#define SEND_PWM_BY_TIMER
7171
//#define USE_NO_SEND_PWM
7272
//#define IR_MEASURE_TIMING
73-
//#define DEBUG // Activate this for lots of lovely debug outputs.
7473
#define MARK_EXCESS_MICROS 10 // Adapt it to your IR receiver module. See also IRremote.h.
7574
#define DISABLE_LED_FEEDBACK_FOR_RECEIVE // halves ISR duration
7675

@@ -132,6 +131,8 @@ void setup() {
132131
Serial.println(F(" us"));
133132

134133
// infos for receive
134+
Serial.print(RECORD_GAP_MICROS);
135+
Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed"));
135136
Serial.print(MARK_EXCESS_MICROS);
136137
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
137138
#endif

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "git",
88
"url": "https://github.com/z3t0/Arduino-IRremote.git"
99
},
10-
"version": "3.2.0",
10+
"version": "3.3.0",
1111
"frameworks": "arduino",
1212
"platforms": ["atmelavr", "atmelmegaavr", "atmelsam", "espressif8266", "espressif32", "ststm32"],
1313
"authors" :

src/IRProtocol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
*/
3939
typedef enum {
4040
UNKNOWN = 0,
41+
PULSE_DISTANCE,
42+
PULSE_WIDTH,
4143
DENON,
4244
DISH,
4345
JVC,
@@ -56,8 +58,6 @@ typedef enum {
5658
SONY,
5759
ONKYO,
5860
APPLE,
59-
PULSE_DISTANCE,
60-
PULSE_WIDTH,
6161
BOSEWAVE,
6262
LEGO_PF,
6363
MAGIQUEST,

0 commit comments

Comments
 (0)