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