|
| 1 | +/* |
| 2 | + * IRremote: IRremoteInfo - prints relevant config info & settings for IRremote over serial |
| 3 | + * Intended to help identify & troubleshoot the various settings of IRremote |
| 4 | + * For example, sometimes users are unsure of which pin is used for Tx or the RAWBUF values |
| 5 | + * This example can be used to assist the user directly or with support. |
| 6 | + * Intended to help identify & troubleshoot the various settings of IRremote |
| 7 | + * Hopefully this utility will be a useful tool for support & troubleshooting for IRremote |
| 8 | + * Check out the blog post describing the sketch via http://www.analysir.com/blog/2015/11/28/helper-utility-for-troubleshooting-irremote/ |
| 9 | + * Version 1.0 November 2015 |
| 10 | + * Original Author: AnalysIR - IR software & modules for Makers & Pros, visit http://www.AnalysIR.com |
| 11 | + */ |
| 12 | + |
| 13 | + |
| 14 | +#include <IRremote.h> |
| 15 | + |
| 16 | +void setup() |
| 17 | +{ |
| 18 | + Serial.begin(115200); //You may alter the BAUD rate here as needed |
| 19 | + while (!Serial); //wait until Serial is established - required on some Platforms |
| 20 | + |
| 21 | + //Runs only once per restart of the Arduino. |
| 22 | + dumpHeader(); |
| 23 | + dumpRAWBUF(); |
| 24 | + dumpTIMER(); |
| 25 | + dumpTimerPin(); |
| 26 | + dumpClock(); |
| 27 | + dumpPlatform(); |
| 28 | + dumpPulseParams(); |
| 29 | + dumpSignalParams(); |
| 30 | + dumpArduinoIDE(); |
| 31 | + dumpDebugMode(); |
| 32 | + dumpProtocols(); |
| 33 | + dumpFooter(); |
| 34 | +} |
| 35 | + |
| 36 | +void loop() { |
| 37 | + //nothing to do! |
| 38 | +} |
| 39 | + |
| 40 | +void dumpRAWBUF() { |
| 41 | + Serial.print(F("RAWBUF: ")); |
| 42 | + Serial.println(RAWBUF); |
| 43 | +} |
| 44 | + |
| 45 | +void dumpTIMER() { |
| 46 | + boolean flag = false; |
| 47 | +#ifdef IR_USE_TIMER1 |
| 48 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer1")); flag = true; |
| 49 | +#endif |
| 50 | +#ifdef IR_USE_TIMER2 |
| 51 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer2")); flag = true; |
| 52 | +#endif |
| 53 | +#ifdef IR_USE_TIMER3 |
| 54 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer3")); flag = true; |
| 55 | +#endif |
| 56 | +#ifdef IR_USE_TIMER4 |
| 57 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer4")); flag = true; |
| 58 | +#endif |
| 59 | +#ifdef IR_USE_TIMER5 |
| 60 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer5")); flag = true; |
| 61 | +#endif |
| 62 | +#ifdef IR_USE_TIMER4_HS |
| 63 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer4_HS")); flag = true; |
| 64 | +#endif |
| 65 | +#ifdef IR_USE_TIMER_CMT |
| 66 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer_CMT")); flag = true; |
| 67 | +#endif |
| 68 | +#ifdef IR_USE_TIMER_TPM1 |
| 69 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer_TPM1")); flag = true; |
| 70 | +#endif |
| 71 | +#ifdef IR_USE_TIMER_TINY0 |
| 72 | + Serial.print(F("Timer defined for use: ")); Serial.println(F("Timer_TINY0")); flag = true; |
| 73 | +#endif |
| 74 | + |
| 75 | + if (!flag) { |
| 76 | + Serial.print(F("Timer Error: ")); Serial.println(F("not defined")); |
| 77 | + } |
| 78 | +} |
| 79 | + |
| 80 | +void dumpTimerPin() { |
| 81 | + Serial.print(F("IR Tx Pin: ")); |
| 82 | + Serial.println(TIMER_PWM_PIN); |
| 83 | +} |
| 84 | + |
| 85 | +void dumpClock() { |
| 86 | + Serial.print(F("MCU Clock: ")); |
| 87 | + Serial.println(F_CPU); |
| 88 | +} |
| 89 | + |
| 90 | +void dumpPlatform() { |
| 91 | + Serial.print(F("MCU Platform: ")); |
| 92 | + |
| 93 | +#if defined(__AVR_ATmega1280__) |
| 94 | + Serial.println(F("Arduino Mega1280")); |
| 95 | +#elif defined(__AVR_ATmega2560__) |
| 96 | + Serial.println(F("Arduino Mega2560")); |
| 97 | +#elif defined(__AVR_AT90USB162__) |
| 98 | + Serial.println(F("Teensy 1.0 / AT90USB162")); |
| 99 | + // Teensy 2.0 |
| 100 | +#elif defined(__AVR_ATmega32U4__) |
| 101 | + Serial.println(F("Arduino Leonardo / Yun / Teensy 1.0 / ATmega32U4")); |
| 102 | +#elif defined(__MK20DX128__) || defined(__MK20DX256__) |
| 103 | + Serial.println(F("Teensy 3.0 / Teensy 3.1 / MK20DX128 / MK20DX256")); |
| 104 | +#elif defined(__MKL26Z64__) |
| 105 | + Serial.println(F("Teensy-LC / MKL26Z64")); |
| 106 | +#elif defined(__AVR_AT90USB646__) |
| 107 | + Serial.println(F("Teensy++ 1.0 / AT90USB646")); |
| 108 | +#elif defined(__AVR_AT90USB1286__) |
| 109 | + Serial.println(F("Teensy++ 2.0 / AT90USB1286")); |
| 110 | +#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) |
| 111 | + Serial.println(F("Sanguino / ATmega644(P)")); |
| 112 | +#elif defined(__AVR_ATmega8P__) || defined(__AVR_ATmega8__) |
| 113 | + Serial.println(F("Atmega8 / ATmega8(P)")); |
| 114 | +#elif defined(__AVR_ATtiny84__) |
| 115 | + Serial.println(F("ATtiny84")); |
| 116 | +#elif defined(__AVR_ATtiny85__) |
| 117 | + Serial.println(F("ATtiny85")); |
| 118 | +#else |
| 119 | + Serial.println(F("ATmega328(P) / (Duemilanove, Diecimila, LilyPad, Mini, Micro, Fio, Nano, etc)")); |
| 120 | +#endif |
| 121 | +} |
| 122 | + |
| 123 | +void dumpPulseParams() { |
| 124 | + Serial.print(F("Mark Excess: ")); Serial.print(MARK_EXCESS);; Serial.println(F(" uSecs")); |
| 125 | + Serial.print(F("Microseconds per tick: ")); Serial.print(USECPERTICK);; Serial.println(F(" uSecs")); |
| 126 | + Serial.print(F("Measurement tolerance: ")); Serial.print(TOLERANCE); Serial.println(F("%")); |
| 127 | +} |
| 128 | + |
| 129 | +void dumpSignalParams() { |
| 130 | + Serial.print(F("Minimum Gap between IR Signals: ")); Serial.print(_GAP); Serial.println(F(" uSecs")); |
| 131 | +} |
| 132 | + |
| 133 | +void dumpDebugMode() { |
| 134 | + Serial.print(F("Debug Mode: ")); |
| 135 | +#if DEBUG |
| 136 | + Serial.println(F("ON")); |
| 137 | +#else |
| 138 | + Serial.println(F("OFF (Normal)")); |
| 139 | <
10000
code class="diff-text syntax-highlighted-line addition">+ #endif |
| 140 | + |
| 141 | +} |
| 142 | + |
| 143 | +void dumpArduinoIDE() { |
| 144 | + Serial.print(F("Arduino IDE version: ")); |
| 145 | + Serial.print(ARDUINO / 10000); |
| 146 | + Serial.write('.'); |
| 147 | + Serial.print((ARDUINO % 10000) / 100); |
| 148 | + Serial.write('.'); |
| 149 | + Serial.println(ARDUINO % 100); |
| 150 | +} |
| 151 | + |
| 152 | +void dumpProtocols() { |
| 153 | + |
| 154 | + Serial.println(); Serial.print(F("IR PROTOCOLS ")); Serial.print(F("SEND ")); Serial.println(F("DECODE")); |
| 155 | + Serial.print(F("============= ")); Serial.print(F("======== ")); Serial.println(F("========")); |
| 156 | + Serial.print(F("RC5: ")); printSendEnabled(SEND_RC5); printDecodeEnabled(DECODE_RC6); |
| 157 | + Serial.print(F("RC6: ")); printSendEnabled(SEND_RC6); printDecodeEnabled(DECODE_RC5); |
| 158 | + Serial.print(F("NEC: ")); printSendEnabled(SEND_NEC); printDecodeEnabled(DECODE_NEC); |
| 159 | + Serial.print(F("SONY: ")); printSendEnabled(SEND_SONY); printDecodeEnabled(DECODE_SONY); |
| 160 | + Serial.print(F("PANASONIC: ")); printSendEnabled(SEND_PANASONIC); printDecodeEnabled(DECODE_PANASONIC); |
| 161 | + Serial.print(F("JVC: ")); printSendEnabled(SEND_JVC); printDecodeEnabled(DECODE_JVC); |
| 162 | + Serial.print(F("SAMSUNG: ")); printSendEnabled(SEND_SAMSUNG); printDecodeEnabled(DECODE_SAMSUNG); |
| 163 | + Serial.print(F("WHYNTER: ")); printSendEnabled(SEND_WHYNTER); printDecodeEnabled(DECODE_WHYNTER); |
| 164 | + Serial.print(F("AIWA_RC_T501: ")); printSendEnabled(SEND_AIWA_RC_T501); printDecodeEnabled(DECODE_AIWA_RC_T501); |
| 165 | + Serial.print(F("LG: ")); printSendEnabled(SEND_LG); printDecodeEnabled(DECODE_LG); |
| 166 | + Serial.print(F("SANYO: ")); printSendEnabled(SEND_SANYO); printDecodeEnabled(DECODE_SANYO); |
| 167 | + Serial.print(F("MITSUBISHI: ")); printSendEnabled(SEND_MITSUBISHI); printDecodeEnabled(DECODE_MITSUBISHI); |
| 168 | + Serial.print(F("DISH: ")); printSendEnabled(SEND_DISH); printDecodeEnabled(DECODE_DISH); |
| 169 | + Serial.print(F("SHARP: ")); printSendEnabled(SEND_SHARP); printDecodeEnabled(DECODE_SHARP); |
| 170 | + Serial.print(F("DENON: ")); printSendEnabled(SEND_DENON); printDecodeEnabled(DECODE_DENON); |
| 171 | + Serial.print(F("PRONTO: ")); printSendEnabled(SEND_PRONTO); Serial.println(F("(Not Applicable)")); |
| 172 | +} |
| 173 | + |
| 174 | +void printSendEnabled(int flag) { |
| 175 | + if (flag) { |
| 176 | + Serial.print(F("Enabled ")); |
| 177 | + } |
| 178 | + else { |
| 179 | + Serial.print(F("Disabled ")); |
| 180 | + } |
| 181 | +} |
| 182 | + |
| 183 | +void printDecodeEnabled(int flag) { |
| 184 | + if (flag) { |
| 185 | + Serial.println(F("Enabled")); |
| 186 | + } |
| 187 | + else { |
| 188 | + Serial.println(F("Disabled")); |
| 189 | + } |
| 190 | +} |
| 191 | + |
| 192 | +void dumpHeader() { |
| 193 | + Serial.println(F("IRremoteInfo - by AnalysIR (http://www.AnalysIR.com/)")); |
| 194 | + Serial.println(F(" - A helper sketch to assist in troubleshooting issues with the library by reviewing the settings within the IRremote library")); |
| 195 | + Serial.println(F(" - Prints out the important settings within the library, which can be configured to suit the many supported platforms")); |
| 196 | + Serial.println(F(" - When seeking on-line support, please post or upload the output of this sketch, where appropriate")); |
| 197 | + Serial.println(); |
| 198 | + Serial.println(F("IRremote Library Settings")); |
| 199 | + Serial.println(F("=========================")); |
| 200 | +} |
| 201 | + |
| 202 | +void dumpFooter() { |
| 203 | + Serial.println(); |
| 204 | + Serial.println(F("Notes: ")); |
| 205 | + Serial.println(F(" - Most of the seetings above can be configured in the following files included as part of the library")); |
| 206 | + Serial.println(F(" - IRremteInt.h")); |
| 207 | + Serial.println(F(" - IRremote.h")); |
| 208 | + Serial.println(F(" - You can save SRAM by disabling the Decode or Send features for any protocol (Near the top of IRremoteInt.h)")); |
| 209 | + Serial.println(F(" - Some Timer conflicts, with other libraries, can be easily resolved by configuring a differnt Timer for your platform")); |
| 210 | +} |
0 commit comments