isReceive type

This commit is contained in:
2025-05-23 11:43:51 +03:00
parent 021e1e290d
commit bc9563fbb5
4 changed files with 21 additions and 4 deletions

View File

@ -61,6 +61,7 @@ void IR_Decoder::tick()
void IR_Decoder::_tick()
{
IR_DecoderRaw::tick();
if (availableRaw())
{
#ifdef IRDEBUG_INFO
@ -103,3 +104,7 @@ void IR_Decoder::_tick()
isWaitingAcceptSend = false;
}
}
bool IR_Decoder::isReceive(uint8_t type) {
return (msgTypeReceive & 0b11111000) && ((msgTypeReceive & IR_MASK_MSG_TYPE) == type);
}

View File

@ -32,6 +32,8 @@ public:
void enable();
void disable();
bool isReceive(uint8_t type);
~IR_Decoder();
static void tick();

View File

@ -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);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -32,6 +32,7 @@ class IR_DecoderRaw : virtual public IR_FOX
protected:
PackInfo packInfo;
uint8_t msgTypeReceive = 0;
IR_Encoder *encoder; // Указатель на парный передатчик
bool availableRaw();