Skip to content

Commit f985c4b

Browse files
committed
Update IRrecvDumpV2.ino
- Cleaned up layout of output, removed trailing commas - buffer sizes are now correct - no need to add 0 for space at end, as sendRAW takes care of this
1 parent 61f00b8 commit f985c4b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/IRrecvDumpV2/IRrecvDumpV2.ino

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void dumpRaw (decode_results *results)
9090
{
9191
// Print Raw data
9292
Serial.print("Timing[");
93-
Serial.print(results->rawlen, DEC);
93+
Serial.print(results->rawlen-1, DEC);
9494
Serial.println("]: ");
9595

9696
for (int i = 1; i < results->rawlen; i++) {
@@ -106,7 +106,7 @@ void dumpRaw (decode_results *results)
106106
if (x < 1000) Serial.print(" ") ;
107107
if (x < 100) Serial.print(" ") ;
108108
Serial.print(x, DEC);
109-
Serial.print(", ");
109+
if (i < results->rawlen-1) Serial.print(", "); //',' not needed for last one
110110
}
111111
if (!(i % 8)) Serial.println("");
112112
}
@@ -121,18 +121,18 @@ void dumpCode (decode_results *results)
121121
// Start declaration
122122
Serial.print("unsigned int "); // variable type
123123
Serial.print("rawData["); // array name
124-
Serial.print(results->rawlen + 1, DEC); // array size
124+
Serial.print(results->rawlen - 1, DEC); // array size
125125
Serial.print("] = {"); // Start declaration
126126

127127
// Dump data
128128
for (int i = 1; i < results->rawlen; i++) {
129129
Serial.print(results->rawbuf[i] * USECPERTICK, DEC);
130-
Serial.print(",");
130+
if ( i < results->rawlen-1 ) Serial.print(","); // ',' not needed on last one
131131
if (!(i & 1)) Serial.print(" ");
132132
}
133133

134134
// End declaration
135-
Serial.print("0};"); // Turn LED off at the end
135+
Serial.print("};"); //
136136

137137
// Comment
138138
Serial.print(" // ");

0 commit comments

Comments
 (0)