From 645fbc6911bea54f2d607c945472bc9a369ea1c5 Mon Sep 17 00:00:00 2001 From: ukw Date: Tue, 1 Jul 2014 08:28:14 +0000 Subject: [PATCH] Version 2.5.5: IRMP port to PIC XC8 compiler, removed variadic macros for microcontroller compilers :-( git-svn-id: svn://mikrocontroller.net/irmp@132 aeb2e35e-bfc4-4214-b83c-9e8de998ed28 --- irmp.c | 304 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 293 insertions(+), 11 deletions(-) diff --git a/irmp.c b/irmp.c index 872b86c..9565a9c 100644 --- a/irmp.c +++ b/irmp.c @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.150 2014/07/01 07:50:33 fm Exp $ + * $Id: irmp.c,v 1.151 2014/07/01 08:27:22 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -474,6 +474,8 @@ static int silent; static int time_counter; static int verbose; + +/******************************* not every PIC compiler knows variadic macros :-( #else # define ANALYZE_PUTCHAR(a) # define ANALYZE_ONLY_NORMAL_PUTCHAR(a) @@ -485,6 +487,7 @@ static int verbose; # define ANALYZE_ONLY_NORMAL_PRINTF(...) # endif # define ANALYZE_NEWLINE() +*********************************/ #endif #if IRMP_USE_CALLBACK == 1 @@ -1765,7 +1768,9 @@ irmp_get_data (IRMP_DATA * irmp_data_p) } else if (irmp_address == 0x87EE) { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to APPLE protocol\n"); +#endif irmp_protocol = IRMP_APPLE_PROTOCOL; irmp_address = (irmp_command & 0xFF00) >> 8; irmp_command &= 0x00FF; @@ -1814,7 +1819,9 @@ irmp_get_data (IRMP_DATA * irmp_data_p) } else { +#ifdef ANALYZE ANALYZE_PRINTF("Info IR60: got start instruction frame\n"); +#endif } break; #endif @@ -1849,12 +1856,16 @@ irmp_get_data (IRMP_DATA * irmp_data_p) } else { +#ifdef ANALYZE ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n"); +#endif } } else { +#ifdef ANALYZE ANALYZE_PRINTF("error NETBOX: last bit not set\n"); +#endif } break; #endif @@ -1870,7 +1881,9 @@ irmp_get_data (IRMP_DATA * irmp_data_p) } else { +#ifdef ANALYZE ANALYZE_PRINTF ("CRC error in LEGO protocol\n"); +#endif // rtc = TRUE; // don't accept codes with CRC errors } break; @@ -2185,7 +2198,9 @@ irmp_ISR (void) #ifdef ANALYZE if (! irmp_pulse_time) { +#ifdef ANALYZE ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter * 1000) / F_INTERRUPTS); +#endif } #endif irmp_pulse_time++; // increment counter @@ -2230,7 +2245,9 @@ irmp_ISR (void) if (denon_repetition_len >= DENON_AUTO_REPETITION_PAUSE_LEN && last_irmp_denon_command != 0) { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n", +#endif (double) (time_counter * 1000) / F_INTERRUPTS); last_irmp_denon_command = 0; denon_repetition_len = 0xFFFF; @@ -2264,8 +2281,10 @@ irmp_ISR (void) else #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1 { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms error 1: pause after start bit pulse %d too long: %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif } // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // reset flags, let's wait for another start bit @@ -2281,15 +2300,19 @@ irmp_ISR (void) irmp_param2.protocol = 0; #endif +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_pulse_time, irmp_pause_time); +#endif #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1 if (irmp_pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX) { // it's SIRCS +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX, SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) (IRMP_PARAMETER *) &sircs_param; } else @@ -2300,9 +2323,11 @@ irmp_ISR (void) irmp_pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= JVC_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", JVC_START_BIT_PULSE_LEN_MIN, JVC_START_BIT_PULSE_LEN_MAX, JVC_REPEAT_START_BIT_PAUSE_LEN_MIN, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else @@ -2313,14 +2338,18 @@ irmp_ISR (void) irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX) { #if IRMP_SUPPORT_NEC42_PROTOCOL == 1 +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &nec42_param; #else +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &nec_param; #endif } @@ -2330,17 +2359,21 @@ irmp_ISR (void) #if IRMP_SUPPORT_JVC_PROTOCOL == 1 if (irmp_protocol == IRMP_JVC_PROTOCOL) // last protocol was JVC, awaiting repeat frame { // some jvc remote controls use nec repetition frame for jvc repetition frame +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1 { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param; } @@ -2352,9 +2385,11 @@ irmp_ISR (void) irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= NEC_0_PAUSE_LEN_MIN && irmp_pause_time <= NEC_0_PAUSE_LEN_MAX) { // it's JVC repetition type 3 +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX, NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else @@ -2366,9 +2401,11 @@ irmp_ISR (void) if (irmp_pulse_time >= TELEFUNKEN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= TELEFUNKEN_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", TELEFUNKEN_START_BIT_PULSE_LEN_MIN, TELEFUNKEN_START_BIT_PULSE_LEN_MAX, TELEFUNKEN_START_BIT_PAUSE_LEN_MIN, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &telefunken_param; } else @@ -2378,9 +2415,11 @@ irmp_ISR (void) if (irmp_pulse_time >= ROOMBA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= ROOMBA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ROOMBA_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", ROOMBA_START_BIT_PULSE_LEN_MIN, ROOMBA_START_BIT_PULSE_LEN_MAX, ROOMBA_START_BIT_PAUSE_LEN_MIN, ROOMBA_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &roomba_param; } else @@ -2390,9 +2429,11 @@ irmp_ISR (void) if (irmp_pulse_time >= NIKON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NIKON_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= NIKON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NIKON_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX, NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &nikon_param; } else @@ -2402,9 +2443,11 @@ irmp_ISR (void) if (irmp_pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX) { // it's SAMSUNG +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX, SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &samsung_param; } else @@ -2414,9 +2457,11 @@ irmp_ISR (void) if (irmp_pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX) { // it's MATSUSHITA +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX, MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &matsushita_param; } else @@ -2426,9 +2471,11 @@ irmp_ISR (void) if (irmp_pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX) { // it's KASEIKYO +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX, KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param; } else @@ -2438,9 +2485,11 @@ irmp_ISR (void) if (irmp_pulse_time >= RADIO1_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RADIO1_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= RADIO1_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RADIO1_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RADIO1_START_BIT_PULSE_LEN_MIN, RADIO1_START_BIT_PULSE_LEN_MAX, RADIO1_START_BIT_PAUSE_LEN_MIN, RADIO1_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &radio1_param; } else @@ -2450,9 +2499,11 @@ irmp_ISR (void) if (irmp_pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX) { // it's RECS80 +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX, RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &recs80_param; } else @@ -2468,6 +2519,7 @@ irmp_ISR (void) if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RC5 or FDC\n"); ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, @@ -2475,6 +2527,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX); +#endif memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER)); } else @@ -2484,6 +2537,7 @@ irmp_ISR (void) if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n"); ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, @@ -2491,16 +2545,19 @@ irmp_ISR (void) ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX); +#endif memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER)); } else #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1 { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n", RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX, RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX, 2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX); +#endif } irmp_param_p = (IRMP_PARAMETER *) &rc5_param; @@ -2525,10 +2582,12 @@ irmp_ISR (void) ((irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) || (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX))) { // it's DENON +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n", DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX, DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX, DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &denon_param; } else @@ -2539,10 +2598,12 @@ irmp_ISR (void) ((irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX) || (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX))) { // it's THOMSON +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n", THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX, THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX, THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &thomson_param; } else @@ -2552,9 +2613,11 @@ irmp_ISR (void) if (irmp_pulse_time >= BOSE_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= BOSE_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= BOSE_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BOSE_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", BOSE_START_BIT_PULSE_LEN_MIN, BOSE_START_BIT_PULSE_LEN_MAX, BOSE_START_BIT_PAUSE_LEN_MIN, BOSE_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &bose_param; } else @@ -2564,9 +2627,11 @@ irmp_ISR (void) if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX) { // it's RC6 +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX, RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &rc6_param; last_pause = 0; last_value = 1; @@ -2578,9 +2643,11 @@ irmp_ISR (void) if (irmp_pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX) { // it's RECS80EXT +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX, RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param; } else @@ -2590,9 +2657,11 @@ irmp_ISR (void) if (irmp_pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX) { // it's NUBERT +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX, NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &nubert_param; } else @@ -2602,9 +2671,11 @@ irmp_ISR (void) if (irmp_pulse_time >= SPEAKER_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SPEAKER_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= SPEAKER_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SPEAKER_START_BIT_PAUSE_LEN_MAX) { // it's SPEAKER +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", SPEAKER_START_BIT_PULSE_LEN_MIN, SPEAKER_START_BIT_PULSE_LEN_MAX, SPEAKER_START_BIT_PAUSE_LEN_MIN, SPEAKER_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &speaker_param; } else @@ -2614,6 +2685,7 @@ irmp_ISR (void) if (irmp_pulse_time >= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX && irmp_pause_time >= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX) { // it's BANG_OLUFSEN +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n"); ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n", BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX, @@ -2627,6 +2699,7 @@ irmp_ISR (void) ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n", BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param; last_value = 0; } @@ -2637,9 +2710,11 @@ irmp_ISR (void) if (irmp_pulse_time >= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN && irmp_pulse_time <= GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX && irmp_pause_time >= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX) { // it's GRUNDIG +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &grundig_param; last_pause = irmp_pause_time; last_value = 1; @@ -2653,11 +2728,13 @@ irmp_ISR (void) ((irmp_pause_time >= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX) || (irmp_pause_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX))) { // it's RUWIDO or SIEMENS +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n", SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &ruwido_param; last_pause = irmp_pause_time; last_value = 1; @@ -2669,9 +2746,11 @@ irmp_ISR (void) if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &fdc_param; } else @@ -2681,9 +2760,11 @@ irmp_ISR (void) if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX, RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &rccar_param; } else @@ -2693,9 +2774,11 @@ irmp_ISR (void) if (irmp_pulse_time >= KATHREIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX) { // it's KATHREIN +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", KATHREIN_START_BIT_PULSE_LEN_MIN, KATHREIN_START_BIT_PULSE_LEN_MAX, KATHREIN_START_BIT_PAUSE_LEN_MIN, KATHREIN_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &kathrein_param; } else @@ -2705,9 +2788,11 @@ irmp_ISR (void) if (irmp_pulse_time >= NETBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NETBOX_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= NETBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NETBOX_START_BIT_PAUSE_LEN_MAX) { // it's NETBOX +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", NETBOX_START_BIT_PULSE_LEN_MIN, NETBOX_START_BIT_PULSE_LEN_MAX, NETBOX_START_BIT_PAUSE_LEN_MIN, NETBOX_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &netbox_param; } else @@ -2717,9 +2802,11 @@ irmp_ISR (void) if (irmp_pulse_time >= LEGO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= LEGO_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= LEGO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= LEGO_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", LEGO_START_BIT_PULSE_LEN_MIN, LEGO_START_BIT_PULSE_LEN_MAX, LEGO_START_BIT_PAUSE_LEN_MIN, LEGO_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &lego_param; } else @@ -2729,9 +2816,11 @@ irmp_ISR (void) if (irmp_pulse_time >= A1TVBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= A1TVBOX_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= A1TVBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= A1TVBOX_START_BIT_PAUSE_LEN_MAX) { // it's A1TVBOX +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", A1TVBOX_START_BIT_PULSE_LEN_MIN, A1TVBOX_START_BIT_PULSE_LEN_MAX, A1TVBOX_START_BIT_PAUSE_LEN_MIN, A1TVBOX_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &a1tvbox_param; last_pause = 0; last_value = 1; @@ -2743,9 +2832,11 @@ irmp_ISR (void) if (irmp_pulse_time >= ORTEK_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ORTEK_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= ORTEK_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ORTEK_START_BIT_PAUSE_LEN_MAX) { // it's ORTEK (Hama) +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", ORTEK_START_BIT_PULSE_LEN_MIN, ORTEK_START_BIT_PULSE_LEN_MAX, ORTEK_START_BIT_PAUSE_LEN_MIN, ORTEK_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &ortek_param; last_pause = 0; last_value = 1; @@ -2758,15 +2849,19 @@ irmp_ISR (void) if (irmp_pulse_time >= RCMM32_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCMM32_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= RCMM32_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_START_BIT_PAUSE_LEN_MAX) { // it's RCMM +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n", RCMM32_START_BIT_PULSE_LEN_MIN, RCMM32_START_BIT_PULSE_LEN_MAX, RCMM32_START_BIT_PAUSE_LEN_MIN, RCMM32_START_BIT_PAUSE_LEN_MAX); +#endif irmp_param_p = (IRMP_PARAMETER *) &rcmm_param; } else #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1 { +#ifdef ANALYZE ANALYZE_PRINTF ("protocol = UNKNOWN\n"); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // wait for another start bit... } @@ -2775,27 +2870,32 @@ irmp_ISR (void) { memcpy_P (&irmp_param, irmp_param_p, sizeof (IRMP_PARAMETER)); -#ifdef ANALYZE if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) { +#ifdef ANALYZE ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max); ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max); +#endif } else { +#ifdef ANALYZE ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max, 2 * irmp_param.pulse_1_len_min, 2 * irmp_param.pulse_1_len_max); ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max, 2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max); +#endif } #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) if (irmp_param2.protocol) { +#ifdef ANALYZE ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2.pulse_0_len_min, irmp_param2.pulse_0_len_max); ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2.pause_0_len_min, irmp_param2.pause_0_len_max); ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2.pulse_1_len_min, irmp_param2.pulse_1_len_max); ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2.pause_1_len_min, irmp_param2.pause_1_len_max); +#endif } #endif @@ -2803,31 +2903,40 @@ irmp_ISR (void) #if IRMP_SUPPORT_RC6_PROTOCOL == 1 if (irmp_param.protocol == IRMP_RC6_PROTOCOL) { +#ifdef ANALYZE ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX); +#endif } #endif if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) { +#ifdef ANALYZE ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max); ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max); +#endif } else { +#ifdef ANALYZE ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max, 2 * irmp_param.pulse_0_len_min, 2 * irmp_param.pulse_0_len_max); ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max, 2 * irmp_param.pause_0_len_min, 2 * irmp_param.pause_0_len_max); +#endif } #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1 if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL) { +#ifdef ANALYZE ANALYZE_PRINTF ("pulse_r: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max); ANALYZE_PRINTF ("pause_r: %3d - %3d\n", BANG_OLUFSEN_R_PAUSE_LEN_MIN, BANG_OLUFSEN_R_PAUSE_LEN_MAX); +#endif } #endif +#ifdef ANALYZE ANALYZE_PRINTF ("command_offset: %2d\n", irmp_param.command_offset); ANALYZE_PRINTF ("command_len: %3d\n", irmp_param.command_end - irmp_param.command_offset); ANALYZE_PRINTF ("complete_len: %3d\n", irmp_param.complete_len); @@ -2844,17 +2953,20 @@ irmp_ISR (void) { if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= 2 * irmp_param.pulse_1_len_max) { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1'); ANALYZE_NEWLINE (); +#endif irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1); } else if (! last_value) // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max) { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); - ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0'); ANALYZE_NEWLINE (); +#endif irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0); } } @@ -2873,19 +2985,25 @@ irmp_ISR (void) #if IRMP_SUPPORT_DENON_PROTOCOL == 1 if (irmp_param.protocol == IRMP_DENON_PROTOCOL) { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); +#endif if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) { // pause timings correct for "1"? - ANALYZE_PUTCHAR ('1'); // yes, store 1 - ANALYZE_NEWLINE (); - irmp_store_bit (1); +#ifdef ANALYZE + ANALYZE_PUTCHAR ('1'); // yes, store 1 + ANALYZE_NEWLINE (); +#endif + irmp_store_bit (1); } else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX) { // pause timings correct for "0"? - ANALYZE_PUTCHAR ('0'); // yes, store 0 - ANALYZE_NEWLINE (); - irmp_store_bit (0); +#ifdef ANALYZE + ANALYZE_PUTCHAR ('0'); // yes, store 0 + ANALYZE_NEWLINE (); +#endif + irmp_store_bit (0); } } else @@ -2893,18 +3011,24 @@ irmp_ISR (void) #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1 if (irmp_param.protocol == IRMP_THOMSON_PROTOCOL) { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); +#endif if (irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX) { // pause timings correct for "1"? +#ifdef ANALYZE ANALYZE_PUTCHAR ('1'); // yes, store 1 ANALYZE_NEWLINE (); +#endif irmp_store_bit (1); } else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX) { // pause timings correct for "0"? +#ifdef ANALYZE ANALYZE_PUTCHAR ('0'); // yes, store 0 ANALYZE_NEWLINE (); +#endif irmp_store_bit (0); } } @@ -2939,14 +3063,18 @@ irmp_ISR (void) #ifdef ANALYZE if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) { +#ifdef ANALYZE ANALYZE_PRINTF ("stop bit detected\n"); +#endif } #endif irmp_param.stop_bit = 0; } else { +#ifdef ANALYZE ANALYZE_PRINTF ("error: stop bit timing wrong, irmp_bit = %d, irmp_pulse_time = %d, pulse_0_len_min = %d, pulse_0_len_max = %d\n", +#endif irmp_bit, irmp_pulse_time, irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max); // irmp_busy_flag = FALSE; @@ -2986,7 +3114,9 @@ irmp_ISR (void) { if (irmp_pause_time > IR60_TIMEOUT_LEN && (irmp_bit == 5 || irmp_bit == 6)) { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to IR60 protocol\n"); +#endif got_light = TRUE; // this is a lie, but generates a stop bit ;-) irmp_param.stop_bit = TRUE; // set flag @@ -3008,7 +3138,9 @@ irmp_ISR (void) } else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN) { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to NOKIA protocol\n"); +#endif irmp_param.protocol = IRMP_NOKIA_PROTOCOL; // change protocol irmp_param.address_offset = NOKIA_ADDRESS_OFFSET; irmp_param.address_end = NOKIA_ADDRESS_OFFSET + NOKIA_ADDRESS_LEN; @@ -3035,7 +3167,9 @@ irmp_ISR (void) } else if (irmp_bit >= RUWIDO_COMPLETE_DATA_LEN) { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to SIEMENS protocol\n"); +#endif irmp_param.protocol = IRMP_SIEMENS_PROTOCOL; // change protocol irmp_param.address_offset = SIEMENS_ADDRESS_OFFSET; irmp_param.address_end = SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN; @@ -3089,7 +3223,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_JVC_PROTOCOL == 1 else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit); +#endif irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3101,7 +3237,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1 else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 28 || irmp_bit == 29)) // it was a LGAIR stop bit { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit); +#endif irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_LGAIR_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3115,7 +3253,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_NEC_PROTOCOL == 1 else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 32) // it was a NEC stop bit { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to NEC protocol\n"); +#endif irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_NEC_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3130,7 +3270,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_LGAIR_PROTOCOL == 1 else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 28) // it was a NEC stop bit { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to LGAIR protocol\n"); +#endif irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_LGAIR_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3141,7 +3283,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_JVC_PROTOCOL == 1 else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17)) // it was a JVC stop bit { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit); +#endif irmp_param.stop_bit = TRUE; // set flag irmp_param.protocol = IRMP_JVC_PROTOCOL; // switch protocol irmp_param.complete_len = irmp_bit; // patch length: 16 or 17 @@ -3162,12 +3306,16 @@ irmp_ISR (void) irmp_tmp_command = (irmp_tmp_address & 0xFF); // set command: lower 8 bits are command bits irmp_tmp_address >>= 8; // upper 4 bits are address bits +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit); +#endif irmp_param.protocol = IRMP_RCMM12_PROTOCOL; // switch protocol } else // if ((irmp_bit == 24) { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit); +#endif irmp_param.protocol = IRMP_RCMM24_PROTOCOL; // switch protocol } irmp_param.stop_bit = TRUE; // set flag @@ -3176,8 +3324,10 @@ irmp_ISR (void) #endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1 else { +#ifdef ANALYZE ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // wait for another start bit... @@ -3194,7 +3344,9 @@ irmp_ISR (void) if (got_light) { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time); +#endif #if IRMP_SUPPORT_MANCHESTER == 1 if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // Manchester @@ -3209,7 +3361,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_RC6_PROTOCOL == 1 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN) // RC6 toggle bit { +#ifdef ANALYZE ANALYZE_PUTCHAR ('T'); +#endif if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode 6A { irmp_store_bit (1); @@ -3220,18 +3374,24 @@ irmp_ISR (void) irmp_store_bit (0); last_value = 0; } +#ifdef ANALYZE ANALYZE_NEWLINE (); +#endif } else #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1 { +#ifdef ANALYZE ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1'); +#endif irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1 ); #if IRMP_SUPPORT_RC6_PROTOCOL == 1 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN) // RC6 toggle bit { +#ifdef ANALYZE ANALYZE_PUTCHAR ('T'); +#endif irmp_store_bit (1); if (irmp_pause_time > 2 * irmp_param.pause_1_len_max) @@ -3242,18 +3402,24 @@ irmp_ISR (void) { last_value = 1; } +#ifdef ANALYZE ANALYZE_NEWLINE (); +#endif } else #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1 { +#ifdef ANALYZE ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0'); +#endif irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0 ); #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) if (! irmp_param2.protocol) #endif { +#ifdef ANALYZE ANALYZE_NEWLINE (); +#endif } last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0; } @@ -3274,19 +3440,25 @@ irmp_ISR (void) manchester_value = last_value; } +#ifdef ANALYZE ANALYZE_PUTCHAR (manchester_value + '0'); +#endif #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) if (! irmp_param2.protocol) #endif { +#ifdef ANALYZE ANALYZE_NEWLINE (); +#endif } #if IRMP_SUPPORT_RC6_PROTOCOL == 1 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 1 && manchester_value == 1) // RC6 mode != 0 ??? { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to RC6A protocol\n"); +#endif irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG; irmp_param.address_offset = 5; irmp_param.address_end = irmp_param.address_offset + 15; @@ -3306,7 +3478,9 @@ irmp_ISR (void) ((irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) || (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX))) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('?'); +#endif irmp_param.protocol = 0; // switch to FDC, see below } else @@ -3317,16 +3491,20 @@ irmp_ISR (void) ((irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) || (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX))) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('?'); +#endif irmp_param.protocol = 0; // switch to RCCAR, see below } else #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1 { +#ifdef ANALYZE ANALYZE_PUTCHAR ('?'); ANALYZE_NEWLINE (); ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; @@ -3338,18 +3516,24 @@ irmp_ISR (void) { if (irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF (" 1 (FDC)\n"); +#endif irmp_store_bit2 (1); } else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF (" 0 (FDC)\n"); +#endif irmp_store_bit2 (0); } if (! irmp_param.protocol) { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to FDC protocol\n"); +#endif memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER)); irmp_param2.protocol = 0; irmp_tmp_address = irmp_tmp_address2; @@ -3362,18 +3546,24 @@ irmp_ISR (void) { if (irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF (" 1 (RCCAR)\n"); +#endif irmp_store_bit2 (1); } else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF (" 0 (RCCAR)\n"); +#endif irmp_store_bit2 (0); } if (! irmp_param.protocol) { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to RCCAR protocol\n"); +#endif memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER)); irmp_param2.protocol = 0; irmp_tmp_address = irmp_tmp_address2; @@ -3393,7 +3583,9 @@ irmp_ISR (void) { while (irmp_bit < irmp_param.complete_len && irmp_pulse_time > irmp_param.pulse_1_len_max) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('1'); +#endif irmp_store_bit (1); if (irmp_pulse_time >= irmp_param.pulse_1_len_min) @@ -3408,7 +3600,9 @@ irmp_ISR (void) while (irmp_bit < irmp_param.complete_len && irmp_pause_time > irmp_param.pause_1_len_max) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('0'); +#endif irmp_store_bit (0); if (irmp_pause_time >= irmp_param.pause_1_len_min) @@ -3420,7 +3614,9 @@ irmp_ISR (void) irmp_pause_time = 0; } } +#ifdef ANALYZE ANALYZE_NEWLINE (); +#endif wait_for_space = 0; } else @@ -3432,7 +3628,9 @@ irmp_ISR (void) if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX && irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("SYNC\n"); +#endif wait_for_space = 0; irmp_tmp_id = 0; irmp_bit++; @@ -3446,25 +3644,33 @@ irmp_ISR (void) if (irmp_pause_time >= SAMSUNG_1_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_1_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_NEWLINE (); +#endif irmp_store_bit (1); wait_for_space = 0; } else { +#ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); +#endif irmp_store_bit (0); wait_for_space = 0; } +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n"); +#endif } else { // timing incorrect! +#ifdef ANALYZE ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; @@ -3481,7 +3687,9 @@ irmp_ISR (void) #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1 irmp_bit == 8 && irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("Switching to NEC16 protocol\n"); +#endif irmp_param.protocol = IRMP_NEC16_PROTOCOL; irmp_param.address_offset = NEC16_ADDRESS_OFFSET; irmp_param.address_end = NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN; @@ -3502,14 +3710,18 @@ irmp_ISR (void) { if (irmp_pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("3rd start bit\n"); +#endif wait_for_space = 0; irmp_bit++; } else { // timing incorrect! +#ifdef ANALYZE ANALYZE_PRINTF ("error 3a B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; @@ -3519,14 +3731,18 @@ irmp_ISR (void) { if (irmp_pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("trailer bit\n"); +#endif wait_for_space = 0; irmp_bit++; } else { // timing incorrect! +#ifdef ANALYZE ANALYZE_PRINTF ("error 3b B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; @@ -3536,31 +3752,39 @@ irmp_ISR (void) { if (irmp_pause_time >= BANG_OLUFSEN_1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_1_PAUSE_LEN_MAX) { // pulse & pause timings correct for "1"? +#ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_NEWLINE (); +#endif irmp_store_bit (1); last_value = 1; wait_for_space = 0; } else if (irmp_pause_time >= BANG_OLUFSEN_0_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_0_PAUSE_LEN_MAX) { // pulse & pause timings correct for "0"? +#ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); +#endif irmp_store_bit (0); last_value = 0; wait_for_space = 0; } else if (irmp_pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PUTCHAR (last_value + '0'); ANALYZE_NEWLINE (); +#endif irmp_store_bit (last_value); wait_for_space = 0; } else { // timing incorrect! +#ifdef ANALYZE ANALYZE_PRINTF ("error 3c B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; @@ -3569,8 +3793,10 @@ irmp_ISR (void) } else { // timing incorrect! +#ifdef ANALYZE ANALYZE_PRINTF ("error 3d B&O: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; @@ -3584,33 +3810,43 @@ irmp_ISR (void) { if (irmp_pause_time >= RCMM32_BIT_00_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_00_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_PUTCHAR ('0'); +#endif irmp_store_bit (0); irmp_store_bit (0); } else if (irmp_pause_time >= RCMM32_BIT_01_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_01_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_PUTCHAR ('1'); +#endif irmp_store_bit (0); irmp_store_bit (1); } else if (irmp_pause_time >= RCMM32_BIT_10_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_10_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_PUTCHAR ('0'); +#endif irmp_store_bit (1); irmp_store_bit (0); } else if (irmp_pause_time >= RCMM32_BIT_11_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_11_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_PUTCHAR ('1'); +#endif irmp_store_bit (1); irmp_store_bit (1); } +#ifdef ANALYZE ANALYZE_PRINTF ("\n"); +#endif wait_for_space = 0; } else @@ -3619,16 +3855,20 @@ irmp_ISR (void) if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max) { // pulse & pause timings correct for "1"? +#ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_NEWLINE (); +#endif irmp_store_bit (1); wait_for_space = 0; } else if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max && irmp_pause_time >= irmp_param.pause_0_len_min && irmp_pause_time <= irmp_param.pause_0_len_max) { // pulse & pause timings correct for "0"? +#ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); +#endif irmp_store_bit (0); wait_for_space = 0; } @@ -3646,14 +3886,18 @@ irmp_ISR (void) if (irmp_bit == 8) { irmp_bit++; +#ifdef ANALYZE ANALYZE_PUTCHAR ('S'); ANALYZE_NEWLINE (); +#endif irmp_tmp_command <<= 1; } else { +#ifdef ANALYZE ANALYZE_PUTCHAR ('S'); ANALYZE_NEWLINE (); +#endif irmp_store_bit (1); } wait_for_space = 0; @@ -3661,8 +3905,10 @@ irmp_ISR (void) else #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL { // timing incorrect! +#ifdef ANALYZE ANALYZE_PRINTF ("error 3: timing not correct: data bit %d, pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time); ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif // irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; @@ -3699,8 +3945,10 @@ irmp_ISR (void) // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && (repetition_frame_number == 1 || repetition_frame_number == 2)) { +#ifdef ANALYZE ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); +#endif key_repetition_len = 0; } else @@ -3710,8 +3958,10 @@ irmp_ISR (void) // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL && repetition_frame_number == 1) { +#ifdef ANALYZE ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); +#endif key_repetition_len = 0; } else @@ -3721,8 +3971,10 @@ irmp_ISR (void) // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && repetition_frame_number == 1) { +#ifdef ANALYZE ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); +#endif key_repetition_len = 0; } else @@ -3732,8 +3984,10 @@ irmp_ISR (void) // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame if (irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL && (repetition_frame_number & 0x01)) { +#ifdef ANALYZE ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); +#endif key_repetition_len = 0; } else @@ -3743,8 +3997,10 @@ irmp_ISR (void) // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame if (irmp_param.protocol == IRMP_NUBERT_PROTOCOL && (repetition_frame_number & 0x01)) { +#ifdef ANALYZE ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); +#endif key_repetition_len = 0; } else @@ -3754,15 +4010,19 @@ irmp_ISR (void) // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame if (irmp_param.protocol == IRMP_SPEAKER_PROTOCOL && (repetition_frame_number & 0x01)) { +#ifdef ANALYZE ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); +#endif key_repetition_len = 0; } else #endif { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit); +#endif irmp_ir_detected = TRUE; #if IRMP_SUPPORT_DENON_PROTOCOL == 1 @@ -3781,14 +4041,18 @@ irmp_ISR (void) { if ((irmp_tmp_command & 0x01) == 0x00) { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS); +#endif last_irmp_denon_command = irmp_tmp_command; denon_repetition_len = 0; irmp_ir_detected = FALSE; } else { +#ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter * 1000) / F_INTERRUPTS); +#endif last_irmp_denon_command = 0; irmp_ir_detected = FALSE; } @@ -3800,7 +4064,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && irmp_tmp_command == 0x01ff) { // Grundig start frame? +#ifdef ANALYZE ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n"); +#endif irmp_ir_detected = FALSE; } else @@ -3809,7 +4075,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1 if (irmp_param.protocol == IRMP_NOKIA_PROTOCOL && irmp_tmp_address == 0x00ff && irmp_tmp_command == 0x00fe) { // Nokia start frame? +#ifdef ANALYZE ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n"); +#endif irmp_ir_detected = FALSE; } else @@ -3820,8 +4088,10 @@ irmp_ISR (void) { if (key_repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX) { +#ifdef ANALYZE ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len); ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME "); +#endif irmp_tmp_address = last_irmp_address; // address is last address irmp_tmp_command = last_irmp_command; // command is last command irmp_flags |= IRMP_FLAG_REPETITION; @@ -3829,7 +4099,9 @@ irmp_ISR (void) } else { +#ifdef ANALYZE ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n", +#endif key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX); irmp_ir_detected = FALSE; } @@ -3840,14 +4112,14 @@ irmp_ISR (void) if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL) { uint8_t xor_value; - // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", - // xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]); xor_value = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4); if (xor_value != (xor_check[2] & 0x0F)) { +#ifdef ANALYZE ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value, xor_check[2] & 0x0F); +#endif irmp_ir_detected = FALSE; } @@ -3855,7 +4127,9 @@ irmp_ISR (void) if (xor_value != xor_check[5]) { +#ifdef ANALYZE ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value, xor_check[5]); +#endif irmp_ir_detected = FALSE; } @@ -3868,13 +4142,17 @@ irmp_ISR (void) { if (parity == PARITY_CHECK_FAILED) { +#ifdef ANALYZE ANALYZE_PRINTF ("error 6: parity check failed\n"); +#endif irmp_ir_detected = FALSE; } if ((irmp_tmp_address & 0x03) == 0x02) { +#ifdef ANALYZE ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n"); +#endif irmp_ir_detected = FALSE; } irmp_tmp_address >>= 2; @@ -3946,7 +4224,9 @@ irmp_ISR (void) } else { +#ifdef ANALYZE ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); +#endif } // irmp_busy_flag = FALSE; @@ -4373,7 +4653,9 @@ next_tick (void) { uint8_t key; +#ifdef ANALYZE ANALYZE_ONLY_NORMAL_PUTCHAR (' '); +#endif if (verbose) { -- 2.39.2