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

Method compare

src/IRReceive.hpp:1136–1144  ·  view source on GitHub ↗

* Compare two (tick) values for Hash decoder * Use a tolerance of 20% to enable e.g. 500 and 600 (NEC timing) and at least 200 and 250 to be equal * @return 0 if newval is shorter, 1 if newval is equal, and 2 if newval is longer */

Source from the content-addressed store, hash-verified

1134 * @return 0 if newval is shorter, 1 if newval is equal, and 2 if newval is longer
1135 */
1136uint_fast8_t IRrecv::compare(uint16_t oldval, uint16_t newval) {
1137 if (newval * 10 < oldval * 8) {
1138 return 0;
1139 }
1140 if (oldval * 10 < newval * 8) {
1141 return 2;
1142 }
1143 return 1;
1144}
1145
1146/**
1147 * Decodes an arbitrary IR code to a 32-bit value.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected