mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
fix multiBlind
This commit is contained in:
parent
bfa978394f
commit
1ee3386c31
@ -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) { // в преамбуле
|
||||
|
@ -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;
|
||||
|
||||
|
@ -80,6 +80,8 @@ typedef uint16_t crc_t;
|
||||
|
||||
#define preambPulse 3
|
||||
|
||||
#define disablePairDec false // Отключать парный приёмник, возможны баги, используйте setBlindDecoders()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define bitPerByte 8U // Колличество бит в байте
|
||||
|
Loading…
x
Reference in New Issue
Block a user