fix syncBit

This commit is contained in:
2024-02-08 17:55:10 +03:00
parent b272b6031c
commit 9cd391bda7
2 changed files with 12 additions and 4 deletions

View File

@ -24,6 +24,13 @@ IR_Encoder::~IR_Encoder() {
delete [] sendBuffer;
};
void IR_Encoder::sendData(uint16_t addrTo, uint8_t* data, uint8_t len, bool needAccept = false) {
uint8_t packSize = msgBytes + addrBytes + addrBytes + len + crcBytes;
uint8_t msgType =
((needAccept ? IR_MSG_DATA_ACCEPT : IR_MSG_DATA_NOACCEPT) << 5) | ((packSize - crcBytes) & IR_MASK_MSG_INFO);
_sendData(addrTo, data, len, msgType);
}
void IR_Encoder::sendACK(uint16_t addrTo, uint8_t addInfo, bool forAll = false) {
uint8_t* ptr = new uint8_t[msgBytes + addrBytes + crcBytes] { 0 };
@ -184,7 +191,7 @@ void IR_Encoder::isr() {
toggleCounter = currentBitSequence[!state];
dataSequenceCounter--;
} else { // Конец data, переход на следующий signal
syncLastBit = !((sendBuffer[dataByteCounter]) & 1U);
syncLastBit = ((sendBuffer[dataByteCounter]) & 1U);
dataByteCounter++;
dataBitCounter = bitPerByte - 1;
dataSequenceCounter = bitPerByte * 2;