diff --git a/IR_Encoder.cpp b/IR_Encoder.cpp index 48dcb28..a6eb956 100644 --- a/IR_Encoder.cpp +++ b/IR_Encoder.cpp @@ -76,7 +76,11 @@ void IR_Encoder::sendData(uint16_t addrTo, uint8_t dataByte, bool needAccept) sendData(addrTo, &dataByte, 1, needAccept); } -void IR_Encoder::sendData(uint16_t addrTo, uint8_t *data, uint8_t len, bool needAccept) +void IR_Encoder::sendData(uint16_t addrTo, uint8_t *data = nullptr, uint8_t len = 0, bool needAccept = false){ + sendData(id, addrTo, data, len, needAccept); +} + +void IR_Encoder::sendData(uint16_t addrFrom, uint16_t addrTo, uint8_t *data = nullptr, uint8_t len = 0, bool needAccept = false) { if (len > bytePerPack) { @@ -93,8 +97,8 @@ void IR_Encoder::sendData(uint16_t addrTo, uint8_t *data, uint8_t len, bool need sendBuffer[0] = msgType; // addr_self - sendBuffer[1] = id >> 8 & 0xFF; - sendBuffer[2] = id & 0xFF; + sendBuffer[1] = addrFrom >> 8 & 0xFF; + sendBuffer[2] = addrFrom & 0xFF; // addr_to sendBuffer[3] = addrTo >> 8 & 0xFF; diff --git a/IR_Encoder.h b/IR_Encoder.h index 27970a9..9145f68 100644 --- a/IR_Encoder.h +++ b/IR_Encoder.h @@ -10,7 +10,7 @@ class IR_Encoder : public IR_FOX public: private: - uint16_t id; /// @brief Адрес передатчика + // uint16_t id; /// @brief Адрес передатчика public: /// @brief Класс передатчика /// @param addr Адрес передатчика @@ -27,6 +27,8 @@ public: void sendData(uint16_t addrTo, uint8_t dataByte, bool needAccept = false); void sendData(uint16_t addrTo, uint8_t *data = nullptr, uint8_t len = 0, bool needAccept = false); + void sendData(uint16_t addrFrom, uint16_t addrTo, uint8_t *data = nullptr, uint8_t len = 0, bool needAccept = false); + void sendAccept(uint16_t addrTo, uint8_t customByte = 0); void sendRequest(uint16_t addrTo);