X-Git-Url: http://cloudbase.mooo.com/gitweb/irmp.git/blobdiff_plain/4f571db6932806ddd5f837f8c67d219e05d70c5c..622f5f5988ba7b2cba507f65050ec09533535b12:/irmp.c diff --git a/irmp.c b/irmp.c index 099e4c4..18b523a 100644 --- a/irmp.c +++ b/irmp.c @@ -1,13 +1,11 @@ /*--------------------------------------------------------------------------------------------------------------------------------------------------- * irmp.c - infrared multi-protocol decoder, supports several remote control protocols * - * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de + * Copyright (c) 2009-2014 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.153 2014/07/01 09:04:19 fm Exp $ + * $Id: irmp.c,v 1.162 2014/09/15 10:27:37 fm Exp $ * - * ATMEGA88 @ 8 MHz - * - * Supported mikrocontrollers: + * Supported AVR mikrocontrollers: * * ATtiny87, ATtiny167 * ATtiny45, ATtiny85 @@ -498,51 +496,96 @@ static void (*irmp_callback_ptr) (uint8_t); *--------------------------------------------------------------------------------------------------------------------------------------------------- */ #if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1 -char * -irmp_protocol_names[IRMP_N_PROTOCOLS + 1] = +static const char proto_unknown[] PROGMEM = "UNKNOWN"; +static const char proto_sircs[] PROGMEM = "SIRCS"; +static const char proto_nec[] PROGMEM = "NEC"; +static const char proto_samsung[] PROGMEM = "SAMSUNG"; +static const char proto_matsushita[] PROGMEM = "MATSUSH"; +static const char proto_kaseikyo[] PROGMEM = "KASEIKYO"; +static const char proto_recs80[] PROGMEM = "RECS80"; +static const char proto_rc5[] PROGMEM = "RC5"; +static const char proto_denon[] PROGMEM = "DENON"; +static const char proto_rc6[] PROGMEM = "RC6"; +static const char proto_samsung32[] PROGMEM = "SAMSG32"; +static const char proto_apple[] PROGMEM = "APPLE"; +static const char proto_recs80ext[] PROGMEM = "RECS80EX"; +static const char proto_nubert[] PROGMEM = "NUBERT"; +static const char proto_bang_olufsen[] PROGMEM = "BANG OLU"; +static const char proto_grundig[] PROGMEM = "GRUNDIG"; +static const char proto_nokia[] PROGMEM = "NOKIA"; +static const char proto_siemens[] PROGMEM = "SIEMENS"; +static const char proto_fdc[] PROGMEM = "FDC"; +static const char proto_rccar[] PROGMEM = "RCCAR"; +static const char proto_jvc[] PROGMEM = "JVC"; +static const char proto_rc6a[] PROGMEM = "RC6A"; +static const char proto_nikon[] PROGMEM = "NIKON"; +static const char proto_ruwido[] PROGMEM = "RUWIDO"; +static const char proto_ir60[] PROGMEM = "IR60"; +static const char proto_kathrein[] PROGMEM = "KATHREIN"; +static const char proto_netbox[] PROGMEM = "NETBOX"; +static const char proto_nec16[] PROGMEM = "NEC16"; +static const char proto_nec42[] PROGMEM = "NEC42"; +static const char proto_lego[] PROGMEM = "LEGO"; +static const char proto_thomson[] PROGMEM = "THOMSON"; +static const char proto_bose[] PROGMEM = "BOSE"; +static const char proto_a1tvbox[] PROGMEM = "A1TVBOX"; +static const char proto_ortek[] PROGMEM = "ORTEK"; +static const char proto_telefunken[] PROGMEM = "TELEFUNKEN"; +static const char proto_roomba[] PROGMEM = "ROOMBA"; +static const char proto_rcmm32[] PROGMEM = "RCMM32"; +static const char proto_rcmm24[] PROGMEM = "RCMM24"; +static const char proto_rcmm12[] PROGMEM = "RCMM12"; +static const char proto_speaker[] PROGMEM = "SPEAKER"; +static const char proto_lgair[] PROGMEM = "LGAIR"; +static const char proto_samsung48[] PROGMEM = "SAMSG48"; +static const char proto_radio1[] PROGMEM = "RADIO1"; + +const char * const +irmp_protocol_names[IRMP_N_PROTOCOLS + 1] PROGMEM = { - "UNKNOWN", - "SIRCS", - "NEC", - "SAMSUNG", - "MATSUSH", - "KASEIKYO", - "RECS80", - "RC5", - "DENON", - "RC6", - "SAMSG32", - "APPLE", - "RECS80EX", - "NUBERT", - "BANG OLU", - "GRUNDIG", - "NOKIA", - "SIEMENS", - "FDC", - "RCCAR", - "JVC", - "RC6A", - "NIKON", - "RUWIDO", - "IR60", - "KATHREIN", - "NETBOX", - "NEC16", - "NEC42", - "LEGO", - "THOMSON", - "BOSE", - "A1TVBOX", - "ORTEK", - "TELEFUNKEN", - "ROOMBA", - "RCMM32", - "RCMM24", - "RCMM12", - "SPEAKER", - "LGAIR", - "RADIO1" + proto_unknown, + proto_sircs, + proto_nec, + proto_samsung, + proto_matsushita, + proto_kaseikyo, + proto_recs80, + proto_rc5, + proto_denon, + proto_rc6, + proto_samsung32, + proto_apple, + proto_recs80ext, + proto_nubert, + proto_bang_olufsen, + proto_grundig, + proto_nokia, + proto_siemens, + proto_fdc, + proto_rccar, + proto_jvc, + proto_rc6a, + proto_nikon, + proto_ruwido, + proto_ir60, + proto_kathrein, + proto_netbox, + proto_nec16, + proto_nec42, + proto_lego, + proto_thomson, + proto_bose, + proto_a1tvbox, + proto_ortek, + proto_telefunken, + proto_roomba, + proto_rcmm32, + proto_rcmm24, + proto_rcmm12, + proto_speaker, + proto_lgair, + proto_samsung48, + proto_radio1 }; #endif @@ -553,13 +596,24 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] = */ #if IRMP_LOGGING == 1 // logging via UART -#if IRMP_EXT_LOGGING == 1 // use external logging -#include "irmpextlog.h" -#else // normal UART log (IRMP_EXT_LOGGING == 0) -#define BAUD 9600L -#ifndef UNIX_OR_WINDOWS -#include -#endif +#if defined(ARM_STM32F4XX) +# define STM32_GPIO_CLOCK RCC_AHB1Periph_GPIOA // per UART2 an PA2 +# define STM32_UART_CLOCK RCC_APB1Periph_USART2 +# define STM32_GPIO_PORT GPIOA +# define STM32_GPIO_PIN GPIO_Pin_2 +# define STM32_GPIO_SOURCE GPIO_PinSource2 +# define STM32_UART_AF GPIO_AF_USART2 +# define STM32_UART_COM USART2 +# define STM32_UART_BAUD 115200 // mit 115200 Baud +# include "stm32f4xx_usart.h" +#else +# if IRMP_EXT_LOGGING == 1 // use external logging +# include "irmpextlog.h" +# else // normal UART log (IRMP_EXT_LOGGING == 0) +# define BAUD 9600L +# ifndef UNIX_OR_WINDOWS +# include +# endif #ifdef UBRR0H @@ -601,6 +655,7 @@ irmp_protocol_names[IRMP_N_PROTOCOLS + 1] = #endif //UBRR0H #endif //IRMP_EXT_LOGGING +#endif //ARM_STM32F4XX /*--------------------------------------------------------------------------------------------------------------------------------------------------- * Initialize UART @@ -611,6 +666,45 @@ void irmp_uart_init (void) { #ifndef UNIX_OR_WINDOWS +#if defined(ARM_STM32F4XX) + GPIO_InitTypeDef GPIO_InitStructure; + USART_InitTypeDef USART_InitStructure; + + // Clock enable vom TX Pin + RCC_AHB1PeriphClockCmd(STM32_GPIO_CLOCK, ENABLE); + + // Clock enable der UART + RCC_APB1PeriphClockCmd(STM32_UART_CLOCK, ENABLE); + + // UART Alternative-Funktion mit dem IO-Pin verbinden + GPIO_PinAFConfig(STM32_GPIO_PORT,STM32_GPIO_SOURCE,STM32_UART_AF); + + // UART als Alternative-Funktion mit PushPull + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; + + // TX-Pin + GPIO_InitStructure.GPIO_Pin = STM32_GPIO_PIN; + GPIO_Init(STM32_GPIO_PORT, &GPIO_InitStructure); + + // Oversampling + USART_OverSampling8Cmd(STM32_UART_COM, ENABLE); + + // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS + USART_InitStructure.USART_BaudRate = STM32_UART_BAUD; + USART_InitStructure.USART_WordLength = USART_WordLength_8b; + USART_InitStructure.USART_StopBits = USART_StopBits_1; + USART_InitStructure.USART_Parity = USART_Parity_No; + USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; + USART_InitStructure.USART_Mode = USART_Mode_Tx; + USART_Init(STM32_UART_COM, &USART_InitStructure); + + // UART enable + USART_Cmd(STM32_UART_COM, ENABLE); + +#else #if (IRMP_EXT_LOGGING == 0) // use UART UART0_UBRRH = UBRRH_VALUE; // set baud rate UART0_UBRRL = UBRRL_VALUE; @@ -624,8 +718,9 @@ irmp_uart_init (void) UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE; UART0_UCSRB |= UART0_TXEN_BIT_VALUE; // enable UART TX #else // other log method - initextlog(); + initextlog(); #endif //IRMP_EXT_LOGGING +#endif //ARM_STM32F4XX #endif // UNIX_OR_WINDOWS } @@ -639,16 +734,37 @@ void irmp_uart_putc (unsigned char ch) { #ifndef UNIX_OR_WINDOWS +#if defined(ARM_STM32F4XX) + // warten bis altes Byte gesendet wurde + while (USART_GetFlagStatus(STM32_UART_COM, USART_FLAG_TXE) == RESET) + { + ; + } + + USART_SendData(STM32_UART_COM, ch); + + if (ch == '\n') + { + while (USART_GetFlagStatus(STM32_UART_COM, USART_FLAG_TXE) == RESET); + USART_SendData(STM32_UART_COM, '\r'); + } + +#else #if (IRMP_EXT_LOGGING == 0) + while (!(UART0_UCSRA & UART0_UDRE_BIT_VALUE)) { ; } UART0_UDR = ch; + #else - sendextlog(ch); //Use external log -#endif + + sendextlog(ch); // use external log + +#endif //IRMP_EXT_LOGGING +#endif //ARM_STM32F4XX #else fputc (ch, stderr); #endif // UNIX_OR_WINDOWS @@ -663,79 +779,6 @@ irmp_uart_putc (unsigned char ch) #define ENDBITS 1000 // number of sequenced highbits to detect end #define DATALEN 700 // log buffer size -#if 0 // old log routine - -static void -irmp_log (uint8_t val) -{ - static uint8_t buf[DATALEN]; // logging buffer - static uint16_t buf_idx; // number of written bits - static uint8_t startcycles; // current number of start-zeros - static uint16_t cnt; // counts sequenced highbits - to detect end - - if (! val && (startcycles < STARTCYCLES) && !buf_idx) // prevent that single random zeros init logging - { - startcycles++; - } - else - { - startcycles = 0; - - if (! val || (val && buf_idx != 0)) // start or continue logging on "0", "1" cannot init logging - { - if (buf_idx < DATALEN * 8) // index in range? - { // yes - if (val) - { - buf[(buf_idx / 8)] |= (1<<(buf_idx % 8)); // set bit - } - else - { - buf[(buf_idx / 8)] &= ~(1<<(buf_idx % 8)); // reset bit - } - - buf_idx++; - } - - if (val) - { // if high received then look at log-stop condition - cnt++; - - if (cnt > ENDBITS) - { // if stop condition is true, output on uart - uint16_t i; - - for (i = 0; i < STARTCYCLES; i++) - { - irmp_uart_putc ('0'); // the ignored starting zeros - } - - for (i = 0; i < (buf_idx - ENDBITS + 20) / 8; i++) // transform bitset into uart chars - { - uint8_t d = buf[i]; - uint8_t j; - - for (j = 0; j < 8; j++) - { - irmp_uart_putc ((d & 1) + '0'); - d >>= 1; - } - } - - irmp_uart_putc ('\n'); - buf_idx = 0; - } - } - else - { - cnt = 0; - } - } - } -} - -#else // new log routine - static void irmp_log (uint8_t val) { @@ -824,8 +867,6 @@ irmp_log (uint8_t val) } } -#endif - #else #define irmp_log(val) #endif //IRMP_LOGGING @@ -1754,7 +1795,15 @@ irmp_get_data (IRMP_DATA * irmp_data_p) rtc = TRUE; } break; + +#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 + case IRMP_SAMSUNG48_PROTOCOL: + irmp_command = (irmp_command & 0x00FF) | ((irmp_id & 0x00FF) << 8); + rtc = TRUE; + break; #endif +#endif + #if IRMP_SUPPORT_NEC_PROTOCOL == 1 case IRMP_NEC_PROTOCOL: if ((irmp_command >> 8) == (~irmp_command & 0x00FF)) @@ -1766,7 +1815,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to APPLE protocol\n"); -#endif +#endif // ANALYZE irmp_protocol = IRMP_APPLE_PROTOCOL; irmp_address = (irmp_command & 0xFF00) >> 8; irmp_command &= 0x00FF; @@ -1817,7 +1866,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { #ifdef ANALYZE ANALYZE_PRINTF("Info IR60: got start instruction frame\n"); -#endif +#endif // ANALYZE } break; #endif @@ -1854,14 +1903,14 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { #ifdef ANALYZE ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n"); -#endif +#endif // ANALYZE } } else { #ifdef ANALYZE ANALYZE_PRINTF("error NETBOX: last bit not set\n"); -#endif +#endif // ANALYZE } break; #endif @@ -1879,7 +1928,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { #ifdef ANALYZE ANALYZE_PRINTF ("CRC error in LEGO protocol\n"); -#endif +#endif // ANALYZE // rtc = TRUE; // don't accept codes with CRC errors } break; @@ -1928,7 +1977,7 @@ irmp_set_callback_ptr (void (*cb)(uint8_t)) static uint16_t irmp_tmp_address; // ir address static uint16_t irmp_tmp_command; // ir command -#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1 +#if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1 static uint16_t irmp_tmp_address2; // ir address static uint16_t irmp_tmp_command2; // ir command #endif @@ -2024,7 +2073,16 @@ irmp_store_bit (uint8_t value) { if (irmp_param.lsb_first) { - irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - irmp_param.command_offset)); // CV wants cast +#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 + if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit >= 32) + { + irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - 32)); // CV wants cast + } + else +#endif + { + irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - irmp_param.command_offset)); // CV wants cast + } } else { @@ -2165,7 +2223,7 @@ irmp_ISR (void) #ifdef ANALYZE time_counter++; -#endif +#endif // ANALYZE irmp_input = input(IRMP_PIN); @@ -2194,11 +2252,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 +#endif // ANALYZE irmp_pulse_time++; // increment counter } else @@ -2213,6 +2269,9 @@ irmp_ISR (void) #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 genre2 = 0; #endif +#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 + irmp_tmp_id = 0; +#endif #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1 irmp_tmp_command2 = 0; @@ -2243,8 +2302,8 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n", -#endif (double) (time_counter * 1000) / F_INTERRUPTS); +#endif // ANALYZE last_irmp_denon_command = 0; denon_repetition_len = 0xFFFF; } @@ -2280,9 +2339,9 @@ irmp_ISR (void) #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 +#endif // ANALYZE } -// irmp_busy_flag = FALSE; + irmp_start_bit_detected = 0; // reset flags, let's wait for another start bit irmp_pulse_time = 0; irmp_pause_time = 0; @@ -2298,7 +2357,7 @@ irmp_ISR (void) #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 +#endif // ANALYZE #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 && @@ -2308,7 +2367,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) (IRMP_PARAMETER *) &sircs_param; } else @@ -2323,7 +2382,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else @@ -2338,14 +2397,14 @@ irmp_ISR (void) 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 +#endif // ANALYZE 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_param; #endif } @@ -2359,7 +2418,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else @@ -2369,7 +2428,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param; } @@ -2385,7 +2444,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nec_param; } else @@ -2401,7 +2460,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &telefunken_param; } else @@ -2415,7 +2474,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &roomba_param; } else @@ -2429,7 +2488,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nikon_param; } else @@ -2443,7 +2502,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &samsung_param; } else @@ -2457,7 +2516,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &matsushita_param; } else @@ -2471,7 +2530,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param; } else @@ -2485,7 +2544,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &radio1_param; } else @@ -2499,7 +2558,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &recs80_param; } else @@ -2523,7 +2582,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 +#endif // ANALYZE memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER)); } else @@ -2541,7 +2600,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 +#endif // ANALYZE memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER)); } else @@ -2553,7 +2612,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE } irmp_param_p = (IRMP_PARAMETER *) &rc5_param; @@ -2583,7 +2642,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &denon_param; } else @@ -2599,7 +2658,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &thomson_param; } else @@ -2613,7 +2672,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &bose_param; } else @@ -2627,7 +2686,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &rc6_param; last_pause = 0; last_value = 1; @@ -2643,7 +2702,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param; } else @@ -2657,7 +2716,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &nubert_param; } else @@ -2671,7 +2730,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &speaker_param; } else @@ -2695,7 +2754,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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param; last_value = 0; } @@ -2710,7 +2769,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &grundig_param; last_pause = irmp_pause_time; last_value = 1; @@ -2730,7 +2789,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &ruwido_param; last_pause = irmp_pause_time; last_value = 1; @@ -2746,7 +2805,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &fdc_param; } else @@ -2760,7 +2819,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &rccar_param; } else @@ -2774,7 +2833,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &kathrein_param; } else @@ -2788,7 +2847,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &netbox_param; } else @@ -2802,7 +2861,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &lego_param; } else @@ -2816,7 +2875,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &a1tvbox_param; last_pause = 0; last_value = 1; @@ -2832,7 +2891,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &ortek_param; last_pause = 0; last_value = 1; @@ -2849,7 +2908,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_param_p = (IRMP_PARAMETER *) &rcmm_param; } else @@ -2857,8 +2916,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("protocol = UNKNOWN\n"); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // wait for another start bit... } @@ -2871,7 +2929,7 @@ irmp_ISR (void) #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 +#endif // ANALYZE } else { @@ -2880,7 +2938,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE } #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) @@ -2891,7 +2949,7 @@ irmp_ISR (void) 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 // ANALYZE } #endif @@ -2901,7 +2959,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX); -#endif +#endif // ANALYZE } #endif @@ -2910,7 +2968,7 @@ irmp_ISR (void) #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 +#endif // ANALYZE } else { @@ -2919,20 +2977,18 @@ irmp_ISR (void) 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 +#endif // ANALYZE } +#ifdef ANALYZE #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); @@ -2953,7 +3009,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE 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) @@ -2962,7 +3018,7 @@ irmp_ISR (void) 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 +#endif // ANALYZE irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0); } } @@ -2983,14 +3039,14 @@ irmp_ISR (void) { #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 +#endif // ANALYZE if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) { // pause timings correct for "1"? #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); // yes, store 1 ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); } else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX) @@ -2998,7 +3054,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); // yes, store 0 ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); } } @@ -3009,14 +3065,14 @@ irmp_ISR (void) { #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 +#endif // ANALYZE 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 +#endif // ANALYZE irmp_store_bit (1); } else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX) @@ -3024,7 +3080,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); // yes, store 0 ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); } } @@ -3059,11 +3115,9 @@ irmp_ISR (void) #ifdef ANALYZE if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) { -#ifdef ANALYZE ANALYZE_PRINTF ("stop bit detected\n"); -#endif } -#endif +#endif // ANALYZE irmp_param.stop_bit = 0; } else @@ -3071,8 +3125,7 @@ irmp_ISR (void) #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", irmp_bit, irmp_pulse_time, irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max); -#endif -// irmp_busy_flag = FALSE; +#endif // ANALYZE irmp_start_bit_detected = 0; // wait for another start bit... irmp_pulse_time = 0; irmp_pause_time = 0; @@ -3111,7 +3164,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to IR60 protocol\n"); -#endif +#endif // ANALYZE got_light = TRUE; // this is a lie, but generates a stop bit ;-) irmp_param.stop_bit = TRUE; // set flag @@ -3135,7 +3188,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to NOKIA protocol\n"); -#endif +#endif // ANALYZE 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; @@ -3164,7 +3217,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to SIEMENS protocol\n"); -#endif +#endif // ANALYZE 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; @@ -3220,7 +3273,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE 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 @@ -3234,7 +3287,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE 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 @@ -3250,7 +3303,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to NEC protocol\n"); -#endif +#endif // ANALYZE 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 @@ -3267,7 +3320,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to LGAIR protocol\n"); -#endif +#endif // ANALYZE 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 @@ -3280,7 +3333,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE 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 @@ -3293,6 +3346,20 @@ irmp_ISR (void) } #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1 + +#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 + else if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit == 32) // it was a SAMSUNG32 stop bit + { +#ifdef ANALYZE + ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n"); +#endif // ANALYZE + irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL; + irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET; + irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN; + irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN; + } +#endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 + #if IRMP_SUPPORT_RCMM_PROTOCOL == 1 else if (irmp_param.protocol == IRMP_RCMM32_PROTOCOL && (irmp_bit == 12 || irmp_bit == 24)) // it was a RCMM stop bit { @@ -3303,14 +3370,14 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit); -#endif +#endif // ANALYZE 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 +#endif // ANALYZE irmp_param.protocol = IRMP_RCMM24_PROTOCOL; // switch protocol } irmp_param.stop_bit = TRUE; // set flag @@ -3322,9 +3389,7 @@ irmp_ISR (void) #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; +#endif // ANALYZE irmp_start_bit_detected = 0; // wait for another start bit... irmp_pulse_time = 0; irmp_pause_time = 0; @@ -3341,7 +3406,7 @@ irmp_ISR (void) { #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 +#endif // ANALYZE #if IRMP_SUPPORT_MANCHESTER == 1 if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER)) // Manchester @@ -3358,7 +3423,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('T'); -#endif +#endif // ANALYZE if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG) // RC6 mode 6A { irmp_store_bit (1); @@ -3371,14 +3436,14 @@ irmp_ISR (void) } #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE } else #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1 { #ifdef ANALYZE ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1'); -#endif +#endif // ANALYZE irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1 ); #if IRMP_SUPPORT_RC6_PROTOCOL == 1 @@ -3386,7 +3451,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('T'); -#endif +#endif // ANALYZE irmp_store_bit (1); if (irmp_pause_time > 2 * irmp_param.pause_1_len_max) @@ -3399,14 +3464,14 @@ irmp_ISR (void) } #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE } else #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1 { #ifdef ANALYZE ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0'); -#endif +#endif // ANALYZE 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) @@ -3414,7 +3479,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE } last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0; } @@ -3437,7 +3502,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR (manchester_value + '0'); -#endif +#endif // ANALYZE #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) if (! irmp_param2.protocol) @@ -3445,7 +3510,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE } #if IRMP_SUPPORT_RC6_PROTOCOL == 1 @@ -3453,7 +3518,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to RC6A protocol\n"); -#endif +#endif // ANALYZE irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG; irmp_param.address_offset = 5; irmp_param.address_end = irmp_param.address_offset + 15; @@ -3475,7 +3540,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('?'); -#endif +#endif // ANALYZE irmp_param.protocol = 0; // switch to FDC, see below } else @@ -3488,7 +3553,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('?'); -#endif +#endif // ANALYZE irmp_param.protocol = 0; // switch to RCCAR, see below } else @@ -3499,8 +3564,7 @@ irmp_ISR (void) 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; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3513,14 +3577,14 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF (" 1 (FDC)\n"); -#endif +#endif // ANALYZE 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 +#endif // ANALYZE irmp_store_bit2 (0); } @@ -3528,7 +3592,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to FDC protocol\n"); -#endif +#endif // ANALYZE memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER)); irmp_param2.protocol = 0; irmp_tmp_address = irmp_tmp_address2; @@ -3543,14 +3607,14 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF (" 1 (RCCAR)\n"); -#endif +#endif // ANALYZE 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 +#endif // ANALYZE irmp_store_bit2 (0); } @@ -3558,7 +3622,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to RCCAR protocol\n"); -#endif +#endif // ANALYZE memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER)); irmp_param2.protocol = 0; irmp_tmp_address = irmp_tmp_address2; @@ -3580,7 +3644,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); -#endif +#endif // ANALYZE irmp_store_bit (1); if (irmp_pulse_time >= irmp_param.pulse_1_len_min) @@ -3597,7 +3661,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); -#endif +#endif // ANALYZE irmp_store_bit (0); if (irmp_pause_time >= irmp_param.pause_1_len_min) @@ -3611,7 +3675,7 @@ irmp_ISR (void) } #ifdef ANALYZE ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE wait_for_space = 0; } else @@ -3625,24 +3689,35 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("SYNC\n"); -#endif +#endif // ANALYZE wait_for_space = 0; - irmp_tmp_id = 0; irmp_bit++; } else if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX) { +#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 +#ifdef ANALYZE + ANALYZE_PRINTF ("Switching to SAMSUNG48 protocol "); +#endif // ANALYZE + irmp_param.protocol = IRMP_SAMSUNG48_PROTOCOL; + irmp_param.command_offset = SAMSUNG48_COMMAND_OFFSET; + irmp_param.command_end = SAMSUNG48_COMMAND_OFFSET + SAMSUNG48_COMMAND_LEN; + irmp_param.complete_len = SAMSUNG48_COMPLETE_DATA_LEN; +#else +#ifdef ANALYZE + ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol "); +#endif // ANALYZE irmp_param.protocol = IRMP_SAMSUNG32_PROTOCOL; irmp_param.command_offset = SAMSUNG32_COMMAND_OFFSET; irmp_param.command_end = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN; irmp_param.complete_len = SAMSUNG32_COMPLETE_DATA_LEN; - +#endif 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 +#endif // ANALYZE irmp_store_bit (1); wait_for_space = 0; } @@ -3651,22 +3726,17 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE 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; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3684,7 +3754,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("Switching to NEC16 protocol\n"); -#endif +#endif // ANALYZE irmp_param.protocol = IRMP_NEC16_PROTOCOL; irmp_param.address_offset = NEC16_ADDRESS_OFFSET; irmp_param.address_end = NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN; @@ -3707,7 +3777,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("3rd start bit\n"); -#endif +#endif // ANALYZE wait_for_space = 0; irmp_bit++; } @@ -3716,8 +3786,7 @@ irmp_ISR (void) #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; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3728,7 +3797,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("trailer bit\n"); -#endif +#endif // ANALYZE wait_for_space = 0; irmp_bit++; } @@ -3737,8 +3806,7 @@ irmp_ISR (void) #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; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3750,7 +3818,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); last_value = 1; wait_for_space = 0; @@ -3760,7 +3828,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); last_value = 0; wait_for_space = 0; @@ -3770,7 +3838,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR (last_value + '0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (last_value); wait_for_space = 0; } @@ -3779,8 +3847,7 @@ irmp_ISR (void) #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; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3791,8 +3858,7 @@ irmp_ISR (void) #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; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3808,7 +3874,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_PUTCHAR ('0'); -#endif +#endif // ANALYZE irmp_store_bit (0); irmp_store_bit (0); } @@ -3817,7 +3883,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_PUTCHAR ('1'); -#endif +#endif // ANALYZE irmp_store_bit (0); irmp_store_bit (1); } @@ -3826,7 +3892,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_PUTCHAR ('0'); -#endif +#endif // ANALYZE irmp_store_bit (1); irmp_store_bit (0); } @@ -3835,13 +3901,13 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_PUTCHAR ('1'); -#endif +#endif // ANALYZE irmp_store_bit (1); irmp_store_bit (1); } #ifdef ANALYZE ANALYZE_PRINTF ("\n"); -#endif +#endif // ANALYZE wait_for_space = 0; } else @@ -3853,7 +3919,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('1'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); wait_for_space = 0; } @@ -3863,7 +3929,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('0'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (0); wait_for_space = 0; } @@ -3884,7 +3950,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('S'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_tmp_command <<= 1; } else @@ -3892,7 +3958,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PUTCHAR ('S'); ANALYZE_NEWLINE (); -#endif +#endif // ANALYZE irmp_store_bit (1); } wait_for_space = 0; @@ -3903,8 +3969,7 @@ irmp_ISR (void) #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; +#endif // ANALYZE irmp_start_bit_detected = 0; // reset flags and wait for next start bit irmp_pause_time = 0; } @@ -3943,7 +4008,7 @@ irmp_ISR (void) #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 +#endif // ANALYZE key_repetition_len = 0; } else @@ -3956,7 +4021,7 @@ irmp_ISR (void) #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 +#endif // ANALYZE key_repetition_len = 0; } else @@ -3969,20 +4034,20 @@ irmp_ISR (void) #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 +#endif // ANALYZE key_repetition_len = 0; } else #endif #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 - // 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)) + // if SAMSUNG32 or SAMSUNG48 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame + if ((irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL || irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL) && (repetition_frame_number & 0x01)) { #ifdef ANALYZE - ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n", + ANALYZE_PRINTF ("code skipped: SAMSUNG32/SAMSUNG48 auto repetition frame #%d, counter = %d, auto repetition len = %d\n", repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN); -#endif +#endif // ANALYZE key_repetition_len = 0; } else @@ -3995,7 +4060,7 @@ irmp_ISR (void) #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 +#endif // ANALYZE key_repetition_len = 0; } else @@ -4008,7 +4073,7 @@ irmp_ISR (void) #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 +#endif // ANALYZE key_repetition_len = 0; } else @@ -4017,7 +4082,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit); -#endif +#endif // ANALYZE irmp_ir_detected = TRUE; #if IRMP_SUPPORT_DENON_PROTOCOL == 1 @@ -4038,7 +4103,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS); -#endif +#endif // ANALYZE last_irmp_denon_command = irmp_tmp_command; denon_repetition_len = 0; irmp_ir_detected = FALSE; @@ -4047,7 +4112,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter * 1000) / F_INTERRUPTS); -#endif +#endif // ANALYZE last_irmp_denon_command = 0; irmp_ir_detected = FALSE; } @@ -4061,7 +4126,7 @@ irmp_ISR (void) { // Grundig start frame? #ifdef ANALYZE ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n"); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } else @@ -4072,7 +4137,7 @@ irmp_ISR (void) { // Nokia start frame? #ifdef ANALYZE ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n"); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } else @@ -4086,7 +4151,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len); ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME "); -#endif +#endif // ANALYZE 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; @@ -4097,7 +4162,7 @@ irmp_ISR (void) #ifdef ANALYZE ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n", key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } } @@ -4114,7 +4179,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value, xor_check[2] & 0x0F); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } @@ -4124,7 +4189,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value, xor_check[5]); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } @@ -4139,7 +4204,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("error 6: parity check failed\n"); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } @@ -4147,7 +4212,7 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n"); -#endif +#endif // ANALYZE irmp_ir_detected = FALSE; } irmp_tmp_address >>= 2; @@ -4221,10 +4286,9 @@ irmp_ISR (void) { #ifdef ANALYZE ANALYZE_ONLY_NORMAL_PUTCHAR ('\n'); -#endif +#endif // ANALYZE } -// irmp_busy_flag = FALSE; irmp_start_bit_detected = 0; // and wait for next start bit irmp_tmp_command = 0; irmp_pulse_time = 0; @@ -4648,9 +4712,7 @@ next_tick (void) { uint8_t key; -#ifdef ANALYZE ANALYZE_ONLY_NORMAL_PUTCHAR (' '); -#endif if (verbose) {