mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-06-28 05:09:40 +00:00
add Accept logic
This commit is contained in:
@ -72,17 +72,17 @@ void IR_Encoder::sendData(uint16_t addrTo, uint8_t* data, uint8_t len, bool need
|
||||
rawSend(sendBuffer, packSize);
|
||||
}
|
||||
|
||||
void IR_Encoder::sendAccept(uint16_t addrTo, uint8_t addInfo) {
|
||||
void IR_Encoder::sendAccept(uint16_t addrTo) {
|
||||
memset(sendBuffer, 0x00, dataByteSizeMax);
|
||||
sendBuffer[0] = IR_MSG_ACCEPT << 5;
|
||||
sendBuffer[0] |= addInfo & IR_MASK_MSG_INFO;
|
||||
sendBuffer[0] |= msgBytes + addrBytes + crcBytes & IR_MASK_MSG_INFO; // размер пакета
|
||||
|
||||
// addr_self
|
||||
sendBuffer[1] = id >> 8 & 0xFF;
|
||||
sendBuffer[2] = id & 0xFF;
|
||||
|
||||
Serial.print("\nRAW Accept to ");
|
||||
Serial.println(addrTo);
|
||||
// Serial.print("\nRAW Accept to ");
|
||||
// Serial.println(addrTo);
|
||||
|
||||
|
||||
// data crc
|
||||
@ -92,10 +92,10 @@ void IR_Encoder::sendAccept(uint16_t addrTo, uint8_t addInfo) {
|
||||
rawSend(sendBuffer, msgBytes + addrBytes + crcBytes);
|
||||
}
|
||||
|
||||
void IR_Encoder::sendRequest(uint16_t addrTo, uint8_t addInfo) {
|
||||
void IR_Encoder::sendRequest(uint16_t addrTo) {
|
||||
memset(sendBuffer, 0x00, dataByteSizeMax);
|
||||
sendBuffer[0] = IR_MSG_REQUEST << 5;
|
||||
sendBuffer[0] |= addInfo & IR_MASK_MSG_INFO;
|
||||
sendBuffer[0] |= msgBytes + addrBytes + addrBytes + crcBytes & IR_MASK_MSG_INFO;
|
||||
|
||||
// addr_self
|
||||
sendBuffer[1] = id >> 8 & 0xFF;
|
||||
@ -127,7 +127,7 @@ void IR_Encoder::_sendBack(bool isAdressed, uint16_t addrTo, uint8_t* data, uint
|
||||
|
||||
uint8_t packSize = msgBytes + addrBytes + (isAdressed ? addrBytes : 0) + min(1, len) + crcBytes;
|
||||
uint8_t msgType =
|
||||
((isAdressed ? IR_MSG_BACK_TO : IR_MSG_BACK)<<5) | ((packSize) & (IR_MASK_MSG_INFO >> 1));
|
||||
((isAdressed ? IR_MSG_BACK_TO : IR_MSG_BACK) << 5) | ((packSize) & (IR_MASK_MSG_INFO >> 1));
|
||||
|
||||
// формирование массива
|
||||
// msg_type
|
||||
|
Reference in New Issue
Block a user