diff --git a/IR-protocol.ino b/IR-protocol.ino index 8e93214..8e72fdd 100644 --- a/IR-protocol.ino +++ b/IR-protocol.ino @@ -66,7 +66,7 @@ Timer t1(500, millis, []() { switch (sig) { case 0: - encForward.sendData(targetAddr, data0, sizeof(data0)); + encForward.sendData(targetAddr); break; case 1: encForward.sendData(targetAddr, data1, sizeof(data1)); diff --git a/IR_DecoderRaw.cpp b/IR_DecoderRaw.cpp index c20ea30..4a5d488 100644 --- a/IR_DecoderRaw.cpp +++ b/IR_DecoderRaw.cpp @@ -103,7 +103,8 @@ void IR_DecoderRaw::tick() { } } - if (preambFrontCounter > 0) { // в преамбуле + if (preambFrontCounter) { // в преамбуле + uint32_t risePeriod; risePeriod = currentFront.time - prevRise; if (currentFront.dir && risePeriod < IR_timeout) { // __/``` ↑ и мы в внутри пакета diff --git a/IR_DecoderRaw.h b/IR_DecoderRaw.h index b7421d5..f8fd474 100644 --- a/IR_DecoderRaw.h +++ b/IR_DecoderRaw.h @@ -72,7 +72,6 @@ private: //////////////////////////////////////////////////////////////////////// uint8_t dataBuffer[dataByteSizeMax] { 0 }; // Буффер данных uint32_t prevRise, prevPrevRise, prevFall, prevPrevFall; // Время предыдущих фронтов/спадов - uint32_t risePeriod; uint16_t errorCounter = 0; // Счётчик ошибок int8_t preambFrontCounter = 0; // Счётчик __/``` ↑ преамбулы int16_t bufBitPos = 0; // Позиция для записи бита в буффер diff --git a/IR_config.h b/IR_config.h index cc4493e..e95c2b4 100644 --- a/IR_config.h +++ b/IR_config.h @@ -1,7 +1,7 @@ #pragma once #include -// #define IRDEBUG_INFO +#define IRDEBUG_INFO /*////////////////////////////////////////////////////////////////////////////////////// Для работы в паре положить декодер в энкодер @@ -66,10 +66,10 @@ customByte - контрольная сумма принятых данных п -/`````````````````````` Задний сигнал машинки без адресации ``````````````````````\        В (IR_MASK_MSG_INFO & 15U) содержится количество байт -                                                                                           сквозных команд, максимум 15 -{``````````} [````````````````````````] [````````````````````````] [``````````````]        Если полезных байт информации нет, отправляется один -{ msg type } [ addr_from uint16_t ] [====== data bytes ======] [ CRC Bytes ]        байт нулей +/`````````````````````` Задний сигнал машинки без адресации ``````````````````````\         +                                                                                            +{``````````} [````````````````````````] [````````````````````````] [``````````````]         +{ msg type } [ addr_from uint16_t ] [====== data bytes ======] [ CRC Bytes ]         {..........} [........................] [........................] [..............]                                                                                                     { 0000xxxx } [addr_from_H][addr_from_L] [data_H][data_n..][data_L] [ crc1 ][ crc2 ]