Skip to content

Commit bd72084

Browse files
committed
Bug fixes as per Issue #167
Have updated IRrecvDdump to fix bugs described in Issue: #167 In summary, removed bug where large space values were displayed incorrectly & confusing users. The output now always starts with a mark, instead of a space, which makes it easier to interpret and less confusing for users. refer to #167 for more detials. The update has been tested with several protocols (but not all) and verified as working.
1 parent 339a796 commit bd72084

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

examples/IRrecvDump/IRrecvDump.ino

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010

1111
#include <IRremote.h>
1212

13-
int RECV_PIN = 11;
13+
/*
14+
* Default is Arduino pin D11.
15+
* You can change this to another available Arduino Pin.
16+
* Your IR receiver should be connected to the pin defined here
17+
*/
18+
int RECV_PIN = 11;
1419

1520
IRrecv irrecv(RECV_PIN);
1621

@@ -22,18 +27,17 @@ void setup()
2227
irrecv.enableIRIn(); // Start the receiver
2328
}
2429

25-
// Dumps out the decode_results structure.
26-
// Call this after IRrecv::decode()
27-
// void * to work around compiler issue
28-
//void dump(void *v) {
29-
// decode_results *results = (decode_results *)v
30+
3031
void dump(decode_results *results) {
32+
// Dumps out the decode_results structure.
33+
// Call this after IRrecv::decode()
3134
int count = results->rawlen;
3235
if (results->decode_type == UNKNOWN) {
3336
Serial.print("Unknown encoding: ");
3437
}
3538
else if (results->decode_type == NEC) {
3639
Serial.print("Decoded NEC: ");
40+
3741
}
3842
else if (results->decode_type == SONY) {
3943
Serial.print("Decoded SONY: ");
@@ -46,21 +50,20 @@ void dump(decode_results *results) {
4650
}
4751
else if (results->decode_type == PANASONIC) {
4852
Serial.print("Decoded PANASONIC - Address: ");
49-
Serial.print(results->address,HEX);
53+
Serial.print(results->address, HEX);
5054
Serial.print(" Value: ");
5155
}
5256
else if (results->decode_type == LG) {
53-
Serial.print("Decoded LG: ");
57+
Serial.print("Decoded LG: ");
5458
}
5559
else if (results->decode_type == JVC) {
56-
Serial.print("Decoded JVC: ");
57-
60+
Serial.print("Decoded JVC: ");
5861
}
5962
else if (results->decode_type == AIWA_RC_T501) {
6063
Serial.print("Decoded AIWA RC T501: ");
6164
}
6265
else if (results->decode_type == WHYNTER) {
63-
Serial.print("Decoded Whynter: ");
66+
Serial.print("Decoded Whynter: ");
6467
}
6568
Serial.print(results->value, HEX);
6669
Serial.print(" (");
@@ -70,19 +73,19 @@ void dump(decode_results *results) {
7073
Serial.print(count, DEC);
7174
Serial.print("): ");
7275

73-
for (int i = 0; i < count; i++) {
74-
if ((i % 2) == 1) {
76+
for (int i = 1; i < count; i++) {
77+
if (i & 1) {
7578
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
7679
}
7780
else {
78-
Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
81+
Serial.write('-');
82+
Serial.print((unsigned long) results->rawbuf[i]*USECPERTICK, DEC);
7983
}
8084
Serial.print(" ");
8185
}
82-
Serial.println("");
86+
Serial.println();
8387
}
8488

85-
8689
void loop() {
8790
if (irrecv.decode(&results)) {
8891
Serial.println(results.value, HEX);

0 commit comments

Comments
 (0)