* Only sensible for development or very exotic requirements. - Not used yet * Check for additional required characteristics of timing like length of mark for a constant mark protocol, * where space length determines the bit value. Requires up to 194 additional bytes of program memory. * * @param aZeroMarkMicros For strict checks * @param aZeroSpaceMicros For strict checks * @retur
| 962 | * |
| 963 | */ |
| 964 | bool IRrecv::decodeStrictPulseDistanceWidthData(uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset, uint16_t aOneMarkMicros, |
| 965 | uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros, bool aMSBfirst) { |
| 966 | |
| 967 | auto *tRawBufPointer = &irparams.rawbuf[aStartOffset]; |
| 968 | |
| 969 | bool isPulseDistanceProtocol = (aOneMarkMicros == aZeroMarkMicros); // If true, we have a constant mark -> pulse distance protocol |
| 970 | |
| 971 | IRDecodedRawDataType tDecodedData = 0; // For MSB first tDecodedData is shifted left each loop |
| 972 | IRDecodedRawDataType tMask = 1UL; // Mask is only used for LSB first |
| 973 | |
| 974 | for (uint_fast8_t i = aNumberOfBits; i > 0; i--) { |
| 975 | // get one mark and space pair |
| 976 | unsigned int tMarkTicks; |
| 977 | unsigned int tSpaceTicks; |
| 978 | bool tBitValue; |
| 979 | |
| 980 | if (isPulseDistanceProtocol) { |
| 981 | /* |
| 982 | * PULSE_DISTANCE here (aOneMarkMicros == aZeroMarkMicros) |
| 983 | * We additionally check constant mark duration and in case of zero the zero space duration. |
| 984 | */ |
| 985 | tMarkTicks = *tRawBufPointer++; |
| 986 | tSpaceTicks = *tRawBufPointer++; // maybe buffer overflow for last bit, but we do not evaluate this value :-) |
| 987 | tBitValue = matchSpace(tSpaceTicks, aOneSpaceMicros); // Check for variable length space indicating a 1 or 0 |
| 988 | |
| 989 | // Check for constant mark duration |
| 990 | if (!matchMark(tMarkTicks, aOneMarkMicros)) { |
| 991 | DEBUG_PRINT(F("Mark=")); |
| 992 | DEBUG_PRINT(tMarkTicks * MICROS_PER_TICK); |
| 993 | DEBUG_PRINT(F(" is not ")); |
| 994 | DEBUG_PRINT(aOneMarkMicros); |
| 995 | DEBUG_PRINT(F(". Index=")); |
| 996 | DEBUG_PRINT(aNumberOfBits - i); |
| 997 | DEBUG_PRINT(' '); |
| 998 | return false; |
| 999 | } |
| 1000 | |
| 1001 | // in case of 0, check for zero space duration |
| 1002 | if (!tBitValue && !matchSpace(tSpaceTicks, aZeroSpaceMicros)) { |
| 1003 | DEBUG_PRINT(F("Space=")); |
| 1004 | DEBUG_PRINT(tSpaceTicks * MICROS_PER_TICK); |
| 1005 | DEBUG_PRINT(F(" is not ")); |
| 1006 | DEBUG_PRINT(aZeroSpaceMicros); |
| 1007 | DEBUG_PRINT(F(". Index=")); |
| 1008 | DEBUG_PRINT(aNumberOfBits - i); |
| 1009 | DEBUG_PRINT(' '); |
| 1010 | return false; |
| 1011 | } |
| 1012 | |
| 1013 | } else { |
| 1014 | /* |
| 1015 | * PULSE_WIDTH -including PULSE_DISTANCE_WIDTH- here. |
| 1016 | * We additionally check two space durations and in case of zero the zero mark duration. |
| 1017 | */ |
| 1018 | tMarkTicks = *tRawBufPointer++; |
| 1019 | tBitValue = matchMark(tMarkTicks, aOneMarkMicros); // Check for variable length mark indicating a 1 or 0 |
| 1020 | tSpaceTicks = *tRawBufPointer++; // maybe buffer overflow for last bit, but we do not evaluate this value :-) |
| 1021 |
nothing calls this directly
no test coverage detected