Skip to content

Commit ed1a2a2

Browse files
Update IRremote.cpp to improve debugging
This is a small change, and definitely an improvement. I simply improved the debugging by stating whether a check passed or failed, for easier identification in debug mode.
1 parent e3ec11d commit ed1a2a2

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

IRremote.cpp

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ int MATCH (int measured, int desired)
4646
DBG_PRINT(" <= ");
4747
DBG_PRINT(measured, DEC);
4848
DBG_PRINT(" <= ");
49-
DBG_PRINTLN(TICKS_HIGH(desired), DEC);
49+
DBG_PRINT(TICKS_HIGH(desired), DEC);
5050

51-
return ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
51+
bool passed = ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
52+
if (passed)
53+
DBG_PRINTLN("; passed");
54+
else
55+
DBG_PRINTLN("; FAILED");
56+
return passed;
5257
}
5358

5459
//+========================================================
@@ -65,10 +70,15 @@ int MATCH_MARK (int measured_ticks, int desired_us)
6570
DBG_PRINT(" <= ");
6671
DBG_PRINT(measured_ticks, DEC);
6772
DBG_PRINT(" <= ");
68-
DBG_PRINTLN(TICKS_HIGH(desired_us + MARK_EXCESS), DEC);
73+
DBG_PRINT(TICKS_HIGH(desired_us + MARK_EXCESS), DEC);
6974

70-
return ((measured_ticks >= TICKS_LOW (desired_us + MARK_EXCESS))
71-
&& (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS)));
75+
bool passed = ((measured_ticks >= TICKS_LOW (desired_us + MARK_EXCESS))
76+
&& (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS)));
77+
if (passed)
78+
DBG_PRINTLN("; passed");
79+
else
80+
DBG_PRINTLN("; FAILED");
81+
return passed;
7282
}
7383

7484
//+========================================================
@@ -85,10 +95,15 @@ int MATCH_SPACE (int measured_ticks, int desired_us)
8595
DBG_PRINT(" <= ");
8696
DBG_PRINT(measured_ticks, DEC);
8797
DBG_PRINT(" <= ");
88-
DBG_PRINTLN(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
98+
DBG_PRINT(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
8999

90-
return ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
91-
&& (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
100+
bool passed = ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
101+
&& (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
102+
if (passed)
103+
DBG_PRINTLN("; passed");
104+
else
105+
DBG_PRINTLN("; FAILED");
106+
return passed;
92107
}
93108

94109
//+=============================================================================

0 commit comments

Comments
 (0)