Skip to content

Commit acc1b6b

Browse files
author
Xun Yang
committed
Fixed MATCH, MATCH_MARK, MATCH_SPACE when both IRremoteInt.h and IRremoteInt.h are included in sketch
1 parent 3f70ad2 commit acc1b6b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

IRremote.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ int MATCH_SPACE(int measured_ticks, int desired_us) {
6565
Serial.println(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
6666
return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS);
6767
}
68+
#else
69+
int MATCH(int measured, int desired) {return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);}
70+
int MATCH_MARK(int measured_ticks, int desired_us) {return MATCH(measured_ticks, (desired_us + MARK_EXCESS));}
71+
int MATCH_SPACE(int measured_ticks, int desired_us) {return MATCH(measured_ticks, (desired_us - MARK_EXCESS));}
72+
// Debugging versions are in IRremote.cpp
6873
#endif
6974

7075
void IRsend::sendNEC(unsigned long data, int nbits)

IRremoteInt.h

-7
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,6 @@
172172
#define TICKS_LOW(us) (int) (((us)*LTOL/USECPERTICK))
173173
#define TICKS_HIGH(us) (int) (((us)*UTOL/USECPERTICK + 1))
174174

175-
#ifndef DEBUG
176-
int MATCH(int measured, int desired) {return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);}
177-
int MATCH_MARK(int measured_ticks, int desired_us) {return MATCH(measured_ticks, (desired_us + MARK_EXCESS));}
178-
int MATCH_SPACE(int measured_ticks, int desired_us) {return MATCH(measured_ticks, (desired_us - MARK_EXCESS));}
179-
// Debugging versions are in IRremote.cpp
180-
#endif
181-
182175
// receiver states
183176
#define STATE_IDLE 2
184177
#define STATE_MARK 3

0 commit comments

Comments
 (0)