mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
add crcID for accept
This commit is contained in:
parent
909fac5d1a
commit
0166bbfa22
@ -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";
|
||||||
|
10
IR_Decoder.h
10
IR_Decoder.h
@ -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,19 +49,20 @@ 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();
|
||||||
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) {
|
if (isWaitingAcceptSend && millis() - acceptSendTimer > 75) {
|
||||||
encoder->sendAccept(addrAcceptSendTo);
|
encoder->sendAccept(addrAcceptSendTo, acceptCustomByte);
|
||||||
isWaitingAcceptSend = false;
|
isWaitingAcceptSend = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAcceptDelay(uint16_t acceptDelay){
|
void setAcceptDelay(uint16_t acceptDelay) {
|
||||||
this->acceptDelay = acceptDelay;
|
this->acceptDelay = acceptDelay;
|
||||||
}
|
}
|
||||||
uint16_t getAcceptDelay(){
|
uint16_t getAcceptDelay() {
|
||||||
return this->acceptDelay;
|
return this->acceptDelay;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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) содержится количество байт
|
||||||
|
Loading…
x
Reference in New Issue
Block a user