Skip to content

Commit 3888a3c

Browse files
committed
- Added IrReceiver.restartAfterSend() and inserted it in every send(). Closes Arduino-IRremote#989
1 parent c6cf6ac commit 3888a3c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+418
-460
lines changed

.github/workflows/LibraryBuild.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
All: -DUSE_NO_SEND_PWM
9696

9797
- arduino-boards-fqbn: arduino:avr:uno|SEND_PWM_BY_TIMER
98-
sketches-exclude: IR2Keyboard
98+
sketches-exclude: IR2Keyboard,UnitTest
9999
build-properties: # the flags were put in compiler.cpp.extra_flags
100100
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100 -DIR_SEND_PIN=3 -DSEND_PWM_BY_TIMER
101101
All: -DSEND_PWM_BY_TIMER
@@ -132,6 +132,7 @@ jobs:
132132
platform-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
133133
build-properties: # the flags were put in compiler.cpp.extra_flags
134134
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100 -DSEND_PWM_BY_TIMER
135+
All: -DRAW_BUFFER_LENGTH=700
135136

136137
- arduino-boards-fqbn: megaTinyCore:megaavr:atxy4:chip=1604,clock=16internal
137138
platform-url: http://drazzy.com/package_drazzy.com_index.json
@@ -175,49 +176,57 @@ jobs:
175176
arduino-platform: arduino:avr,MegaCore:avr # gcc is taken from arduino:avr
176177
sketches-exclude: MinimalReceiver,IRDispatcherDemo # digitalWriteFast.h not available for this board?
177178
build-properties: # the flags were put in compiler.cpp.extra_flags
178-
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
179+
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=300
180+
All: -DRAW_BUFFER_LENGTH=700
179181

180182
- arduino-boards-fqbn: esp8266:esp8266:d1_mini:eesz=4M3M,xtal=80
181183
platform-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
182184
sketches-exclude: MinimalReceiver
183185
build-properties: # the flags were put in compiler.cpp.extra_flags
184-
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
186+
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=200
187+
All: -DRAW_BUFFER_LENGTH=300
185188

186189
- arduino-boards-fqbn: esp32:esp32:featheresp32:FlashFreq=80
187190
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
188191
sketches-exclude: MinimalReceiver # undefined reference to `TwoWire::onReceive(void (*)(int))'
189192
build-properties: # the flags were put in compiler.cpp.extra_flags
190-
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
193+
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=500
194+
All: -DRAW_BUFFER_LENGTH=300
191195

192196
- arduino-boards-fqbn: STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 # ST version
193197
platform-url: https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json
194198
sketches-exclude: MinimalReceiver
195199
build-properties: # the flags were put in compiler.cpp.extra_flags
196-
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
200+
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
201+
All: -DRAW_BUFFER_LENGTH=300
197202

198203
- arduino-boards-fqbn: STMicroelectronics:stm32:GenL0:pnum=THUNDERPACK_L072 # ST version
199204
platform-url: https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json
200205
sketches-exclude: MinimalReceiver,IRDispatcherDemo
201206
build-properties: # the flags were put in compiler.cpp.extra_flags
202-
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
207+
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
208+
All: -DRAW_BUFFER_LENGTH=300
203209

204210
- arduino-boards-fqbn: stm32duino:STM32F1:genericSTM32F103C # Roger Clark version
205211
platform-url: http://dan.drown.org/stm32duino/package_STM32duino_index.json
206212
sketches-exclude: MinimalReceiver
207213
build-properties: # the flags were put in compiler.cpp.extra_flags
208-
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
214+
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
215+
All: -DRAW_BUFFER_LENGTH=300
209216

210217
- arduino-boards-fqbn: SparkFun:avr:promicro
211218
arduino-platform: arduino:avr,SparkFun:avr
212219
platform-url: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json # Arduino URL is not required here
213220
build-properties: # the flags were put in compiler.cpp.extra_flags
214-
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
221+
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
222+
All: -DRAW_BUFFER_LENGTH=300
215223

216224
- arduino-boards-fqbn: sandeepmistry:nRF5:BBCmicrobit
217225
platform-url: https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json
218226
sketches-exclude: IRDispatcherDemo,MicroGirs,MinimalReceiver
219227
build-properties: # the flags were put in compiler.cpp.extra_flags
220-
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
228+
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=700
229+
All: -DRAW_BUFFER_LENGTH=300
221230

222231
# Do not cancel all jobs / architectures if one job fails
223232
fail-fast: false

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ If you use an (old) Arduino core that does not use the `-flto` flag for compile,
100100
- Now there is an **IRreceiver** and **IRsender** object like the well known Arduino **Serial** object.
101101
- Just remove the line `IRrecv IrReceiver(IR_RECEIVE_PIN);` and/or `IRsend IrSender;` in your program, and replace all occurrences of `IRrecv.` or `irrecv.` with `IrReceiver` and replace all `IRsend` or `irsend` with `IrSender`.
102102
- Since the decoded values are now in `IrReceiver.decodedIRData` and not in `results` any more, remove the line `decode_results results` or similar.
103-
- Like for the Serial object, call [`IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/ReceiveDemo/ReceiveDemo.ino#L106)
104-
or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK);` instead of the `IrReceiver.enableIRIn();` or `irrecv.enableIRIn();` in setup(). For sending, call `IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK);` or `IrSender.begin(IR_SEND_PIN, DISABLE_LED_FEEDBACK);` in setup().
103+
- Like for the Serial object, call [`IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK)`](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/ReceiveDemo/ReceiveDemo.ino#L106)
104+
or `IrReceiver.begin(IR_RECEIVE_PIN, DISABLE_LED_FEEDBACK)` instead of the `IrReceiver.enableIRIn()` or `irrecv.enableIRIn()` in setup().<br/>
105+
For sending, call `IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK);` or `IrSender.begin(IR_SEND_PIN, DISABLE_LED_FEEDBACK);` in setup().
105106
- Old `decode(decode_results *aResults)` function is replaced by simple `decode()`. So if you have a statement `if(irrecv.decode(&results))` replace it with `if (IrReceiver.decode())`.
106107
- The decoded result is now in in `IrReceiver.decodedIRData` and not in `results` any more, therefore replace any occurrences of `results.value` and `results.decode_type` (and similar) to
107108
`IrReceiver.decodedIRData.decodedRawData` and `IrReceiver.decodedIRData.protocol`.

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-I
77
- Changed last uint8_t to uint_fast8_t and uint16_t to unsigned integer.
88
- Improved MagiQuest protocol.
99
- Improved prints and documentation.
10+
- Added IrReceiver.restartAfterSend() and inserted it in every send(). Closes #989
1011

1112
## 3.6.1
1213
- Switched Bose internal protocol timing for 0 and 1 -> old 1 timing is now 0 and vice versa.

examples/ControlRelay/ControlRelay.ino

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@
3737
#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
3838
#define EXCLUDE_EXOTIC_PROTOCOLS
3939
#endif
40-
/*
41-
* Define macros for input and output pin etc.
42-
*/
43-
#include "PinDefinitionsAndMore.h"
4440

41+
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
4542
#include <IRremote.hpp>
4643

4744
#if defined(APPLICATION_PIN)

examples/ControlRelay/PinDefinitionsAndMore.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@
4444
*/
4545
//#define _IR_MEASURE_TIMING // For debugging purposes.
4646

47-
/*
48-
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
49-
*/
50-
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
51-
#define SEND_PWM_BY_TIMER
52-
#endif
53-
5447
#if defined(ESP8266)
5548
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
5649
#define IR_RECEIVE_PIN 14 // D5
@@ -270,6 +263,14 @@ void noTone(uint8_t aPinNumber){
270263
#define _IR_TIMING_TEST_PIN 7
271264
#endif // defined(ESP8266)
272265

266+
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE) || defined(ARDUINO_ARCH_MBED)
267+
#define SEND_PWM_BY_TIMER // We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
268+
#else
269+
# if defined(SEND_PWM_BY_TIMER)
270+
#undef IR_SEND_PIN // SendPin is determined by timer! This avoids warning in IRTimer.hpp
271+
# endif
272+
#endif
273+
273274
#if !defined (FLASHEND)
274275
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
275276
#endif

examples/IRDispatcherDemo/IRDispatcherDemo.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define USE_TINY_IR_RECEIVER // Recommended, but only for NEC protocol!!! If disabled and IRMP_INPUT_PIN is defined, the IRMP library is used for decoding
3333
//#define TINY_RECEIVER_USE_ARDUINO_ATTACH_INTERRUPT // costs 112 bytes program memory + 4 bytes RAM
3434

35-
#include "PinDefinitionsAndMore.h"
35+
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
3636
// Some kind of auto detect library if USE_TINY_IR_RECEIVER is deactivated
3737
#if !defined(USE_TINY_IR_RECEIVER)
3838
# if defined(IR_RECEIVE_PIN)

examples/IRDispatcherDemo/PinDefinitionsAndMore.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@
4444
*/
4545
//#define _IR_MEASURE_TIMING // For debugging purposes.
4646

47-
/*
48-
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
49-
*/
50-
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
51-
#define SEND_PWM_BY_TIMER
52-
#endif
53-
5447
#if defined(ESP8266)
5548
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
5649
#define IR_RECEIVE_PIN 14 // D5
@@ -270,6 +263,14 @@ void noTone(uint8_t aPinNumber){
270263
#define _IR_TIMING_TEST_PIN 7
271264
#endif // defined(ESP8266)
272265

266+
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE) || defined(ARDUINO_ARCH_MBED)
267+
#define SEND_PWM_BY_TIMER // We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
268+
#else
269+
# if defined(SEND_PWM_BY_TIMER)
270+
#undef IR_SEND_PIN // SendPin is determined by timer! This avoids warning in IRTimer.hpp
271+
# endif
272+
#endif
273+
273274
#if !defined (FLASHEND)
274275
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
275276
#endif

examples/IRremoteExtensionTest/IRremoteExtensionTest.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
//#define RAW_BUFFER_LENGTH 750 // 750 is the value for air condition remotes.
88

9-
#include "PinDefinitionsAndMore.h"
10-
9+
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
1110
#include <IRremote.hpp>
1211

1312
#include "IRremoteExtensionClass.h"

examples/IRremoteExtensionTest/PinDefinitionsAndMore.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@
4444
*/
4545
//#define _IR_MEASURE_TIMING // For debugging purposes.
4646

47-
/*
48-
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
49-
*/
50-
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
51-
#define SEND_PWM_BY_TIMER
52-
#endif
53-
5447
#if defined(ESP8266)
5548
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
5649
#define IR_RECEIVE_PIN 14 // D5
@@ -270,6 +263,14 @@ void noTone(uint8_t aPinNumber){
270263
#define _IR_TIMING_TEST_PIN 7
271264
#endif // defined(ESP8266)
272265

266+
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE) || defined(ARDUINO_ARCH_MBED)
267+
#define SEND_PWM_BY_TIMER // We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
268+
#else
269+
# if defined(SEND_PWM_BY_TIMER)
270+
#undef IR_SEND_PIN // SendPin is determined by timer! This avoids warning in IRTimer.hpp
271+
# endif
272+
#endif
273+
273274
#if !defined (FLASHEND)
274275
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
275276
#endif

examples/IRremoteInfo/IRremoteInfo.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
*/
1212
#include <Arduino.h>
1313

14+
//#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 240 bytes program memory if IrSender.write is used
15+
//#define SEND_PWM_BY_TIMER
16+
//#define USE_NO_SEND_PWM
17+
//#define NO_LED_FEEDBACK_CODE // saves 566 bytes program memory
18+
1419
#include <IRremote.hpp>
1520

1621
// Function declarations for non Arduino IDE's

0 commit comments

Comments
 (0)