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()
|
void IR_Decoder::_tick()
|
||||||
{
|
{
|
||||||
IR_DecoderRaw::tick();
|
IR_DecoderRaw::tick();
|
||||||
|
|
||||||
if (availableRaw())
|
if (availableRaw())
|
||||||
{
|
{
|
||||||
#ifdef IRDEBUG_INFO
|
#ifdef IRDEBUG_INFO
|
||||||
@ -102,4 +103,8 @@ void IR_Decoder::_tick()
|
|||||||
encoder->sendAccept(addrAcceptSendTo, acceptCustomByte);
|
encoder->sendAccept(addrAcceptSendTo, acceptCustomByte);
|
||||||
isWaitingAcceptSend = false;
|
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 enable();
|
||||||
void disable();
|
void disable();
|
||||||
|
|
||||||
|
bool isReceive(uint8_t type);
|
||||||
|
|
||||||
~IR_Decoder();
|
~IR_Decoder();
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@ inline void IR_DecoderRaw::checkTimeout()
|
|||||||
if (micros() - lastEdgeTime > IR_timeout * 2U)
|
if (micros() - lastEdgeTime > IR_timeout * 2U)
|
||||||
{
|
{
|
||||||
isRecive = false; // приём завершён
|
isRecive = false; // приём завершён
|
||||||
|
msgTypeReceive = 0;
|
||||||
// firstRX(); // подготовка к новому пакету
|
// firstRX(); // подготовка к новому пакету
|
||||||
lastEdgeTime = micros(); // защита от повторного срабатывания
|
lastEdgeTime = micros(); // защита от повторного срабатывания
|
||||||
}
|
}
|
||||||
@ -475,6 +476,7 @@ void IR_DecoderRaw::writeToBuffer(bool bit)
|
|||||||
{
|
{
|
||||||
isRecive = false;
|
isRecive = false;
|
||||||
isReciveRaw = false;
|
isReciveRaw = false;
|
||||||
|
msgTypeReceive = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,6 +601,7 @@ void IR_DecoderRaw::writeToBuffer(bool bit)
|
|||||||
|
|
||||||
isRecive = false;
|
isRecive = false;
|
||||||
isReciveRaw = false;
|
isReciveRaw = false;
|
||||||
|
msgTypeReceive = 0;
|
||||||
isAvailable = crcCheck(packSize - crcBytes, crcValue);
|
isAvailable = crcCheck(packSize - crcBytes, crcValue);
|
||||||
|
|
||||||
#ifdef BRUTEFORCE_CHECK
|
#ifdef BRUTEFORCE_CHECK
|
||||||
@ -629,6 +632,12 @@ void IR_DecoderRaw::writeToBuffer(bool bit)
|
|||||||
OUT_BRUTEFORCE:;
|
OUT_BRUTEFORCE:;
|
||||||
#endif
|
#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;
|
friend IR_Encoder;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PackInfo packInfo;
|
PackInfo packInfo;
|
||||||
IR_Encoder *encoder; // Указатель на парный передатчик
|
uint8_t msgTypeReceive = 0;
|
||||||
bool availableRaw();
|
IR_Encoder *encoder; // Указатель на парный передатчик
|
||||||
|
bool availableRaw();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
Reference in New Issue
Block a user