* Store the decodedIRData to be used for sendRaw(). * * Compensate received values by MARK_EXCESS_MICROS, like it is done for decoding and store it in an array. * * Maximum for uint8_t is 255*50 microseconds = 12750 microseconds = 12.75 ms, which hardly ever occurs inside an IR frame. * @param aArrayPtr Address of an array provided by the caller. */
| 2363 | * @param aArrayPtr Address of an array provided by the caller. |
| 2364 | */ |
| 2365 | void IRrecv::compensateAndStoreIRResultInArray(uint8_t *aArrayPtr) { |
| 2366 | |
| 2367 | // Store data, skip leading space# |
| 2368 | IRRawlenType i; |
| 2369 | for (i = 1; i < decodedIRData.rawlen; i++) { |
| 2370 | uint32_t tDuration = irparams.rawbuf[i] * MICROS_PER_TICK; // no problem to use 50 instead of 50L here! |
| 2371 | if (i & 1) { |
| 2372 | // Mark |
| 2373 | tDuration -= MARK_EXCESS_MICROS; |
| 2374 | } else { |
| 2375 | tDuration += MARK_EXCESS_MICROS; |
| 2376 | } |
| 2377 | |
| 2378 | unsigned int tTicks = (tDuration + (MICROS_PER_TICK / 2)) / MICROS_PER_TICK; |
| 2379 | *aArrayPtr = (tTicks > UINT8_MAX) ? UINT8_MAX : tTicks; // we store it in an 8 bit array |
| 2380 | aArrayPtr++; |
| 2381 | } |
| 2382 | } |
| 2383 | |
| 2384 | /** |
| 2385 | * Print results as C variables to be used for sendXXX() |
nothing calls this directly
no outgoing calls
no test coverage detected