fix multiBlind

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

View File

@ -62,26 +62,15 @@ void IR_Decoder::tick() {
////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (currentFront.time - prevRise > IR_timeout) { // первый
// if (!currentFront.dir) { // ↓
errorCounter = 0;
isRecive = true;
isPreamb = true;
// preambFrontCounter = preambFronts - 1U;
// } else { // ↑
riseSyncTime = bitTime /* 1100 */;
start_RX();
preambFrontCounter = preambFronts - 1U;
// }
// Serial.println();
// Serial.print("currentFront.time: "); Serial.println(currentFront.time);
// Serial.print("currentFront.dir: "); Serial.println(currentFront.dir ? "UP" : "Down");
// Serial.print("prevRise: "); Serial.println(prevRise);
// Serial.print("preambFrontCounter: "); Serial.println(preambFrontCounter);
// prevRise = currentFront.time;
}
if (preambFrontCounter > 0) { // в преамбуле

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;

View File

@ -80,6 +80,8 @@ typedef uint16_t crc_t;
#define preambPulse 3
#define disablePairDec false // Отключать парный приёмник, возможны баги, используйте setBlindDecoders()
/////////////////////////////////////////////////////////////////////////////////////
#define bitPerByte 8U // Колличество бит в байте