fix multiBlind

This commit is contained in:
2024-02-13 14:33:17 +03:00
parent bfa978394f
commit 1ee3386c31
3 changed files with 13 additions and 18 deletions

View File

@ -14,20 +14,24 @@ IR_Encoder::IR_Encoder(uint16_t addr, uint8_t pin, IR_Decoder* decPair = nullptr
this->decPair = decPair;
signal = noSignal;
isSending = false;
#if disablePairDec
if(decPair != nullptr){
// blindDecoders = &decPair;/////////////////////////////////////////////////////////TODO:
// decodersCount = 1;
blindDecoders = new IR_Decoder*[1]{decPair};
decodersCount = 1;
}
#endif
};
void IR_Encoder::setBlindDecoders(IR_Decoder* decoders[], uint8_t count){
#if disablePairDec
if(blindDecoders != nullptr) delete[] blindDecoders;
#endif
decodersCount = count;
blindDecoders = decoders;
}
IR_Encoder::~IR_Encoder() {
delete [] bitHigh;
delete [] bitLow;
// delete [] sendBuffer;
delete [] bitHigh;
};
void IR_Encoder::sendData(uint16_t addrTo, uint8_t* data, uint8_t len, bool needAccept = false) {
@ -116,6 +120,7 @@ void IR_Encoder::setDecoder_isSending() {
if (decodersCount) {
for (uint8_t i = 0; i < decodersCount; i++) {
blindDecoders[i]->isPairSending ^= id;
digitalToggle(9); digitalToggle(9);
}
}
@ -132,7 +137,7 @@ void IR_Encoder::rawSend(uint8_t* ptr, uint8_t len) {
sendLen = len;
setDecoder_isSending();
Serial.println("^");
cli();
toggleCounter = preambToggle; // Первая генерация для первого signal
@ -171,7 +176,6 @@ void IR_Encoder::isr() {
// ...
isSending = false;
setDecoder_isSending();
Serial.println("^^^");
return;
break;