mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-06-27 20:59:37 +00:00
isReceive type
This commit is contained in:
@ -61,6 +61,7 @@ void IR_Decoder::tick()
|
||||
void IR_Decoder::_tick()
|
||||
{
|
||||
IR_DecoderRaw::tick();
|
||||
|
||||
if (availableRaw())
|
||||
{
|
||||
#ifdef IRDEBUG_INFO
|
||||
@ -102,4 +103,8 @@ void IR_Decoder::_tick()
|
||||
encoder->sendAccept(addrAcceptSendTo, acceptCustomByte);
|
||||
isWaitingAcceptSend = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IR_Decoder::isReceive(uint8_t type) {
|
||||
return (msgTypeReceive & 0b11111000) && ((msgTypeReceive & IR_MASK_MSG_TYPE) == type);
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
|
||||
void enable();
|
||||
void disable();
|
||||
|
||||
bool isReceive(uint8_t type);
|
||||
|
||||
~IR_Decoder();
|
||||
|
||||
|
@ -129,6 +129,7 @@ inline void IR_DecoderRaw::checkTimeout()
|
||||
if (micros() - lastEdgeTime > IR_timeout * 2U)
|
||||
{
|
||||
isRecive = false; // приём завершён
|
||||
msgTypeReceive = 0;
|
||||
// firstRX(); // подготовка к новому пакету
|
||||
lastEdgeTime = micros(); // защита от повторного срабатывания
|
||||
}
|
||||
@ -475,6 +476,7 @@ void IR_DecoderRaw::writeToBuffer(bool bit)
|
||||
{
|
||||
isRecive = false;
|
||||
isReciveRaw = false;
|
||||
msgTypeReceive = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -599,6 +601,7 @@ void IR_DecoderRaw::writeToBuffer(bool bit)
|
||||
|
||||
isRecive = false;
|
||||
isReciveRaw = false;
|
||||
msgTypeReceive = 0;
|
||||
isAvailable = crcCheck(packSize - crcBytes, crcValue);
|
||||
|
||||
#ifdef BRUTEFORCE_CHECK
|
||||
@ -629,6 +632,12 @@ void IR_DecoderRaw::writeToBuffer(bool bit)
|
||||
OUT_BRUTEFORCE:;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (packSize && (i_dataBuffer == 8)) {
|
||||
msgTypeReceive = (dataBuffer[0]>>5) | 0b11111000;
|
||||
// SerialUSB.println(msgTypeReceive & IR_MASK_MSG_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -31,9 +31,10 @@ class IR_DecoderRaw : virtual public IR_FOX
|
||||
friend IR_Encoder;
|
||||
|
||||
protected:
|
||||
PackInfo packInfo;
|
||||
IR_Encoder *encoder; // Указатель на парный передатчик
|
||||
bool availableRaw();
|
||||
PackInfo packInfo;
|
||||
uint8_t msgTypeReceive = 0;
|
||||
IR_Encoder *encoder; // Указатель на парный передатчик
|
||||
bool availableRaw();
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user