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

Function matchTicksWithGreaterRange

src/IRReceive.hpp:1293–1317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1291}
1292
1293bool matchTicksWithGreaterRange(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros) {
1294 uint16_t tMeasuredMicros = (aMeasuredTicks * MICROS_PER_TICK);
1295 uint16_t tMatchValueMicrosQuarter = aMatchValueMicros / 4;
1296
1297 TRACE_PRINT(F("Testing with greater range (actual vs desired): "));
1298 TRACE_PRINT(tMeasuredMicros);
1299 TRACE_PRINT(F("us vs "));
1300 TRACE_PRINT(aMatchValueMicros);
1301 TRACE_PRINT(F("us: "));
1302 TRACE_PRINT(tMatchValueMicrosQuarter * 2); // rounded value because we divide first
1303 TRACE_PRINT(F(" <= "));
1304 TRACE_PRINT(aMeasuredTicks * MICROS_PER_TICK);
1305 TRACE_PRINT(F(" <= "));
1306 TRACE_PRINT(tMatchValueMicrosQuarter * 6);
1307
1308 bool passed = (tMeasuredMicros >= (tMatchValueMicrosQuarter * 2) && tMeasuredMicros <= (tMatchValueMicrosQuarter * 6));
1309#if defined(LOCAL_TRACE)
1310 if (passed) {
1311 Serial.println(F(" => passed"));
1312 } else {
1313 Serial.println(F(" => FAILED"));
1314 }
1315#endif
1316 return passed;
1317}
1318/**
1319 * Match function WITH compensating for marks exceeded or spaces shortened by demodulator hardware
1320 * With MARK_EXCESS_MICROS default value of 20 we cannot match 200 to 250, because we have 186 < 180 <= 310

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected