mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
debug
This commit is contained in:
parent
fdcb22b1a1
commit
b05b9dc9d5
@ -304,8 +304,14 @@ void IR_Decoder::tick() {
|
||||
if (aroundRise(risePeriod)) { // тактирование есть, сигнал хороший - без ошибок(?)
|
||||
|
||||
if (highTime > riseTimeMin >> 1) { // 1
|
||||
#ifdef IRDEBUG
|
||||
digitalWrite(wrHigh, 1);
|
||||
#endif
|
||||
writeToBuffer(HIGH);
|
||||
} else { // 0
|
||||
#ifdef IRDEBUG
|
||||
digitalWrite(wrLow, 1);
|
||||
#endif
|
||||
writeToBuffer(LOW);
|
||||
}
|
||||
|
||||
@ -317,27 +323,49 @@ void IR_Decoder::tick() {
|
||||
if (highCount == 0 && highTime > riseTime / 3) { // fix короткой единицы (?)после пропуска нулей(?)
|
||||
highCount++;
|
||||
errorCounter++;
|
||||
#ifdef IRDEBUG
|
||||
errPulse(errOut, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (lowCount + highCount > allCount) { // fix ошибочных сдвигов
|
||||
if (lowCount > highCount) { // Лишние нули
|
||||
lowCount = allCount - highCount;
|
||||
#ifdef IRDEBUG
|
||||
errPulse(errOut, 3);
|
||||
#endif
|
||||
} else if (lowCount < highCount) { // Лишние единицы
|
||||
highCount = allCount - lowCount;
|
||||
#ifdef IRDEBUG
|
||||
errPulse(errOut, 4);
|
||||
#endif
|
||||
} else if (lowCount == highCount) {} // неизвестный случай
|
||||
errorCounter += allCount;
|
||||
}
|
||||
|
||||
errorCounter += allCount;
|
||||
#ifdef IRDEBUG
|
||||
errPulse(errOut, 1);
|
||||
#endif
|
||||
|
||||
for (int8_t i = 0; i < lowCount && 8 - i; i++) { // отправка LOW битов, если есть
|
||||
writeToBuffer(LOW);
|
||||
#ifdef IRDEBUG
|
||||
digitalWrite(wrLow, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (int8_t i = 0; i < highCount && 8 - i; i++) { // отправка HIGH битов, если есть
|
||||
writeToBuffer(HIGH);
|
||||
#ifdef IRDEBUG
|
||||
digitalWrite(wrHigh, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef IRDEBUG
|
||||
digitalWrite(wrHigh, 0);
|
||||
digitalWrite(wrLow, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (risePeriod > riseTimeMax / 2 || highCount || lowCount) { // комплексный фикс рваной единицы
|
||||
@ -345,7 +373,9 @@ void IR_Decoder::tick() {
|
||||
prevRise = currentFront.time;
|
||||
} else {
|
||||
errorCounter++;
|
||||
|
||||
#ifdef IRDEBUG
|
||||
errPulse(errOut, 5);
|
||||
#endif
|
||||
}
|
||||
|
||||
} else { // Если ```\__ ↓
|
||||
@ -354,7 +384,9 @@ void IR_Decoder::tick() {
|
||||
prevPrevFall = prevFall;
|
||||
prevFall = currentFront.time;
|
||||
} else {
|
||||
|
||||
#ifdef IRDEBUG
|
||||
//errPulse(errOut, 5);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,9 +394,11 @@ void IR_Decoder::tick() {
|
||||
prevRise = currentFront.time + riseTime;
|
||||
}
|
||||
|
||||
|
||||
#ifdef IRDEBUG
|
||||
digitalWrite(writeOp, isPreamb);
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
firstUnHandledFront = firstUnHandledFront->next; //переместить флаг на следующий элемент (next or nullptr)
|
||||
firstUnHandledFront = firstUnHandledFront->next; //переместить флаг на следующий элемент для обработки (next or nullptr)
|
||||
}
|
||||
|
||||
void IR_Decoder::isr() { // в прерывании вызываем isr()
|
||||
|
Loading…
x
Reference in New Issue
Block a user