MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / printIRResultRawFormatted

Method printIRResultRawFormatted

src/IRReceive.hpp:2210–2294  ·  view source on GitHub ↗

* Dump out the timings in IrReceiver.irparams.rawbuf[] array 8 values per line. * * @param aSerial The Print object on which to write, for Arduino you can use &Serial. * @param aOutputMicrosecondsInsteadOfTicks Output the (rawbuf_values * MICROS_PER_TICK) for better readability. */

Source from the content-addressed store, hash-verified

2208 * @param aOutputMicrosecondsInsteadOfTicks Output the (rawbuf_values * MICROS_PER_TICK) for better readability.
2209 */
2210void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks) {
2211
2212// Print Raw data
2213 aSerial->print(F("rawIRTimings["));
2214 aSerial->print(decodedIRData.rawlen);
2215 aSerial->println(F("]: "));
2216
2217 /*
2218 * Print initial gap
2219 */
2220 aSerial->print(F(" -"));
2221 if (aOutputMicrosecondsInsteadOfTicks) {
2222 aSerial->println((uint32_t) decodedIRData.initialGapTicks * MICROS_PER_TICK);
2223 } else {
2224 aSerial->println(decodedIRData.initialGapTicks);
2225 }
2226
2227// Newline is printed every 8. value, if tCounterForNewline % 8 == 0
2228 uint_fast8_t tCounterForNewline = 6; // first newline is after the 2 values of the start bit
2229
2230// check if we have a protocol with no or 8 start bits
2231#if defined(DECODE_DENON) || defined(DECODE_MAGIQUEST)
2232 if (
2233# if defined(DECODE_DENON)
2234 decodedIRData.protocol == DENON || decodedIRData.protocol == SHARP ||
2235# endif
2236# if defined(DECODE_MAGIQUEST)
2237 decodedIRData.protocol == MAGIQUEST ||
2238# endif
2239 false) {
2240 tCounterForNewline = 0; // no or 8 start bits
2241 }
2242#endif
2243
2244 uint32_t tDuration;
2245 uint16_t tSumOfDurationTicks = 0;
2246 for (IRRawlenType i = 1; i < decodedIRData.rawlen; i++) {
2247 auto tCurrentTicks = irparams.rawbuf[i];
2248 if (aOutputMicrosecondsInsteadOfTicks) {
2249 tDuration = tCurrentTicks * MICROS_PER_TICK;
2250 } else {
2251 tDuration = tCurrentTicks;
2252 }
2253 tSumOfDurationTicks += tCurrentTicks; // compute length of protocol frame
2254
2255 if (!(i & 1)) { // even
2256 aSerial->print('-');
2257 } else { // odd
2258 aSerial->print(F(" +"));
2259 }
2260
2261 // padding only for big values
2262 if (aOutputMicrosecondsInsteadOfTicks && tDuration < 1000) {
2263 aSerial->print(' ');
2264 }
2265 if (aOutputMicrosecondsInsteadOfTicks && tDuration < 100) {
2266 aSerial->print(' ');
2267 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected