mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
add acceptDelay change
This commit is contained in:
parent
523bb0712c
commit
909fac5d1a
@ -60,7 +60,7 @@ uint32_t loopTimer;
|
|||||||
uint8_t sig = 255;
|
uint8_t sig = 255;
|
||||||
|
|
||||||
uint16_t targetAddr = IR_Broadcast;
|
uint16_t targetAddr = IR_Broadcast;
|
||||||
Timer t1(730, millis, []() {
|
Timer t1(500, millis, []() {
|
||||||
|
|
||||||
// Serial.println(sig);
|
// Serial.println(sig);
|
||||||
|
|
||||||
@ -327,6 +327,78 @@ void status(IR_Decoder& dec) {
|
|||||||
Serial.write(str.c_str());
|
Serial.write(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dec.gotAccept.available()) {
|
||||||
|
String str;
|
||||||
|
if (/* dec.gotData.getDataPrt()[1] */1) {
|
||||||
|
str += ("Accept on pin "); str += (dec.isrPin); str += "\n";
|
||||||
|
|
||||||
|
uint8_t msg = dec.gotAccept.getMsgRAW();
|
||||||
|
str += (" MSG: ");
|
||||||
|
for (size_t i = 0; i < 8; i++) {
|
||||||
|
if (i == 3) str += " ";
|
||||||
|
str += (msg >> (7 - i)) & 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
str += "\n";
|
||||||
|
|
||||||
|
// str += (" DATA SIZE: "); str += (dec.gotAccept.getDataSize()); str += "\n";
|
||||||
|
str += (" ADDRESS FROM: "); str += (dec.gotAccept.getAddrFrom()); str += "\n";
|
||||||
|
// str += (" ADDRESS TO: "); str += (dec.gotAccept.getAddrTo()); str += "\n";
|
||||||
|
// str += (" CRC PACK: "); str += (dec.gotAccept.getCrcIN()); str += "\n";
|
||||||
|
// str += (" CRC CALC: "); str += (dec.gotAccept.getCrcCALC()); str += "\n";
|
||||||
|
str += "\n";
|
||||||
|
|
||||||
|
str += (" Data["); str += (dec.gotAccept.getCustomByte()); str += ("]: \n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
str += ("\n*******ErrAll: "); str += (dec.gotAccept.getErrorCount()); str += "\n";
|
||||||
|
str += ("**ErrDistance: "); str += ((int)(dec.gotAccept.getErrorHighSignal() - dec.gotAccept.getErrorLowSignal())); str += "\n";
|
||||||
|
|
||||||
|
str += "\n";
|
||||||
|
} else {
|
||||||
|
str += ("SELF"); str += "\n";
|
||||||
|
str += "\n";
|
||||||
|
}
|
||||||
|
// obj->resetAvailable();
|
||||||
|
Serial.write(str.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dec.gotRequest.available()) {
|
||||||
|
String str;
|
||||||
|
if (/* dec.gotData.getDataPrt()[1] */1) {
|
||||||
|
str += ("Request on pin "); str += (dec.isrPin); str += "\n";
|
||||||
|
|
||||||
|
uint8_t msg = dec.gotRequest.getMsgRAW();
|
||||||
|
str += (" MSG: ");
|
||||||
|
for (size_t i = 0; i < 8; i++) {
|
||||||
|
if (i == 3) str += " ";
|
||||||
|
str += (msg >> (7 - i)) & 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
str += "\n";
|
||||||
|
|
||||||
|
// str += (" DATA SIZE: "); str += (dec.gotRequest.getDataSize()); str += "\n";
|
||||||
|
str += (" ADDRESS FROM: "); str += (dec.gotRequest.getAddrFrom()); str += "\n";
|
||||||
|
str += (" ADDRESS TO: "); str += (dec.gotRequest.getAddrTo()); str += "\n";
|
||||||
|
// str += (" CRC PACK: "); str += (dec.gotRequest.getCrcIN()); str += "\n";
|
||||||
|
// str += (" CRC CALC: "); str += (dec.gotRequest.getCrcCALC()); str += "\n";
|
||||||
|
str += "\n";
|
||||||
|
|
||||||
|
|
||||||
|
str += ("\n*******ErrAll: "); str += (dec.gotRequest.getErrorCount()); str += "\n";
|
||||||
|
str += ("**ErrDistance: "); str += ((int)(dec.gotRequest.getErrorHighSignal() - dec.gotRequest.getErrorLowSignal())); str += "\n";
|
||||||
|
|
||||||
|
str += "\n";
|
||||||
|
} else {
|
||||||
|
str += ("SELF"); str += "\n";
|
||||||
|
str += "\n";
|
||||||
|
}
|
||||||
|
// obj->resetAvailable();
|
||||||
|
Serial.write(str.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class IR_Decoder : public IR_DecoderRaw {
|
|||||||
bool isWaitingAcceptSend;
|
bool isWaitingAcceptSend;
|
||||||
uint16_t addrAcceptSendTo;
|
uint16_t addrAcceptSendTo;
|
||||||
|
|
||||||
|
uint16_t acceptDelay = 75;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -56,4 +56,11 @@ public:
|
|||||||
isWaitingAcceptSend = false;
|
isWaitingAcceptSend = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAcceptDelay(uint16_t acceptDelay){
|
||||||
|
this->acceptDelay = acceptDelay;
|
||||||
|
}
|
||||||
|
uint16_t getAcceptDelay(){
|
||||||
|
return this->acceptDelay;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user