Skip to content

Commit 1acdcce

Browse files
committed
cleaned up IRremote(Int).h
1 parent 090358a commit 1acdcce

File tree

9 files changed

+199
-219
lines changed

9 files changed

+199
-219
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ If you do not know which protocol your IR transmitter uses, you have several cho
8181
the old [IRLib](https://github.com/cyborg5/IRLib) and [Infrared4Arduino](https://github.com/bengtmartensson/Infrared4Arduino).
8282
- To **increase strength of sent output signal** you can increase the current through the send diode, and/or use 2 diodes in series,
8383
since one IR diode requires only 1.5 volt.
84-
- The default software generated PWM has problems on ATtinies running with 8 MHz. The PWM frequency is around 30 instead of 38 kHz and RC6 is not reliable.
84+
- Activating line #include "ATtinySerialOut.h" in PinDefinitionsAndMore.h (requires the library to be installed) saves 370 bytes program space and 38 bytes RAM for **Digispark boards** as well as enables serial output at 8MHz.
85+
- The default software generated PWM has **problems on ATtinies running with 8 MHz**. The PWM frequency is around 30 instead of 38 kHz and RC6 is not reliable. You can switch to timer PWM generation by `#define SEND_PWM_BY_TIMER`.
8586

8687
# Examples
8788
### SimpleReceiver + SimpleSender
@@ -115,11 +116,11 @@ Modify it by commenting them out or in, or change the values if applicable. Or d
115116
| `USE_NO_SEND_PWM` | Before `#include <IRremote.h>` | disabled | Use no carrier PWM, just simulate an active low receiver signal. |
116117
| `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. |
117118
| `DISABLE_LED_FEEDBACK_FOR_RECEIVE` | Before `#include <IRremote.h>` | disabled | This disables the LED feedback code for receive, thus saving around 108 bytes program space and halving the receiver ISR processing time. |
118-
| `IR_INPUT_IS_ACTIVE_HIGH` | IRremoteInt.h | disabled | Enable it if you use a RF receiver, which has an active HIGH output signal. |
119+
| `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. |
119120
| `RAW_BUFFER_LENGTH` | IRremoteint.h | 101 | Buffer size of raw input buffer. Must be odd! |
120121
| `DEBUG` | IRremoteInt.h | disabled | Enables lots of lovely debug output. |
121-
| `IR_SEND_DUTY_CYCLE` | IRBoardDefs.h | 30 | Duty cycle of IR send signal. |
122-
| `MICROS_PER_TICK` | IRBoardDefs.h | 50 | Resolution of the raw input buffer data. |
122+
| `IR_SEND_DUTY_CYCLE` | IRremoteint.h | 30 | Duty cycle of IR send signal. |
123+
| `MICROS_PER_TICK` | IRremoteint.h | 50 | Resolution of the raw input buffer data. |
123124
|-|-|-|-|
124125
| `IR_INPUT_PIN` | TinyIRReceiver.h | 2 | The pin number for TinyIRReceiver IR input, which gets compiled in. |
125126
| `IR_FEEDBACK_LED_PIN` | TinyIRReceiver.h | `LED_BUILTIN` | The pin number for TinyIRReceiver feedback LED, which gets compiled in. |

src/IRSend.cpp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ size_t IRsend::write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats) {
152152
sendBoseWave(tCommand, aNumberOfRepeats);
153153

154154
} else if (tProtocol == LEGO_PF) {
155-
sendLegoPowerFunctions(aIRSendData); // send 5 autorepeats
155+
sendLegoPowerFunctions(tAddress, tCommand, tCommand >> 4, tSendRepeat); // send 5 autorepeats
156156
#endif
157157

158158
}

src/IRremote.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
#ifndef IRremote_h
4242
#define IRremote_h
4343

44+
#define VERSION_IRREMOTE "3.1.0"
45+
#define VERSION_IRREMOTE_MAJOR 3
46+
#define VERSION_IRREMOTE_MINOR 1
47+
4448
/*
4549
* If activated, BOSEWAVE, MAGIQUEST,WHYNTER and LEGO_PF are excluded in decoding and in sending with IrSender.write
4650
*/
@@ -84,6 +88,16 @@
8488
#warning "The macros DECODE_XXX no longer require a value. Decoding is now switched by defining / non defining the macro."
8589
#endif
8690

91+
/****************************************************
92+
* For better readability of code
93+
****************************************************/
94+
#define DISABLE_LED_FEEDBACK false
95+
#define ENABLE_LED_FEEDBACK true
96+
#define USE_DEFAULT_FEEDBACK_LED_PIN 0
97+
98+
/****************************************************
99+
* RECEIVING
100+
****************************************************/
87101
/**
88102
* MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding,
89103
* to compensate for the signal forming of different IR receiver modules
@@ -104,6 +118,30 @@
104118
#define MARK_EXCESS_MICROS 20
105119
#endif
106120

121+
/**
122+
* Minimum gap between IR transmissions, in microseconds
123+
* Keep in mind that this is the delay between the end of the received command and the start of decoding
124+
* and some of the protocols have gaps of around 20 ms.
125+
*/
126+
#if !defined(RECORD_GAP_MICROS)
127+
#define RECORD_GAP_MICROS 5000 // FREDRICH28AC header space is 9700, NEC header space is 4500
128+
#endif
129+
/** Minimum gap between IR transmissions, in MICROS_PER_TICK */
130+
#define RECORD_GAP_TICKS (RECORD_GAP_MICROS / MICROS_PER_TICK) // 221 for 1100
131+
132+
/*
133+
* Activate this line if your receiver has an external output driver transistor / "inverted" output
134+
*/
135+
//#define IR_INPUT_IS_ACTIVE_HIGH
136+
#ifdef IR_INPUT_IS_ACTIVE_HIGH
137+
// IR detector output is active high
138+
#define MARK 1 ///< Sensor output for a mark ("flash")
139+
#define SPACE 0 ///< Sensor output for a space ("gap")
140+
#else
141+
// IR detector output is active low
142+
#define MARK 0 ///< Sensor output for a mark ("flash")
143+
#define SPACE 1 ///< Sensor output for a space ("gap")
144+
#endif
107145
/****************************************************
108146
* SENDING
109147
****************************************************/

0 commit comments

Comments
 (0)