diff --git a/IR-Protocol.ino b/IR-Protocol.ino index bd17df6..2333e7e 100644 --- a/IR-Protocol.ino +++ b/IR-Protocol.ino @@ -348,11 +348,11 @@ void status(IR_Decoder& dec) { // str += (" CRC CALC: "); str += (dec.gotAccept.getCrcCALC()); str += "\n"; str += "\n"; - str += (" Data["); str += (dec.gotAccept.getCustomByte()); str += ("]: \n"); + str += (" Data: "); str += (dec.gotAccept.getCustomByte()); - str += ("\n*******ErrAll: "); str += (dec.gotAccept.getErrorCount()); str += "\n"; + str += ("\n\n*******ErrAll: "); str += (dec.gotAccept.getErrorCount()); str += "\n"; str += ("**ErrDistance: "); str += ((int)(dec.gotAccept.getErrorHighSignal() - dec.gotAccept.getErrorLowSignal())); str += "\n"; str += "\n"; diff --git a/IR_Decoder.h b/IR_Decoder.h index 8cdd767..32ecb79 100644 --- a/IR_Decoder.h +++ b/IR_Decoder.h @@ -9,6 +9,7 @@ class IR_Decoder : public IR_DecoderRaw { uint16_t addrAcceptSendTo; uint16_t acceptDelay = 75; + uint8_t acceptCustomByte; public: @@ -48,19 +49,20 @@ public: if (gotData.isAvailable && (gotData.getMsgType() == IR_MSG_DATA_ACCEPT)) { acceptSendTimer = millis(); addrAcceptSendTo = gotData.getAddrFrom(); - if(addrAcceptSendTo && addrAcceptSendTo < IR_Broadcast) isWaitingAcceptSend = true; + acceptCustomByte = crc8(gotData.getDataPrt(), 0, gotData.getDataSize(), poly1); + if (addrAcceptSendTo && addrAcceptSendTo < IR_Broadcast) isWaitingAcceptSend = true; } } if (isWaitingAcceptSend && millis() - acceptSendTimer > 75) { - encoder->sendAccept(addrAcceptSendTo); + encoder->sendAccept(addrAcceptSendTo, acceptCustomByte); isWaitingAcceptSend = false; } } - void setAcceptDelay(uint16_t acceptDelay){ + void setAcceptDelay(uint16_t acceptDelay) { this->acceptDelay = acceptDelay; } - uint16_t getAcceptDelay(){ + uint16_t getAcceptDelay() { return this->acceptDelay; } }; diff --git a/IR_config.h b/IR_config.h index 5d35176..0a20143 100644 --- a/IR_config.h +++ b/IR_config.h @@ -50,7 +50,7 @@ msg type: #define IR_MSG_DATA_ACCEPT 7U // | 111..... | = данные требующие подтверждения ;/*   // ---------- -/```````````````````` подтверждение ```````````````````\      /``````````````````````````````````````` запрос ``````````````````````````````````\ +/``````````````````````````````` подтверждение `````````````````````````````\      /``````````````````````````````````````` запрос ``````````````````````````````````\                                                                                                                        {``````````} [````````````````````````] [``````````````````] [``````````````]      {``````````} [````````````````````````] [````````````````````````] [``````````````] { msg type } [ addr_from uint16_t ] [=== customByte ===] [ CRC Bytes ]      { msg type } [ addr_from uint16_t ] [ addr_to uint16_t ] [ CRC Bytes ] @@ -62,6 +62,8 @@ msg type: |                                                                        |          |                                                                             |     \________________________________________________________________________/          \_____________________________________________________________________________/     +customByte - контрольная сумма принятых данных по poly1 + /`````````````````````` Задний сигнал машинки без адресации ``````````````````````\        В (IR_MASK_MSG_INFO & 15U) содержится количество байт