src/ir_Template.cpp
//+=============================================================================
//
/*
 * First check for right data length
 * Next check start bit
 * Next try the decode
 * Last check stop bit
 */
First check for right data length
Next check start bit
Next try the decode
Last check stop bit
First check for right data length Next check start bit Next try the decode Last check stop bit
bool IRrecv::decodeShuzu() {
    if (decodedIRData.rawDataPtr->rawlen != (2 * SHUZU_BITS) + 4) {
        return false;
    }
    if (!matchMark(decodedIRData.rawDataPtr->rawbuf[1], SHUZU_HEADER_MARK) || !matchSpace(decodedIRData.rawDataPtr->rawbuf[2], SHUZU_HEADER_SPACE)) {
        DEBUG_PRINT("Shuzu: ");
        DEBUG_PRINTLN("Header mark or space length is wrong");
        return false;
    }
    if (!decodePulseDistanceData(SHUZU_BITS, 3, SHUZU_BIT_MARK, SHUZU_ONE_SPACE, SHUZU_ZERO_SPACE, PROTOCOL_IS_LSB_FIRST)) {
        DEBUG_PRINT(F("Shuzu: "));
        DEBUG_PRINTLN(F("Decode failed"));
        return false;
    }
    if (!matchMark(decodedIRData.rawDataPtr->rawbuf[3 + (2 * SHUZU_BITS)], SHUZU_BIT_MARK)) {
        DEBUG_PRINT(F("Shuzu: "));
        DEBUG_PRINTLN(F("Stop bit mark length is wrong"));
        return false;
    }
    uint8_t tCommand = decodedIRData.decodedRawData >> SHUZU_ADDRESS_BITS;  
    uint8_t tAddress = decodedIRData.decodedRawData & 0xFFFF;    
    if (decodedIRData.rawDataPtr->rawbuf[0] < ((SHUZU_REPEAT_SPACE + (SHUZU_REPEAT_SPACE / 4)) / MICROS_PER_TICK)) {
        decodedIRData.flags = IRDATA_FLAGS_IS_REPEAT | IRDATA_FLAGS_IS_LSB_FIRST;
    }
    decodedIRData.command = tCommand;
    decodedIRData.address = tAddress;
    decodedIRData.numberOfBits = SHUZU_BITS;
    decodedIRData.protocol = LG; 
    return true;
}
bool IRrecv :: decodeShuzu ( ) { if ( decodedIRData . rawDataPtr -> rawlen != ( 2 * SHUZU_BITS ) + 4 ) { return false ; } if ( ! matchMark ( decodedIRData . rawDataPtr -> rawbuf [ 1 ] , SHUZU_HEADER_MARK ) || ! matchSpace ( decodedIRData . rawDataPtr -> rawbuf [ 2 ] , SHUZU_HEADER_SPACE ) ) { DEBUG_PRINT ( " " ) ; DEBUG_PRINTLN ( " " ) ; return false ; } if ( ! decodePulseDistanceData ( SHUZU_BITS , 3 , SHUZU_BIT_MARK , SHUZU_ONE_SPACE , SHUZU_ZERO_SPACE , PROTOCOL_IS_LSB_FIRST ) ) { DEBUG_PRINT ( F ( " " ) ) ; DEBUG_PRINTLN ( F ( " " ) ) ; return false ; } if ( ! matchMark ( decodedIRData . rawDataPtr -> rawbuf [ 3 + ( 2 * SHUZU_BITS ) ] , SHUZU_BIT_MARK ) ) { DEBUG_PRINT ( F ( " " ) ) ; DEBUG_PRINTLN ( F ( " " ) ) ; return false ; } uint8_t tCommand = decodedIRData . decodedRawData >> SHUZU_ADDRESS_BITS ; uint8_t tAddress = decodedIRData . decodedRawData & 0xFFFF ; if ( decodedIRData . rawDataPtr -> rawbuf [ 0 ] < ( ( SHUZU_REPEAT_SPACE + ( SHUZU_REPEAT_SPACE / 4 ) ) / MICROS_PER_TICK ) ) { decodedIRData . flags = IRDATA_FLAGS_IS_REPEAT | IRDATA_FLAGS_IS_LSB_FIRST ; } decodedIRData . command = tCommand ; decodedIRData . address = tAddress ; decodedIRData . numberOfBits = SHUZU_BITS ; decodedIRData . protocol = LG ; return true ; }
+
 First check for right data length
 Next check start bit
 Next try the decode
 Last check stop bit
+ First check for right data length Next check start bit Next try the decode Last check stop bit
// Check we have the right amount of data (28). The +4 is for initial gap, start bit mark and space + stop bit mark
 // no debug output, since this check is mainly to determine the received protocol
 // Check header "space"
 // false -> LSB first
 // Stop bit
 // Success
 //    decodedIRData.flags = IRDATA_FLAGS_IS_LSB_FIRST; // Not required, since this is the start value
 // upper 8 bits of LSB first value
 // lowest 16 bit of LSB first value
 /*
     *  Check for repeat
     */ // we have no SHUZU code
