| 113 | } |
| 114 | |
| 115 | bool IRrecv::decodeJVC() { |
| 116 | |
| 117 | // uint_fast8_t tRawlen = decodedIRData.rawlen; // Using a local variable does not improve code size |
| 118 | |
| 119 | // Check we have the right amount of data (36 or 34). The +4 is for initial gap, start bit mark and space + stop bit mark. |
| 120 | // +4 is for first frame, +2 is for repeats |
| 121 | if (!(decodedIRData.rawlen == ((2 * JVC_BITS) + 2) || decodedIRData.rawlen == ((2 * JVC_BITS) + 4))) { |
| 122 | DEBUG_PRINT(F("JVC: Data length=")); |
| 123 | DEBUG_PRINT(decodedIRData.rawlen); |
| 124 | DEBUG_PRINTLN(F(" is not 34 or 36")); |
| 125 | return false; |
| 126 | } |
| 127 | |
| 128 | if (decodedIRData.rawlen == ((2 * JVC_BITS) + 2)) { |
| 129 | /* |
| 130 | * 34 -> check for repeat distance and check leading space and first and last mark length |
| 131 | */ |
| 132 | if (lastDecodedProtocol == JVC |
| 133 | && decodedIRData.initialGapTicks < ((JVC_REPEAT_DISTANCE + (JVC_REPEAT_DISTANCE / 4) / MICROS_PER_TICK)) |
| 134 | && matchMark(irparams.rawbuf[1], JVC_BIT_MARK) |
| 135 | && matchMark(irparams.rawbuf[decodedIRData.rawlen - 1], JVC_BIT_MARK)) { |
| 136 | /* |
| 137 | * We have a repeat here, so do not check for start bit |
| 138 | */ |
| 139 | decodedIRData.flags = IRDATA_FLAGS_IS_REPEAT | IRDATA_FLAGS_IS_LSB_FIRST; |
| 140 | decodedIRData.address = lastDecodedAddress; |
| 141 | decodedIRData.command = lastDecodedCommand; |
| 142 | decodedIRData.protocol = JVC; |
| 143 | } |
| 144 | } else { |
| 145 | |
| 146 | // 36 -> check for new start frame |
| 147 | if (!checkHeader_P(&JVCProtocolConstants)) { |
| 148 | return false; |
| 149 | } |
| 150 | |
| 151 | decodePulseDistanceWidthData_P(&JVCProtocolConstants, JVC_BITS); |
| 152 | |
| 153 | // decodedIRData.flags = IRDATA_FLAGS_IS_LSB_FIRST; // Not required, since this is the start value |
| 154 | decodedIRData.command = decodedIRData.decodedRawData >> JVC_ADDRESS_BITS; // upper 8 bits of LSB first value |
| 155 | decodedIRData.address = decodedIRData.decodedRawData & 0xFF; // lowest 8 bit of LSB first value |
| 156 | decodedIRData.numberOfBits = JVC_BITS; |
| 157 | decodedIRData.protocol = JVC; |
| 158 | } |
| 159 | |
| 160 | return true; |
| 161 | } |
| 162 | |
| 163 | /********************************************************************************* |
| 164 | * Old deprecated functions, kept for backward compatibility to old 2.0 tutorials |
nothing calls this directly
no test coverage detected