add crcID for accept

This commit is contained in:
DashyFox 2024-02-27 13:02:30 +03:00
parent 909fac5d1a
commit 0166bbfa22
3 changed files with 11 additions and 7 deletions

View File

@ -348,11 +348,11 @@ void status(IR_Decoder& dec) {
// str += (" CRC CALC: "); str += (dec.gotAccept.getCrcCALC()); str += "\n"; // str += (" CRC CALC: "); str += (dec.gotAccept.getCrcCALC()); str += "\n";
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 += ("**ErrDistance: "); str += ((int)(dec.gotAccept.getErrorHighSignal() - dec.gotAccept.getErrorLowSignal())); str += "\n";
str += "\n"; str += "\n";

View File

@ -9,6 +9,7 @@ class IR_Decoder : public IR_DecoderRaw {
uint16_t addrAcceptSendTo; uint16_t addrAcceptSendTo;
uint16_t acceptDelay = 75; uint16_t acceptDelay = 75;
uint8_t acceptCustomByte;
public: public:
@ -48,11 +49,12 @@ public:
if (gotData.isAvailable && (gotData.getMsgType() == IR_MSG_DATA_ACCEPT)) { if (gotData.isAvailable && (gotData.getMsgType() == IR_MSG_DATA_ACCEPT)) {
acceptSendTimer = millis(); acceptSendTimer = millis();
addrAcceptSendTo = gotData.getAddrFrom(); addrAcceptSendTo = gotData.getAddrFrom();
acceptCustomByte = crc8(gotData.getDataPrt(), 0, gotData.getDataSize(), poly1);
if (addrAcceptSendTo && addrAcceptSendTo < IR_Broadcast) isWaitingAcceptSend = true; if (addrAcceptSendTo && addrAcceptSendTo < IR_Broadcast) isWaitingAcceptSend = true;
} }
} }
if (isWaitingAcceptSend && millis() - acceptSendTimer > 75) { if (isWaitingAcceptSend && millis() - acceptSendTimer > 75) {
encoder->sendAccept(addrAcceptSendTo); encoder->sendAccept(addrAcceptSendTo, acceptCustomByte);
isWaitingAcceptSend = false; isWaitingAcceptSend = false;
} }
} }

View File

@ -50,7 +50,7 @@ msg type:
#define IR_MSG_DATA_ACCEPT 7U // | 111..... | = данные требующие подтверждения #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 ] { 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) содержится количество байт /`````````````````````` Задний сигнал машинки без адресации ``````````````````````\        В (IR_MASK_MSG_INFO & 15U) содержится количество байт