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

Function matchMark

src/IRReceive.hpp:1383–1421  ·  view source on GitHub ↗

* Compensate for marks exceeded by demodulator hardware * @return true, if values match */

Source from the content-addressed store, hash-verified

1381 * @return true, if values match
1382 */
1383bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1384#if (MARK_EXCESS_MICROS == 0)
1385 return matchTicks(aMeasuredTicks, aMatchValueMicros);
1386#else
1387
1388# if !defined(USE_OLD_MATCH_FUNCTIONS)
1389 return matchTicks(aMeasuredTicks, aMatchValueMicros, -MARK_EXCESS_MICROS); // New handling of MARK_EXCESS_MICROS without strange rounding errors
1390# endif
1391
1392 // old version here
1393 aMatchValueMicros += MARK_EXCESS_MICROS;
1394
1395 TRACE_PRINT(F("Testing mark (actual vs desired): "));
1396 TRACE_PRINT(aMeasuredTicks * MICROS_PER_TICK);
1397 TRACE_PRINT(F("us vs "));
1398 TRACE_PRINT(aMatchValueMicros);
1399 TRACE_PRINT(F("us: "));
1400// TRACE_PRINT(F("TICKS_LOW="));
1401// TRACE_PRINT(TICKS_LOW(aMatchValueMicros));
1402// TRACE_PRINT(F(" "));
1403 TRACE_PRINT(TICKS_LOW(aMatchValueMicros) * MICROS_PER_TICK);
1404 TRACE_PRINT(F(" <= "));
1405 TRACE_PRINT(aMeasuredTicks * MICROS_PER_TICK);
1406 TRACE_PRINT(F(" <= "));
1407 TRACE_PRINT(TICKS_HIGH(aMatchValueMicros) * MICROS_PER_TICK);
1408
1409 // compensate for marks exceeded by demodulator hardware
1410 bool passed = ((aMeasuredTicks >= TICKS_LOW(aMatchValueMicros))
1411 && (aMeasuredTicks <= TICKS_HIGH(aMatchValueMicros)));
1412# if defined(LOCAL_TRACE)
1413 if (passed) {
1414 Serial.println(F(" => passed"));
1415 } else {
1416 Serial.println(F(" => FAILED"));
1417 }
1418# endif
1419 return passed;
1420#endif
1421}
1422
1423bool matchMarkWithGreaterRange(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1424#if (MARK_EXCESS_MICROS == 0)

Callers 15

decodeOpenLASIRMethod · 0.85
decodeBoseWaveMethod · 0.85
decodeRC6Method · 0.85
decodeDenonOldMethod · 0.85
checkHeaderMethod · 0.85
checkHeader_PMethod · 0.85
MATCH_MARKFunction · 0.85
decodeJVCMethod · 0.85
decodeJVCMSBMethod · 0.85
decodeSAMSUNGMethod · 0.85

Calls 1

matchTicksFunction · 0.85

Tested by

no test coverage detected