* Compensate for marks exceeded by demodulator hardware * @return true, if values match */
| 1381 | * @return true, if values match |
| 1382 | */ |
| 1383 | bool 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 | |
| 1423 | bool matchMarkWithGreaterRange(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) { |
| 1424 | #if (MARK_EXCESS_MICROS == 0) |
no test coverage detected