From 91dad6238a5b371452ed100b47da5bdfb66aea2b Mon Sep 17 00:00:00 2001 From: Xun Yang Date: Fri, 14 Jun 2013 17:15:28 +0200 Subject: [PATCH] Fixed MATCH, MATCH_MARK, MATCH_SPACE when both IRremoteInt.h and IRremoteInt.h are included in sketch --- IRremote.cpp | 5 +++++ IRremoteInt.h | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/IRremote.cpp b/IRremote.cpp index 21a5acb..0b7092c 100644 --- a/IRremote.cpp +++ b/IRremote.cpp @@ -65,6 +65,11 @@ int MATCH_SPACE(int measured_ticks, int desired_us) { Serial.println(TICKS_HIGH(desired_us - MARK_EXCESS), DEC); return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS); } +#else +int MATCH(int measured, int desired) {return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);} +int MATCH_MARK(int measured_ticks, int desired_us) {return MATCH(measured_ticks, (desired_us + MARK_EXCESS));} +int MATCH_SPACE(int measured_ticks, int desired_us) {return MATCH(measured_ticks, (desired_us - MARK_EXCESS));} +// Debugging versions are in IRremote.cpp #endif void IRsend::sendNEC(unsigned long data, int nbits) diff --git a/IRremoteInt.h b/IRremoteInt.h index e6bcd00..0efdbdd 100644 --- a/IRremoteInt.h +++ b/IRremoteInt.h @@ -172,13 +172,6 @@ #define TICKS_LOW(us) (int) (((us)*LTOL/USECPERTICK)) #define TICKS_HIGH(us) (int) (((us)*UTOL/USECPERTICK + 1)) -#ifndef DEBUG -int MATCH(int measured, int desired) {return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);} -int MATCH_MARK(int measured_ticks, int desired_us) {return MATCH(measured_ticks, (desired_us + MARK_EXCESS));} -int MATCH_SPACE(int measured_ticks, int desired_us) {return MATCH(measured_ticks, (desired_us - MARK_EXCESS));} -// Debugging versions are in IRremote.cpp -#endif - // receiver states #define STATE_IDLE 2 #define STATE_MARK 3