]> cloudbase.mooo.com Git - irmp.git/blobdiff - irmp.c
Version 2.6.0: added SAMSUNG48 protocol (in IRSND).
[irmp.git] / irmp.c
diff --git a/irmp.c b/irmp.c
index 130a5ce28d5ed0386d003bc9adbeefa8470d27f8..851c270f63beb6976962bae3598495d92798815c 100644 (file)
--- a/irmp.c
+++ b/irmp.c
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
  * irmp.c - infrared multi-protocol decoder, supports several remote control protocols\r
  *\r
- * Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de\r
+ * Copyright (c) 2009-2013 Frank Meyer - frank(at)fli4l.de\r
  *\r
- * $Id: irmp.c,v 1.104 2011/05/22 21:40:52 fm Exp $\r
+ * $Id: irmp.c,v 1.159 2014/07/09 15:31:25 fm Exp $\r
  *\r
  * ATMEGA88 @ 8 MHz\r
  *\r
- * Typical manufacturers:\r
+ * Supported mikrocontrollers:\r
  *\r
- * SIRCS        - Sony\r
- * NEC          - NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, and many other Japanese manufacturers\r
- * SAMSUNG      - Samsung\r
- * SAMSUNG32    - Samsung\r
- * MATSUSHITA   - Matsushita\r
- * KASEIKYO     - Panasonic, Denon & other Japanese manufacturers (members of "Japan's Association for Electric Home Application")\r
- * RECS80       - Philips, Nokia, Thomson, Nordmende, Telefunken, Saba\r
- * RC5          - Philips and other European manufacturers\r
- * DENON        - Denon, Sharp\r
- * RC6          - Philips and other European manufacturers\r
- * APPLE        - Apple\r
- * NUBERT       - Nubert Subwoofer System\r
- * B&O          - Bang & Olufsen\r
- * PANASONIC    - Panasonic (older, yet not implemented)\r
- * GRUNDIG      - Grundig\r
- * NOKIA        - Nokia\r
- * SIEMENS      - Siemens, e.g. Gigaset M740AV\r
- * FDC          - FDC IR keyboard\r
- * RCCAR        - IR remote control for RC cars\r
- * JVC          - JVC\r
- * THOMSON      - Thomson\r
- * NIKON        - Nikon cameras\r
- * RUWIDO       - T-Home\r
- * KATHREIN     - Kathrein\r
- * LEGO         - Lego Power Functions RC\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   SIRCS\r
- *   -----\r
- *\r
- *   frame: 1 start bit + 12-20 data bits + no stop bit\r
- *   data:  7 command bits + 5 address bits + 0 to 8 additional bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *   -----------------_________           ------_____               ------------______\r
- *       2400us         600us             600us 600us               1200us      600 us        no stop bit\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   NEC + extended NEC\r
- *   -------------------------\r
- *\r
- *   frame: 1 start bit + 32 data bits + 1 stop bit\r
- *   data NEC:          8 address bits + 8 inverted address bits + 8 command bits + 8 inverted command bits\r
- *   data extended NEC: 16 address bits + 8 command bits + 8 inverted command bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *   -----------------_________           ------______              ------________________    ------______....\r
- *       9000us        4500us             560us  560us              560us    1690 us          560us\r
- *\r
- *\r
- *   Repetition frame:\r
- *\r
- *   -----------------_________------______  .... ~100ms Pause, then repeat\r
- *       9000us        2250us   560us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   SAMSUNG\r
- *   -------\r
- *\r
- *   frame: 1 start bit + 16 data(1) bits + 1 sync bit + additional 20 data(2) bits + 1 stop bit\r
- *   data(1): 16 address bits\r
- *   data(2): 4 ID bits + 8 command bits + 8 inverted command bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 sync bit:               stop bit:\r
- *   ----------______________             ------______              ------________________    ------______________    ------______....\r
- *    4500us       4500us                 550us  450us              550us    1450us           550us    4500us         550us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   SAMSUNG32\r
- *   ----------\r
- *\r
- *   frame: 1 start bit + 32 data bits + 1 stop bit\r
- *   data: 16 address bits + 16 command bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *   ----------______________             ------______              ------________________    ------______....\r
- *    4500us       4500us                 550us  450us              550us    1450us           550us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   MATSUSHITA\r
- *   ----------\r
- *\r
- *   frame: 1 start bit + 24 data bits + 1 stop bit\r
- *   data:  6 custom bits + 6 command bits + 12 address bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *   ----------_________                  ------______              ------________________    ------______....\r
- *    3488us     3488us                   872us  872us              872us    2616us           872us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   KASEIKYO\r
- *   --------\r
- *\r
- *   frame: 1 start bit + 48 data bits + 1 stop bit\r
- *   data:  16 manufacturer bits + 4 parity bits + 4 genre1 bits + 4 genre2 bits + 10 command bits + 2 id bits + 8 parity bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *   ----------______                     ------______              ------________________    ------______....\r
- *    3380us   1690us                     423us  423us              423us    1269us           423us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   RECS80\r
- *   ------\r
- *\r
- *   frame: 2 start bits + 10 data bits + 1 stop bit\r
- *   data:  1 toggle bit + 3 address bits + 6 command bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *   -----_____________________           -----____________         -----______________       ------_______....\r
- *   158us       7432us                   158us   4902us            158us    7432us           158us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   RECS80EXT\r
- *   ---------\r
- *\r
- *   frame: 2 start bits + 11 data bits + 1 stop bit\r
- *   data:  1 toggle bit + 4 address bits + 6 command bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *   -----_____________________           -----____________         -----______________       ------_______....\r
- *   158us       3637us                   158us   4902us            158us    7432us           158us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   RC5 + RC5X\r
- *   ----------\r
- *\r
- *   RC5 frame:  2 start bits + 12 data bits + no stop bit\r
- *   RC5 data:   1 toggle bit + 5 address bits + 6 command bits\r
- *   RC5X frame: 1 start bit +  13 data bits + no stop bit\r
- *   RC5X data:  1 inverted command bit + 1 toggle bit + 5 address bits + 6 command bits\r
- *\r
- *   start bit:              data "0":                data "1":\r
- *   ______-----             ------______             ______------\r
- *   889us 889us             889us 889us              889us 889us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   DENON\r
- *   -----\r
- *\r
- *   frame: 0 start bits + 16 data bits + stop bit + 65ms pause + 16 inverted data bits + stop bit\r
- *   data:  5 address bits + 10 command bits\r
- *\r
- *   Theory:\r
- *\r
- *   data "0":                 data "1":\r
- *   ------________________    ------______________\r
- *   275us       775us         275us   1900us\r
- *\r
- *   Practice:\r
- *\r
- *   data "0":                 data "1":\r
- *   ------________________    ------______________\r
- *   310us       745us         310us   1780us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   RC6\r
- *   ---\r
- *\r
- *   RC6 frame:  1 start bit + 1 bit "1" + 3 mode bits + 1 toggle bit + 16 data bits + 2666 us pause\r
- *   RC6 data:   8 address bits + 8 command bits\r
- *\r
- *   start  bit               toggle bit "0":      toggle bit "1":     data/mode "0":      data/mode "1":\r
- *   ____________-------      _______-------       -------_______      _______-------      -------_______\r
- *      2666us    889us        889us  889us         889us  889us        444us  444us        444us  444us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   APPLE\r
- *   -----\r
- *\r
- *   frame: 1 start bit + 32 data bits + 1 stop bit\r
- *   data:  16 address bits + 11100000 + 8 command bits\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *   -----------------_________           ------______              ------________________    ------______....\r
- *       9000us        4500us             560us  560us              560us    1690 us          560us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   NUBERT (subwoofer system)\r
- *   -------------------------\r
- *\r
- *   frame: 1 start bit + 10 data bits + 1 stop bit\r
- *   data:  0 address bits + 10 command bits ?\r
- *\r
- *   start bit:                       data "0":                 data "1":                 stop bit:\r
- *   ----------_____                  ------______              ------________________    ------______....\r
- *    1340us   340us                  500us 1300us              1340us 340us              500us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   BANG_OLUFSEN\r
- *   ------------\r
- *\r
- *   frame: 4 start bits + 16 data bits + 1 trailer bit + 1 stop bit\r
- *   data:  0 address bits + 16 command bits\r
- *\r
- *   1st start bit:  2nd start bit:      3rd start bit:       4th start bit:\r
- *   -----________   -----________       -----_____________   -----________\r
- *   210us 3000us    210us 3000us        210us   15000us      210us 3000us\r
- *\r
- *   data "0":       data "1":           data "repeat bit":   trailer bit:         stop bit:\r
- *   -----________   -----_____________  -----___________     -----_____________   -----____...\r
- *   210us 3000us    210us   9000us      210us   6000us       210us   12000us      210us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   GRUNDIG\r
- *   -------\r
- *\r
- *   packet:  1 start frame + 19,968ms pause + N info frames + 117,76ms pause + 1 stop frame\r
- *   frame: 1 pre bit + 1 start bit + 9 data bits + no stop bit\r
- *   pause between info frames: 117,76ms\r
- *\r
- *   data of start frame:   9 x 1\r
- *   data of info  frame:   9 command bits\r
- *   data of stop  frame:   9 x 1\r
- *\r
- *   pre bit:              start bit           data "0":            data "1":\r
- *   ------____________    ------______        ______------         ------______             \r
- *   528us  2639us         528us  528us        528us  528us         528us  528us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   NOKIA:\r
- *   ------\r
- *\r
- *   Timing similar to Grundig, but 16 data bits:\r
- *   frame: 1 pre bit + 1 start bit + 8 command bits + 8 address bits + no stop bit\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   SIEMENS or RUWIDO:\r
- *   ------------------\r
- *\r
- *   SIEMENS frame:  1 start bit + 22 data bits + no stop bit\r
- *   SIEMENS data:   13 address bits + 1 repeat bit + 7 data bits + 1 unknown bit\r
- *\r
- *   start  bit           data "0":            data "1":\r
- *   -------_______       _______-------       -------_______\r
- *    250us  250us         250us  250us         250us  250us\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
- *\r
- *   PANASONIC (older protocol, yet not implemented, see also MATSUSHITA, timing very similar)\r
- *   -----------------------------------------------------------------------------------------\r
- *\r
- *   frame: 1 start bit + 22 data bits + 1 stop bit\r
- *   22 data bits = 5 custom bits + 6 data bits + 5 inverted custom bits + 6 inverted data bits\r
- *\r
- *   European version:      T = 456us\r
- *   USA & Canada version:  T = 422us\r
- *\r
- *   start bit:                           data "0":                 data "1":                 stop bit:\r
- *        8T            8T                 2T   2T                   2T      6T                2T\r
- *   -------------____________            ------_____               ------_____________       ------_______....\r
- *      3648us        3648us              912us 912us               912us    2736us           912us                (Europe)\r
- *      3376us        3376us              844us 844us               844us    2532us           844us                (US)\r
- *\r
- *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ * ATtiny87,  ATtiny167\r
+ * ATtiny45,  ATtiny85\r
+ * ATtiny44,  ATtiny84\r
+ * ATmega8,   ATmega16,  ATmega32\r
+ * ATmega162\r
+ * ATmega164, ATmega324, ATmega644,  ATmega644P, ATmega1284, ATmega1284P\r
+ * ATmega88,  ATmega88P, ATmega168,  ATmega168P, ATmega328P\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
  *---------------------------------------------------------------------------------------------------------------------------------------------------\r
  */\r
 \r
-#if defined(__PCM__) || defined(__PCB__) || defined(__PCH__)                // CCS PIC Compiler instead of AVR\r
-#define PIC_CCS_COMPILER\r
-#endif\r
-\r
-#ifdef unix                                                                 // test on linux/unix\r
-#include <stdio.h>\r
-#include <unistd.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <inttypes.h>\r
-\r
-#define ANALYZE\r
-#define PROGMEM\r
-#define memcpy_P        memcpy\r
-\r
-#else // not unix:\r
-\r
-#ifdef WIN32\r
-#include <stdio.h>\r
-#include <string.h>\r
-typedef unsigned char   uint8_t;\r
-typedef unsigned short  uint16_t;\r
-#define ANALYZE\r
-#define PROGMEM\r
-#define memcpy_P        memcpy\r
-\r
-#else\r
-\r
-#ifndef CODEVISION\r
-\r
-#ifdef PIC_CCS_COMPILER\r
-\r
-#include <string.h>\r
-typedef unsigned int8   uint8_t;\r
-typedef unsigned int16  uint16_t;\r
-#define PROGMEM\r
-#define memcpy_P        memcpy\r
-\r
-#else // AVR:\r
-\r
-#include <inttypes.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <avr/io.h>\r
-#include <util/delay.h>\r
-#include <avr/pgmspace.h>\r
-\r
-#endif  // PIC_CCS_COMPILER\r
-#endif  // CODEVISION\r
-\r
-#endif // windows\r
-#endif // unix\r
-\r
-#ifndef IRMP_USE_AS_LIB\r
-#include "irmpconfig.h"\r
-#endif\r
 #include "irmp.h"\r
 \r
 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1 || IRMP_SUPPORT_NOKIA_PROTOCOL == 1 || IRMP_SUPPORT_IR60_PROTOCOL == 1\r
-#define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL  1\r
+#  define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL  1\r
 #else\r
-#define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL  0\r
+#  define IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL  0\r
 #endif\r
 \r
 #if IRMP_SUPPORT_SIEMENS_PROTOCOL == 1 || IRMP_SUPPORT_RUWIDO_PROTOCOL == 1\r
-#define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 1\r
+#  define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL   1\r
 #else\r
-#define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL 0\r
+#  define IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL   0\r
 #endif\r
 \r
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 ||                   \\r
     IRMP_SUPPORT_RC6_PROTOCOL == 1 ||                   \\r
     IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 ||    \\r
     IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 ||     \\r
-    IRMP_SUPPORT_IR60_PROTOCOL\r
-#define IRMP_SUPPORT_MANCHESTER                 1\r
+    IRMP_SUPPORT_IR60_PROTOCOL == 1 ||                  \\r
+    IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1 ||               \\r
+    IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+#  define IRMP_SUPPORT_MANCHESTER                   1\r
 #else\r
-#define IRMP_SUPPORT_MANCHESTER                 0\r
+#  define IRMP_SUPPORT_MANCHESTER                   0\r
 #endif\r
 \r
-#if IRMP_SUPPORT_NETBOX_PROTOCOL == 1 ||                \\r
-    IRMP_SUPPORT_MERLIN_PROTOCOL == 1 ||                \\r
-    IRMP_SUPPORT_IMON_PROTOCOL == 1 \r
-#define IRMP_SUPPORT_SERIAL                     1\r
+#if IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r
+#  define IRMP_SUPPORT_SERIAL                       1\r
 #else\r
-#define IRMP_SUPPORT_SERIAL                     0\r
+#  define IRMP_SUPPORT_SERIAL                       0\r
 #endif\r
 \r
 #define IRMP_KEY_REPETITION_LEN                 (uint16_t)(F_INTERRUPTS * 150.0e-3 + 0.5)           // autodetect key repetition within 150 msec\r
@@ -412,9 +92,9 @@ typedef unsigned int16  uint16_t;
 #define SIRCS_START_BIT_PULSE_LEN_MAX           ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 #define SIRCS_START_BIT_PAUSE_LEN_MIN           ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
 #if IRMP_SUPPORT_NETBOX_PROTOCOL                // only 5% to avoid conflict with NETBOX:\r
-#define SIRCS_START_BIT_PAUSE_LEN_MAX           ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))\r
+#  define SIRCS_START_BIT_PAUSE_LEN_MAX         ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5))\r
 #else                                           // only 5% + 1 to avoid conflict with RC6:\r
-#define SIRCS_START_BIT_PAUSE_LEN_MAX           ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#  define SIRCS_START_BIT_PAUSE_LEN_MAX         ((uint8_t)(F_INTERRUPTS * SIRCS_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
 #endif\r
 #define SIRCS_1_PULSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define SIRCS_1_PULSE_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * SIRCS_1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
@@ -423,18 +103,18 @@ typedef unsigned int16  uint16_t;
 #define SIRCS_PAUSE_LEN_MIN                     ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define SIRCS_PAUSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * SIRCS_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 \r
-#define NEC_START_BIT_PULSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
-#define NEC_START_BIT_PULSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
-#define NEC_START_BIT_PAUSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
-#define NEC_START_BIT_PAUSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
-#define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN      ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
-#define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX      ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
-#define NEC_PULSE_LEN_MIN                       ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
-#define NEC_PULSE_LEN_MAX                       ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
-#define NEC_1_PAUSE_LEN_MIN                     ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
-#define NEC_1_PAUSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
-#define NEC_0_PAUSE_LEN_MIN                     ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
-#define NEC_0_PAUSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
+#define NEC_START_BIT_PULSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define NEC_START_BIT_PULSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define NEC_START_BIT_PAUSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define NEC_START_BIT_PAUSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * NEC_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define NEC_REPEAT_START_BIT_PAUSE_LEN_MIN      ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define NEC_REPEAT_START_BIT_PAUSE_LEN_MAX      ((uint8_t)(F_INTERRUPTS * NEC_REPEAT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define NEC_PULSE_LEN_MIN                       ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define NEC_PULSE_LEN_MAX                       ((uint8_t)(F_INTERRUPTS * NEC_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define NEC_1_PAUSE_LEN_MIN                     ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define NEC_1_PAUSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * NEC_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define NEC_0_PAUSE_LEN_MIN                     ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define NEC_0_PAUSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * NEC_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
 // autodetect nec repetition frame within 50 msec:\r
 // NEC seems to send the first repetition frame after 40ms, further repetition frames after 100 ms\r
 #if 0\r
@@ -476,33 +156,37 @@ typedef unsigned int16  uint16_t;
 #define KASEIKYO_0_PAUSE_LEN_MIN                ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MIN_TOLERANCE_50 + 0.5) - 1)\r
 #define KASEIKYO_0_PAUSE_LEN_MAX                ((uint8_t)(F_INTERRUPTS * KASEIKYO_0_PAUSE_TIME * MAX_TOLERANCE_50 + 0.5) + 1)\r
 \r
-#define RECS80_START_BIT_PULSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)\r
-#define RECS80_START_BIT_PULSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RECS80_START_BIT_PULSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RECS80_START_BIT_PULSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
 #define RECS80_START_BIT_PAUSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define RECS80_START_BIT_PAUSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define RECS80_PULSE_LEN_MIN                    ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define RECS80_PULSE_LEN_MAX                    ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RECS80_PULSE_LEN_MIN                    ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RECS80_PULSE_LEN_MAX                    ((uint8_t)(F_INTERRUPTS * RECS80_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
 #define RECS80_1_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define RECS80_1_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * RECS80_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 #define RECS80_0_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define RECS80_0_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * RECS80_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 \r
+\r
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1 // BOSE conflicts with RC5, so keep tolerance for RC5 minimal here:\r
+#define RC5_START_BIT_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define RC5_START_BIT_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#else\r
 #define RC5_START_BIT_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define RC5_START_BIT_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#endif\r
 \r
 #define RC5_BIT_LEN_MIN                         ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define RC5_BIT_LEN_MAX                         ((uint8_t)(F_INTERRUPTS * RC5_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 \r
 #define DENON_PULSE_LEN_MIN                     ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define DENON_PULSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define DENON_PULSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * DENON_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
 #define DENON_1_PAUSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define DENON_1_PAUSE_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * DENON_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r
-#define DENON_0_PAUSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5))     // no -1, avoid conflict with RUWIDO\r
-#else\r
-#define DENON_0_PAUSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) // be more tolerant\r
-#endif\r
+// RUWIDO (see t-home-mediareceiver-15kHz.txt) conflicts here with DENON\r
+#define DENON_0_PAUSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define DENON_0_PAUSE_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * DENON_0_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define DENON_AUTO_REPETITION_PAUSE_LEN         ((uint16_t)(F_INTERRUPTS * DENON_AUTO_REPETITION_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 \r
 #define THOMSON_PULSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define THOMSON_PULSE_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * THOMSON_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
@@ -522,12 +206,12 @@ typedef unsigned int16  uint16_t;
 #define RC6_BIT_PAUSE_LEN_MIN                   ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define RC6_BIT_PAUSE_LEN_MAX                   ((uint8_t)(F_INTERRUPTS * RC6_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)       // pauses: 300 - 600\r
 \r
-#define RECS80EXT_START_BIT_PULSE_LEN_MIN       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_00 + 0.5) - 1)\r
-#define RECS80EXT_START_BIT_PULSE_LEN_MAX       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_00 + 0.5) + 1)\r
-#define RECS80EXT_START_BIT_PAUSE_LEN_MIN       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
-#define RECS80EXT_START_BIT_PAUSE_LEN_MAX       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
-#define RECS80EXT_PULSE_LEN_MIN                 ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define RECS80EXT_PULSE_LEN_MAX                 ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RECS80EXT_START_BIT_PULSE_LEN_MIN       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RECS80EXT_START_BIT_PULSE_LEN_MAX       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define RECS80EXT_START_BIT_PAUSE_LEN_MIN       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define RECS80EXT_START_BIT_PAUSE_LEN_MAX       ((uint8_t)(F_INTERRUPTS * RECS80EXT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RECS80EXT_PULSE_LEN_MIN                 ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RECS80EXT_PULSE_LEN_MAX                 ((uint8_t)(F_INTERRUPTS * RECS80EXT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
 #define RECS80EXT_1_PAUSE_LEN_MIN               ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define RECS80EXT_1_PAUSE_LEN_MAX               ((uint8_t)(F_INTERRUPTS * RECS80EXT_1_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 #define RECS80EXT_0_PAUSE_LEN_MIN               ((uint8_t)(F_INTERRUPTS * RECS80EXT_0_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
@@ -546,6 +230,19 @@ typedef unsigned int16  uint16_t;
 #define NUBERT_0_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
 #define NUBERT_0_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * NUBERT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
 \r
+#define SPEAKER_START_BIT_PULSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define SPEAKER_START_BIT_PULSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define SPEAKER_START_BIT_PAUSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define SPEAKER_START_BIT_PAUSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * SPEAKER_START_BIT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define SPEAKER_1_PULSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define SPEAKER_1_PULSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define SPEAKER_1_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define SPEAKER_1_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * SPEAKER_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define SPEAKER_0_PULSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define SPEAKER_0_PULSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define SPEAKER_0_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define SPEAKER_0_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * SPEAKER_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+\r
 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN   ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
 #define BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX   ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 #define BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN   ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_START_BIT1_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
@@ -574,10 +271,10 @@ typedef unsigned int16  uint16_t;
 #define BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX  ((uint8_t)(F_INTERRUPTS * BANG_OLUFSEN_TRAILER_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 \r
 #define IR60_TIMEOUT_LEN                        ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5))\r
-#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN    ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX    ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
-#define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN          ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
-#define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX          ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN    ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX    ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN          ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX          ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN    ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1)\r
 #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX    ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
 \r
@@ -678,44 +375,203 @@ typedef unsigned int16  uint16_t;
 #define LEGO_0_PAUSE_LEN_MIN                    ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1)\r
 #define LEGO_0_PAUSE_LEN_MAX                    ((uint8_t)(F_INTERRUPTS * LEGO_0_PAUSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1)\r
 \r
-#define MERLIN_START_BIT_PULSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * MERLIN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define MERLIN_START_BIT_PULSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * MERLIN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define MERLIN_START_BIT_PAUSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * MERLIN_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define MERLIN_START_BIT_PAUSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * MERLIN_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define MERLIN_PULSE_LEN                        ((uint8_t)(F_INTERRUPTS * MERLIN_PULSE_TIME))\r
-#define MERLIN_PAUSE_LEN                        ((uint8_t)(F_INTERRUPTS * MERLIN_PAUSE_TIME))\r
-#define MERLIN_PULSE_REST_LEN                   ((uint8_t)(F_INTERRUPTS * MERLIN_PULSE_TIME / 4))\r
-#define MERLIN_PAUSE_REST_LEN                   ((uint8_t)(F_INTERRUPTS * MERLIN_PAUSE_TIME / 4))\r
-\r
-#define IMON_START_BIT_PULSE_LEN_MIN            ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define IMON_START_BIT_PULSE_LEN_MAX            ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define IMON_START_BIT_PAUSE_LEN_MIN            ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
-#define IMON_START_BIT_PAUSE_LEN_MAX            ((uint8_t)(F_INTERRUPTS * IMON_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
-#define IMON_PULSE_LEN                          ((uint8_t)(F_INTERRUPTS * IMON_PULSE_TIME))\r
-#define IMON_PAUSE_LEN                          ((uint8_t)(F_INTERRUPTS * IMON_PAUSE_TIME))\r
-#define IMON_PULSE_REST_LEN                     ((uint8_t)(F_INTERRUPTS * IMON_PULSE_TIME / 4))\r
-#define IMON_PAUSE_REST_LEN                     ((uint8_t)(F_INTERRUPTS * IMON_PAUSE_TIME / 4))\r
+#define BOSE_START_BIT_PULSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define BOSE_START_BIT_PULSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define BOSE_START_BIT_PAUSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define BOSE_START_BIT_PAUSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * BOSE_START_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define BOSE_PULSE_LEN_MIN                       ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define BOSE_PULSE_LEN_MAX                       ((uint8_t)(F_INTERRUPTS * BOSE_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define BOSE_1_PAUSE_LEN_MIN                     ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define BOSE_1_PAUSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * BOSE_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define BOSE_0_PAUSE_LEN_MIN                     ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define BOSE_0_PAUSE_LEN_MAX                     ((uint8_t)(F_INTERRUPTS * BOSE_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define BOSE_FRAME_REPEAT_PAUSE_LEN_MAX          (uint16_t)(F_INTERRUPTS * 100.0e-3 * MAX_TOLERANCE_20 + 0.5)\r
+\r
+#define A1TVBOX_START_BIT_PULSE_LEN_MIN         ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define A1TVBOX_START_BIT_PULSE_LEN_MAX         ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define A1TVBOX_START_BIT_PAUSE_LEN_MIN         ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define A1TVBOX_START_BIT_PAUSE_LEN_MAX         ((uint8_t)(F_INTERRUPTS * A1TVBOX_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define A1TVBOX_BIT_PULSE_LEN_MIN               ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define A1TVBOX_BIT_PULSE_LEN_MAX               ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define A1TVBOX_BIT_PAUSE_LEN_MIN               ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define A1TVBOX_BIT_PAUSE_LEN_MAX               ((uint8_t)(F_INTERRUPTS * A1TVBOX_BIT_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+\r
+#define ORTEK_START_BIT_PULSE_LEN_MIN           ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define ORTEK_START_BIT_PULSE_LEN_MAX           ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define ORTEK_START_BIT_PAUSE_LEN_MIN           ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define ORTEK_START_BIT_PAUSE_LEN_MAX           ((uint8_t)(F_INTERRUPTS * ORTEK_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define ORTEK_BIT_PULSE_LEN_MIN                 ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define ORTEK_BIT_PULSE_LEN_MAX                 ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define ORTEK_BIT_PAUSE_LEN_MIN                 ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define ORTEK_BIT_PAUSE_LEN_MAX                 ((uint8_t)(F_INTERRUPTS * ORTEK_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+\r
+#define TELEFUNKEN_START_BIT_PULSE_LEN_MIN      ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define TELEFUNKEN_START_BIT_PULSE_LEN_MAX      ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define TELEFUNKEN_START_BIT_PAUSE_LEN_MIN      ((uint8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define TELEFUNKEN_START_BIT_PAUSE_LEN_MAX      ((uint8_t)(F_INTERRUPTS * (TELEFUNKEN_START_BIT_PAUSE_TIME) * MAX_TOLERANCE_10 + 0.5) - 1)\r
+#define TELEFUNKEN_PULSE_LEN_MIN                ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define TELEFUNKEN_PULSE_LEN_MAX                ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_PULSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define TELEFUNKEN_1_PAUSE_LEN_MIN              ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define TELEFUNKEN_1_PAUSE_LEN_MAX              ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_1_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+#define TELEFUNKEN_0_PAUSE_LEN_MIN              ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MIN_TOLERANCE_30 + 0.5) - 1)\r
+#define TELEFUNKEN_0_PAUSE_LEN_MAX              ((uint8_t)(F_INTERRUPTS * TELEFUNKEN_0_PAUSE_TIME * MAX_TOLERANCE_30 + 0.5) + 1)\r
+// autodetect TELEFUNKEN repetition frame within 50 msec:\r
+// #define TELEFUNKEN_FRAME_REPEAT_PAUSE_LEN_MAX   (uint16_t)(F_INTERRUPTS * TELEFUNKEN_FRAME_REPEAT_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5)\r
+\r
+#define ROOMBA_START_BIT_PULSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define ROOMBA_START_BIT_PULSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define ROOMBA_START_BIT_PAUSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define ROOMBA_START_BIT_PAUSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * ROOMBA_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define ROOMBA_1_PAUSE_LEN_EXACT                ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME + 0.5))\r
+#define ROOMBA_1_PULSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define ROOMBA_1_PULSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define ROOMBA_1_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define ROOMBA_1_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * ROOMBA_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define ROOMBA_0_PAUSE_LEN                      ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME))\r
+#define ROOMBA_0_PULSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define ROOMBA_0_PULSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define ROOMBA_0_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define ROOMBA_0_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * ROOMBA_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+\r
+#define RCMM32_START_BIT_PULSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define RCMM32_START_BIT_PULSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#define RCMM32_START_BIT_PAUSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define RCMM32_START_BIT_PAUSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#define RCMM32_BIT_PULSE_LEN_MIN                ((uint8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define RCMM32_BIT_PULSE_LEN_MAX                ((uint8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#define RCMM32_BIT_00_PAUSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define RCMM32_BIT_00_PAUSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#define RCMM32_BIT_01_PAUSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define RCMM32_BIT_01_PAUSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#define RCMM32_BIT_10_PAUSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define RCMM32_BIT_10_PAUSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+#define RCMM32_BIT_11_PAUSE_LEN_MIN             ((uint8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1)\r
+#define RCMM32_BIT_11_PAUSE_LEN_MAX             ((uint8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME * MAX_TOLERANCE_05 + 0.5) + 1)\r
+\r
+#define RADIO1_START_BIT_PULSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define RADIO1_START_BIT_PULSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RADIO1_START_BIT_PAUSE_LEN_MIN          ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1)\r
+#define RADIO1_START_BIT_PAUSE_LEN_MAX          ((uint8_t)(F_INTERRUPTS * RADIO1_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1)\r
+#define RADIO1_1_PAUSE_LEN_EXACT                ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME + 0.5))\r
+#define RADIO1_1_PULSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RADIO1_1_PULSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * RADIO1_1_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define RADIO1_1_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RADIO1_1_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * RADIO1_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define RADIO1_0_PAUSE_LEN                      ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME))\r
+#define RADIO1_0_PULSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RADIO1_0_PULSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * RADIO1_0_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
+#define RADIO1_0_PAUSE_LEN_MIN                  ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1)\r
+#define RADIO1_0_PAUSE_LEN_MAX                  ((uint8_t)(F_INTERRUPTS * RADIO1_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1)\r
 \r
 #define AUTO_FRAME_REPETITION_LEN               (uint16_t)(F_INTERRUPTS * AUTO_FRAME_REPETITION_TIME + 0.5)       // use uint16_t!\r
 \r
 #ifdef ANALYZE\r
-#define ANALYZE_PUTCHAR(a)                        { if (! silent)             { putchar (a);          } }\r
-#define ANALYZE_ONLY_NORMAL_PUTCHAR(a)            { if (! silent && !verbose) { putchar (a);          } }\r
-#define ANALYZE_PRINTF(...)                       { if (verbose)              { printf (__VA_ARGS__); } }\r
-#define ANALYZE_NEWLINE()                         { if (verbose)              { putchar ('\n');       } }\r
-static int      silent;\r
-static int      time_counter;\r
-static int      verbose;\r
+#  define ANALYZE_PUTCHAR(a)                    { if (! silent)             { putchar (a);          } }\r
+#  define ANALYZE_ONLY_NORMAL_PUTCHAR(a)        { if (! silent && !verbose) { putchar (a);          } }\r
+#  define ANALYZE_PRINTF(...)                   { if (verbose)              { printf (__VA_ARGS__); } }\r
+#  define ANALYZE_ONLY_NORMAL_PRINTF(...)       { if (! silent && !verbose) { printf (__VA_ARGS__); } }\r
+#  define ANALYZE_NEWLINE()                     { if (verbose)              { putchar ('\n');       } }\r
+static int                                      silent;\r
+static int                                      time_counter;\r
+static int                                      verbose;\r
+\r
+/*******************************                not every PIC compiler knows variadic macros :-(\r
 #else\r
-#define ANALYZE_PUTCHAR(a)\r
-#define ANALYZE_ONLY_NORMAL_PUTCHAR(a)\r
-#define ANALYZE_PRINTF(...)\r
-#define ANALYZE_NEWLINE()\r
+#  define ANALYZE_PUTCHAR(a)\r
+#  define ANALYZE_ONLY_NORMAL_PUTCHAR(a)\r
+#  define ANALYZE_PRINTF(...)\r
+#  define ANALYZE_ONLY_NORMAL_PRINTF(...)\r
+#  endif\r
+#  define ANALYZE_NEWLINE()\r
+*********************************/\r
 #endif\r
 \r
-#if IRMP_LOGGING == 1\r
-#define BAUD                                    9600L\r
-#include <util/setbaud.h>\r
+#if IRMP_USE_CALLBACK == 1\r
+static void                                     (*irmp_callback_ptr) (uint8_t);\r
+#endif // IRMP_USE_CALLBACK == 1\r
+\r
+#define PARITY_CHECK_OK                         1\r
+#define PARITY_CHECK_FAILED                     0\r
+\r
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ *  Protocol names\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ */\r
+#if defined(UNIX_OR_WINDOWS) || IRMP_PROTOCOL_NAMES == 1\r
+char *\r
+irmp_protocol_names[IRMP_N_PROTOCOLS + 1] =\r
+{\r
+    "UNKNOWN",\r
+    "SIRCS",\r
+    "NEC",\r
+    "SAMSUNG",\r
+    "MATSUSH",\r
+    "KASEIKYO",\r
+    "RECS80",\r
+    "RC5",\r
+    "DENON",\r
+    "RC6",\r
+    "SAMSG32",\r
+    "APPLE",\r
+    "RECS80EX",\r
+    "NUBERT",\r
+    "BANG OLU",\r
+    "GRUNDIG",\r
+    "NOKIA",\r
+    "SIEMENS",\r
+    "FDC",\r
+    "RCCAR",\r
+    "JVC",\r
+    "RC6A",\r
+    "NIKON",\r
+    "RUWIDO",\r
+    "IR60",\r
+    "KATHREIN",\r
+    "NETBOX",\r
+    "NEC16",\r
+    "NEC42",\r
+    "LEGO",\r
+    "THOMSON",\r
+    "BOSE",\r
+    "A1TVBOX",\r
+    "ORTEK",\r
+    "TELEFUNKEN",\r
+    "ROOMBA",\r
+    "RCMM32",\r
+    "RCMM24",\r
+    "RCMM12",\r
+    "SPEAKER",\r
+    "LGAIR",\r
+    "SAMSG48",\r
+    "RADIO1"\r
+};\r
+\r
+#endif\r
+\r
+/*---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ *  Logging\r
+ *---------------------------------------------------------------------------------------------------------------------------------------------------\r
+ */\r
+#if IRMP_LOGGING == 1                                               // logging via UART\r
+\r
+#if defined(ARM_STM32F4XX)\r
+#  define  STM32_GPIO_CLOCK   RCC_AHB1Periph_GPIOA                    // per UART2 an PA2\r
+#  define  STM32_UART_CLOCK   RCC_APB1Periph_USART2\r
+#  define  STM32_GPIO_PORT    GPIOA\r
+#  define  STM32_GPIO_PIN     GPIO_Pin_2\r
+#  define  STM32_GPIO_SOURCE  GPIO_PinSource2\r
+#  define  STM32_UART_AF      GPIO_AF_USART2\r
+#  define  STM32_UART_COM     USART2\r
+#  define  STM32_UART_BAUD    115200                                  // mit 115200 Baud\r
+#  include "stm32f4xx_usart.h"\r
+#else\r
+#  if IRMP_EXT_LOGGING == 1                                           // use external logging\r
+#    include "irmpextlog.h"\r
+#  else                                                               // normal UART log (IRMP_EXT_LOGGING == 0)\r
+#    define BAUD                                    9600L\r
+#  ifndef UNIX_OR_WINDOWS\r
+#    include <util/setbaud.h>\r
+#  endif\r
 \r
 #ifdef UBRR0H\r
 \r
@@ -735,7 +591,7 @@ static int      verbose;
 #define UART0_TXEN_BIT_VALUE                    (1<<TXEN0)\r
 #define UART0_UDR                               UDR0\r
 #define UART0_U2X                               U2X0\r
-\r
+        \r
 #else\r
 \r
 #define UART0_UBRRH                             UBRRH\r
@@ -755,7 +611,9 @@ static int      verbose;
 #define UART0_UDR                               UDR\r
 #define UART0_U2X                               U2X\r
 \r
-#endif\r
+#endif //UBRR0H\r
+#endif //IRMP_EXT_LOGGING\r
+#endif //ARM_STM32F4XX\r
 \r
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
  *  Initialize  UART\r
@@ -765,6 +623,47 @@ static int      verbose;
 void\r
 irmp_uart_init (void)\r
 {\r
+#ifndef UNIX_OR_WINDOWS\r
+#if defined(ARM_STM32F4XX)\r
+    GPIO_InitTypeDef GPIO_InitStructure;\r
+    USART_InitTypeDef USART_InitStructure;\r
+\r
+    // Clock enable vom TX Pin\r
+    RCC_AHB1PeriphClockCmd(STM32_GPIO_CLOCK, ENABLE);\r
+\r
+    // Clock enable der UART\r
+    RCC_APB1PeriphClockCmd(STM32_UART_CLOCK, ENABLE);\r
+\r
+    // UART Alternative-Funktion mit dem IO-Pin verbinden\r
+    GPIO_PinAFConfig(STM32_GPIO_PORT,STM32_GPIO_SOURCE,STM32_UART_AF);\r
+\r
+    // UART als Alternative-Funktion mit PushPull\r
+    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;\r
+    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;\r
+    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\r
+    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;\r
+\r
+    // TX-Pin\r
+    GPIO_InitStructure.GPIO_Pin = STM32_GPIO_PIN;\r
+    GPIO_Init(STM32_GPIO_PORT, &GPIO_InitStructure);\r
+\r
+    // Oversampling\r
+    USART_OverSampling8Cmd(STM32_UART_COM, ENABLE);\r
+\r
+    // init mit Baudrate, 8Databits, 1Stopbit, keine Parität, kein RTS+CTS\r
+    USART_InitStructure.USART_BaudRate = STM32_UART_BAUD;\r
+    USART_InitStructure.USART_WordLength = USART_WordLength_8b;\r
+    USART_InitStructure.USART_StopBits = USART_StopBits_1;\r
+    USART_InitStructure.USART_Parity = USART_Parity_No;\r
+    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;\r
+    USART_InitStructure.USART_Mode = USART_Mode_Tx;\r
+    USART_Init(STM32_UART_COM, &USART_InitStructure);\r
+\r
+    // UART enable\r
+    USART_Cmd(STM32_UART_COM, ENABLE);\r
+\r
+#else\r
+#if (IRMP_EXT_LOGGING == 0)                                                                         // use UART\r
     UART0_UBRRH = UBRRH_VALUE;                                                                      // set baud rate\r
     UART0_UBRRL = UBRRL_VALUE;\r
 \r
@@ -776,6 +675,11 @@ irmp_uart_init (void)
 \r
     UART0_UCSRC = UART0_UCSZ1_BIT_VALUE | UART0_UCSZ0_BIT_VALUE | UART0_URSEL_BIT_VALUE;\r
     UART0_UCSRB |= UART0_TXEN_BIT_VALUE;                                                            // enable UART TX\r
+#else                                                                                               // other log method\r
+    initextlog();                                                         \r
+#endif //IRMP_EXT_LOGGING\r
+#endif //ARM_STM32F4XX\r
+#endif // UNIX_OR_WINDOWS\r
 }\r
 \r
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
@@ -787,12 +691,41 @@ irmp_uart_init (void)
 void\r
 irmp_uart_putc (unsigned char ch)\r
 {\r
+#ifndef UNIX_OR_WINDOWS\r
+#if defined(ARM_STM32F4XX)\r
+    // warten bis altes Byte gesendet wurde\r
+    while (USART_GetFlagStatus(STM32_UART_COM, USART_FLAG_TXE) == RESET)\r
+    {\r
+        ;\r
+    }\r
+\r
+    USART_SendData(STM32_UART_COM, ch);\r
+\r
+    if (ch == '\n')\r
+    {\r
+        while (USART_GetFlagStatus(STM32_UART_COM, USART_FLAG_TXE) == RESET);\r
+        USART_SendData(STM32_UART_COM, '\r');\r
+    }\r
+\r
+#else\r
+#if (IRMP_EXT_LOGGING == 0)\r
+\r
     while (!(UART0_UCSRA & UART0_UDRE_BIT_VALUE))\r
     {\r
         ;\r
     }\r
 \r
     UART0_UDR = ch;\r
+\r
+#else\r
+\r
+    sendextlog(ch);                                                         // use external log\r
+\r
+#endif //IRMP_EXT_LOGGING\r
+#endif //ARM_STM32F4XX\r
+#else\r
+    fputc (ch, stderr);\r
+#endif // UNIX_OR_WINDOWS\r
 }\r
 \r
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
@@ -804,6 +737,8 @@ irmp_uart_putc (unsigned char ch)
 #define ENDBITS                        1000                                 // number of sequenced highbits to detect end\r
 #define DATALEN                         700                                 // log buffer size\r
 \r
+#if 0                                                                       // old log routine\r
+\r
 static void\r
 irmp_log (uint8_t val)\r
 {\r
@@ -873,9 +808,101 @@ irmp_log (uint8_t val)
     }\r
 }\r
 \r
+#else                                                                       // new log routine\r
+\r
+static void\r
+irmp_log (uint8_t val)\r
+{\r
+    static uint8_t  buf[DATALEN];                                           // logging buffer\r
+    static uint16_t buf_idx;                                                // index\r
+    static uint8_t  startcycles;                                            // current number of start-zeros\r
+    static uint16_t cnt;                                                    // counts sequenced highbits - to detect end\r
+    static uint8_t  last_val = 1;\r
+\r
+    if (! val && (startcycles < STARTCYCLES) && !buf_idx)                   // prevent that single random zeros init logging\r
+    {\r
+        startcycles++;\r
+    }\r
+    else\r
+    {\r
+        startcycles = 0;\r
+\r
+        if (! val || buf_idx != 0)                                          // start or continue logging on "0", "1" cannot init logging\r
+        {\r
+            if (last_val == val)\r
+            {\r
+                cnt++;\r
+\r
+                if (val && cnt > ENDBITS)                                   // if high received then look at log-stop condition\r
+                {                                                           // if stop condition is true, output on uart\r
+                    uint8_t     i8;\r
+                    uint16_t    i;\r
+                    uint16_t    j;\r
+                    uint8_t     v = '1';\r
+                    uint16_t    d;\r
+\r
+                    for (i8 = 0; i8 < STARTCYCLES; i8++)\r
+                    {\r
+                        irmp_uart_putc ('0');                               // the ignored starting zeros\r
+                    }\r
+\r
+                    for (i = 0; i < buf_idx; i++)\r
+                    {\r
+                        d = buf[i];\r
+\r
+                        if (d == 0xff)\r
+                        {\r
+                            i++;\r
+                            d = buf[i];\r
+                            i++;\r
+                            d |= ((uint16_t) buf[i] << 8);\r
+                        }\r
+\r
+                        for (j = 0; j < d; j++)\r
+                        {\r
+                            irmp_uart_putc (v);\r
+                        }\r
+\r
+                        v = (v == '1') ? '0' : '1';\r
+                    }\r
+\r
+                    for (i8 = 0; i8 < 20; i8++)\r
+                    {\r
+                        irmp_uart_putc ('1');\r
+                    }\r
+\r
+                    irmp_uart_putc ('\n');\r
+                    buf_idx = 0;\r
+                    last_val = 1;\r
+                    cnt = 0;\r
+                }\r
+            }\r
+            else if (buf_idx < DATALEN - 3)\r
+            {\r
+                if (cnt >= 0xff)\r
+                {\r
+                    buf[buf_idx++]  = 0xff;\r
+                    buf[buf_idx++]  = (cnt & 0xff);\r
+                    buf[buf_idx]    = (cnt >> 8);\r
+                }\r
+                else\r
+                {\r
+                    buf[buf_idx] = cnt;\r
+                }\r
+\r
+                buf_idx++;\r
+                cnt = 1;\r
+                last_val = val;\r
+            }\r
+        }\r
+    }\r
+}\r
+\r
+#endif\r
+\r
 #else\r
 #define irmp_log(val)\r
-#endif\r
+#endif //IRMP_LOGGING\r
 \r
 typedef struct\r
 {\r
@@ -983,9 +1010,9 @@ static const PROGMEM IRMP_PARAMETER nec42_param =
     NEC_0_PAUSE_LEN_MIN,                                                // pause_0_len_min: minimum length of pause with bit value 0\r
     NEC_0_PAUSE_LEN_MAX,                                                // pause_0_len_max: maximum length of pause with bit value 0\r
     NEC42_ADDRESS_OFFSET,                                               // address_offset:  address offset\r
-    NEC42_ADDRESS_OFFSET + NEC_ADDRESS_LEN,                             // address_end:     end of address\r
+    NEC42_ADDRESS_OFFSET + NEC42_ADDRESS_LEN,                           // address_end:     end of address\r
     NEC42_COMMAND_OFFSET,                                               // command_offset:  command offset\r
-    NEC42_COMMAND_OFFSET + NEC_COMMAND_LEN,                             // command_end:     end of command\r
+    NEC42_COMMAND_OFFSET + NEC42_COMMAND_LEN,                           // command_end:     end of command\r
     NEC42_COMPLETE_DATA_LEN,                                            // complete_len:    complete length of frame\r
     NEC_STOP_BIT,                                                       // stop_bit:        flag: frame has stop bit\r
     NEC_LSB,                                                            // lsb_first:       flag: LSB first\r
@@ -994,6 +1021,31 @@ static const PROGMEM IRMP_PARAMETER nec42_param =
 \r
 #endif\r
 \r
+#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER lgair_param =\r
+{\r
+    IRMP_LGAIR_PROTOCOL,                                                // protocol:        ir protocol\r
+    NEC_PULSE_LEN_MIN,                                                  // pulse_1_len_min: minimum length of pulse with bit value 1\r
+    NEC_PULSE_LEN_MAX,                                                  // pulse_1_len_max: maximum length of pulse with bit value 1\r
+    NEC_1_PAUSE_LEN_MIN,                                                // pause_1_len_min: minimum length of pause with bit value 1\r
+    NEC_1_PAUSE_LEN_MAX,                                                // pause_1_len_max: maximum length of pause with bit value 1\r
+    NEC_PULSE_LEN_MIN,                                                  // pulse_0_len_min: minimum length of pulse with bit value 0\r
+    NEC_PULSE_LEN_MAX,                                                  // pulse_0_len_max: maximum length of pulse with bit value 0\r
+    NEC_0_PAUSE_LEN_MIN,                                                // pause_0_len_min: minimum length of pause with bit value 0\r
+    NEC_0_PAUSE_LEN_MAX,                                                // pause_0_len_max: maximum length of pause with bit value 0\r
+    LGAIR_ADDRESS_OFFSET,                                               // address_offset:  address offset\r
+    LGAIR_ADDRESS_OFFSET + LGAIR_ADDRESS_LEN,                           // address_end:     end of address\r
+    LGAIR_COMMAND_OFFSET,                                               // command_offset:  command offset\r
+    LGAIR_COMMAND_OFFSET + LGAIR_COMMAND_LEN,                           // command_end:     end of command\r
+    LGAIR_COMPLETE_DATA_LEN,                                            // complete_len:    complete length of frame\r
+    NEC_STOP_BIT,                                                       // stop_bit:        flag: frame has stop bit\r
+    NEC_LSB,                                                            // lsb_first:       flag: LSB first\r
+    NEC_FLAGS                                                           // flags:           some flags\r
+};\r
+\r
+#endif\r
+\r
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
 \r
 static const PROGMEM IRMP_PARAMETER samsung_param =\r
@@ -1019,6 +1071,31 @@ static const PROGMEM IRMP_PARAMETER samsung_param =
 \r
 #endif\r
 \r
+#if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER telefunken_param =\r
+{\r
+    IRMP_TELEFUNKEN_PROTOCOL,                                           // protocol:        ir protocol\r
+    TELEFUNKEN_PULSE_LEN_MIN,                                           // pulse_1_len_min: minimum length of pulse with bit value 1\r
+    TELEFUNKEN_PULSE_LEN_MAX,                                           // pulse_1_len_max: maximum length of pulse with bit value 1\r
+    TELEFUNKEN_1_PAUSE_LEN_MIN,                                         // pause_1_len_min: minimum length of pause with bit value 1\r
+    TELEFUNKEN_1_PAUSE_LEN_MAX,                                         // pause_1_len_max: maximum length of pause with bit value 1\r
+    TELEFUNKEN_PULSE_LEN_MIN,                                           // pulse_0_len_min: minimum length of pulse with bit value 0\r
+    TELEFUNKEN_PULSE_LEN_MAX,                                           // pulse_0_len_max: maximum length of pulse with bit value 0\r
+    TELEFUNKEN_0_PAUSE_LEN_MIN,                                         // pause_0_len_min: minimum length of pause with bit value 0\r
+    TELEFUNKEN_0_PAUSE_LEN_MAX,                                         // pause_0_len_max: maximum length of pause with bit value 0\r
+    TELEFUNKEN_ADDRESS_OFFSET,                                          // address_offset:  address offset\r
+    TELEFUNKEN_ADDRESS_OFFSET + TELEFUNKEN_ADDRESS_LEN,                 // address_end:     end of address\r
+    TELEFUNKEN_COMMAND_OFFSET,                                          // command_offset:  command offset\r
+    TELEFUNKEN_COMMAND_OFFSET + TELEFUNKEN_COMMAND_LEN,                 // command_end:     end of command\r
+    TELEFUNKEN_COMPLETE_DATA_LEN,                                       // complete_len:    complete length of frame\r
+    TELEFUNKEN_STOP_BIT,                                                // stop_bit:        flag: frame has stop bit\r
+    TELEFUNKEN_LSB,                                                     // lsb_first:       flag: LSB first\r
+    TELEFUNKEN_FLAGS                                                    // flags:           some flags\r
+};\r
+\r
+#endif\r
+\r
 #if IRMP_SUPPORT_MATSUSHITA_PROTOCOL == 1\r
 \r
 static const PROGMEM IRMP_PARAMETER matsushita_param =\r
@@ -1220,6 +1297,31 @@ static const PROGMEM IRMP_PARAMETER nubert_param =
 \r
 #endif\r
 \r
+#if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER speaker_param =\r
+{\r
+    IRMP_SPEAKER_PROTOCOL,                                              // protocol:        ir protocol\r
+    SPEAKER_1_PULSE_LEN_MIN,                                            // pulse_1_len_min: minimum length of pulse with bit value 1\r
+    SPEAKER_1_PULSE_LEN_MAX,                                            // pulse_1_len_max: maximum length of pulse with bit value 1\r
+    SPEAKER_1_PAUSE_LEN_MIN,                                            // pause_1_len_min: minimum length of pause with bit value 1\r
+    SPEAKER_1_PAUSE_LEN_MAX,                                            // pause_1_len_max: maximum length of pause with bit value 1\r
+    SPEAKER_0_PULSE_LEN_MIN,                                            // pulse_0_len_min: minimum length of pulse with bit value 0\r
+    SPEAKER_0_PULSE_LEN_MAX,                                            // pulse_0_len_max: maximum length of pulse with bit value 0\r
+    SPEAKER_0_PAUSE_LEN_MIN,                                            // pause_0_len_min: minimum length of pause with bit value 0\r
+    SPEAKER_0_PAUSE_LEN_MAX,                                            // pause_0_len_max: maximum length of pause with bit value 0\r
+    SPEAKER_ADDRESS_OFFSET,                                             // address_offset:  address offset\r
+    SPEAKER_ADDRESS_OFFSET + SPEAKER_ADDRESS_LEN,                       // address_end:     end of address\r
+    SPEAKER_COMMAND_OFFSET,                                             // command_offset:  command offset\r
+    SPEAKER_COMMAND_OFFSET + SPEAKER_COMMAND_LEN,                       // command_end:     end of command\r
+    SPEAKER_COMPLETE_DATA_LEN,                                          // complete_len:    complete length of frame\r
+    SPEAKER_STOP_BIT,                                                   // stop_bit:        flag: frame has stop bit\r
+    SPEAKER_LSB,                                                        // lsb_first:       flag: LSB first\r
+    SPEAKER_FLAGS                                                       // flags:           some flags\r
+};\r
+\r
+#endif\r
+\r
 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
 \r
 static const PROGMEM IRMP_PARAMETER bang_olufsen_param =\r
@@ -1448,32 +1550,7 @@ static const PROGMEM IRMP_PARAMETER lego_param =
 \r
 #endif\r
 \r
-#if IRMP_SUPPORT_MERLIN_PROTOCOL == 1\r
-\r
-static const PROGMEM IRMP_PARAMETER merlin_param =\r
-{\r
-    IRMP_MERLIN_PROTOCOL,                                               // protocol:        ir protocol\r
-    MERLIN_PULSE_LEN,                                                   // pulse_1_len_min: minimum length of pulse with bit value 1, here: exact value\r
-    MERLIN_PULSE_REST_LEN,                                              // pulse_1_len_max: maximum length of pulse with bit value 1, here: rest value\r
-    MERLIN_PAUSE_LEN,                                                   // pause_1_len_min: minimum length of pause with bit value 1, here: exact value\r
-    MERLIN_PAUSE_REST_LEN,                                              // pause_1_len_max: maximum length of pause with bit value 1, here: rest value\r
-    MERLIN_PULSE_LEN,                                                   // pulse_0_len_min: minimum length of pulse with bit value 0, here: exact value\r
-    MERLIN_PULSE_REST_LEN,                                              // pulse_0_len_max: maximum length of pulse with bit value 0, here: rest value\r
-    MERLIN_PAUSE_LEN,                                                   // pause_0_len_min: minimum length of pause with bit value 0, here: exact value\r
-    MERLIN_PAUSE_REST_LEN,                                              // pause_0_len_max: maximum length of pause with bit value 0, here: rest value\r
-    MERLIN_ADDRESS_OFFSET,                                              // address_offset:  address offset\r
-    MERLIN_ADDRESS_OFFSET + MERLIN_ADDRESS_LEN,                         // address_end:     end of address\r
-    MERLIN_COMMAND_OFFSET,                                              // command_offset:  command offset\r
-    MERLIN_COMMAND_OFFSET + MERLIN_COMMAND_LEN,                         // command_end:     end of command\r
-    MERLIN_COMPLETE_DATA_LEN,                                           // complete_len:    complete length of frame\r
-    MERLIN_STOP_BIT,                                                    // stop_bit:        flag: frame has stop bit\r
-    MERLIN_LSB,                                                         // lsb_first:       flag: LSB first\r
-    MERLIN_FLAGS                                                        // flags:           some flags\r
-};\r
-\r
-#endif\r
-\r
-#if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r
+#if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r
 \r
 static const PROGMEM IRMP_PARAMETER thomson_param =\r
 {\r
@@ -1498,27 +1575,156 @@ static const PROGMEM IRMP_PARAMETER thomson_param =
 \r
 #endif\r
 \r
-#if IRMP_SUPPORT_IMON_PROTOCOL == 1\r
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER bose_param =\r
+{\r
+    IRMP_BOSE_PROTOCOL,                                                 // protocol:        ir protocol\r
+    BOSE_PULSE_LEN_MIN,                                                 // pulse_1_len_min: minimum length of pulse with bit value 1\r
+    BOSE_PULSE_LEN_MAX,                                                 // pulse_1_len_max: maximum length of pulse with bit value 1\r
+    BOSE_1_PAUSE_LEN_MIN,                                               // pause_1_len_min: minimum length of pause with bit value 1\r
+    BOSE_1_PAUSE_LEN_MAX,                                               // pause_1_len_max: maximum length of pause with bit value 1\r
+    BOSE_PULSE_LEN_MIN,                                                 // pulse_0_len_min: minimum length of pulse with bit value 0\r
+    BOSE_PULSE_LEN_MAX,                                                 // pulse_0_len_max: maximum length of pulse with bit value 0\r
+    BOSE_0_PAUSE_LEN_MIN,                                               // pause_0_len_min: minimum length of pause with bit value 0\r
+    BOSE_0_PAUSE_LEN_MAX,                                               // pause_0_len_max: maximum length of pause with bit value 0\r
+    BOSE_ADDRESS_OFFSET,                                                // address_offset:  address offset\r
+    BOSE_ADDRESS_OFFSET + BOSE_ADDRESS_LEN,                             // address_end:     end of address\r
+    BOSE_COMMAND_OFFSET,                                                // command_offset:  command offset\r
+    BOSE_COMMAND_OFFSET + BOSE_COMMAND_LEN,                             // command_end:     end of command\r
+    BOSE_COMPLETE_DATA_LEN,                                             // complete_len:    complete length of frame\r
+    BOSE_STOP_BIT,                                                      // stop_bit:        flag: frame has stop bit\r
+    BOSE_LSB,                                                           // lsb_first:       flag: LSB first\r
+    BOSE_FLAGS                                                          // flags:           some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER a1tvbox_param =\r
+{\r
+    IRMP_A1TVBOX_PROTOCOL,                                              // protocol:        ir protocol\r
+\r
+    A1TVBOX_BIT_PULSE_LEN_MIN,                                          // pulse_1_len_min: here: minimum length of short pulse\r
+    A1TVBOX_BIT_PULSE_LEN_MAX,                                          // pulse_1_len_max: here: maximum length of short pulse\r
+    A1TVBOX_BIT_PAUSE_LEN_MIN,                                          // pause_1_len_min: here: minimum length of short pause\r
+    A1TVBOX_BIT_PAUSE_LEN_MAX,                                          // pause_1_len_max: here: maximum length of short pause\r
+    0,                                                                  // pulse_0_len_min: here: not used\r
+    0,                                                                  // pulse_0_len_max: here: not used\r
+    0,                                                                  // pause_0_len_min: here: not used\r
+    0,                                                                  // pause_0_len_max: here: not used\r
+    A1TVBOX_ADDRESS_OFFSET,                                             // address_offset:  address offset\r
+    A1TVBOX_ADDRESS_OFFSET + A1TVBOX_ADDRESS_LEN,                       // address_end:     end of address\r
+    A1TVBOX_COMMAND_OFFSET,                                             // command_offset:  command offset\r
+    A1TVBOX_COMMAND_OFFSET + A1TVBOX_COMMAND_LEN,                       // command_end:     end of command\r
+    A1TVBOX_COMPLETE_DATA_LEN,                                          // complete_len:    complete length of frame\r
+    A1TVBOX_STOP_BIT,                                                   // stop_bit:        flag: frame has stop bit\r
+    A1TVBOX_LSB,                                                        // lsb_first:       flag: LSB first\r
+    A1TVBOX_FLAGS                                                       // flags:           some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER ortek_param =\r
+{\r
+    IRMP_ORTEK_PROTOCOL,                                                // protocol:        ir protocol\r
+\r
+    ORTEK_BIT_PULSE_LEN_MIN,                                            // pulse_1_len_min: here: minimum length of short pulse\r
+    ORTEK_BIT_PULSE_LEN_MAX,                                            // pulse_1_len_max: here: maximum length of short pulse\r
+    ORTEK_BIT_PAUSE_LEN_MIN,                                            // pause_1_len_min: here: minimum length of short pause\r
+    ORTEK_BIT_PAUSE_LEN_MAX,                                            // pause_1_len_max: here: maximum length of short pause\r
+    0,                                                                  // pulse_0_len_min: here: not used\r
+    0,                                                                  // pulse_0_len_max: here: not used\r
+    0,                                                                  // pause_0_len_min: here: not used\r
+    0,                                                                  // pause_0_len_max: here: not used\r
+    ORTEK_ADDRESS_OFFSET,                                               // address_offset:  address offset\r
+    ORTEK_ADDRESS_OFFSET + ORTEK_ADDRESS_LEN,                           // address_end:     end of address\r
+    ORTEK_COMMAND_OFFSET,                                               // command_offset:  command offset\r
+    ORTEK_COMMAND_OFFSET + ORTEK_COMMAND_LEN,                           // command_end:     end of command\r
+    ORTEK_COMPLETE_DATA_LEN,                                            // complete_len:    complete length of frame\r
+    ORTEK_STOP_BIT,                                                     // stop_bit:        flag: frame has stop bit\r
+    ORTEK_LSB,                                                          // lsb_first:       flag: LSB first\r
+    ORTEK_FLAGS                                                         // flags:           some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER roomba_param =\r
+{\r
+    IRMP_ROOMBA_PROTOCOL,                                               // protocol:        ir protocol\r
+    ROOMBA_1_PULSE_LEN_MIN,                                             // pulse_1_len_min: minimum length of pulse with bit value 1\r
+    ROOMBA_1_PULSE_LEN_MAX,                                             // pulse_1_len_max: maximum length of pulse with bit value 1\r
+    ROOMBA_1_PAUSE_LEN_MIN,                                             // pause_1_len_min: minimum length of pause with bit value 1\r
+    ROOMBA_1_PAUSE_LEN_MAX,                                             // pause_1_len_max: maximum length of pause with bit value 1\r
+    ROOMBA_0_PULSE_LEN_MIN,                                             // pulse_0_len_min: minimum length of pulse with bit value 0\r
+    ROOMBA_0_PULSE_LEN_MAX,                                             // pulse_0_len_max: maximum length of pulse with bit value 0\r
+    ROOMBA_0_PAUSE_LEN_MIN,                                             // pause_0_len_min: minimum length of pause with bit value 0\r
+    ROOMBA_0_PAUSE_LEN_MAX,                                             // pause_0_len_max: maximum length of pause with bit value 0\r
+    ROOMBA_ADDRESS_OFFSET,                                              // address_offset:  address offset\r
+    ROOMBA_ADDRESS_OFFSET + ROOMBA_ADDRESS_LEN,                         // address_end:     end of address\r
+    ROOMBA_COMMAND_OFFSET,                                              // command_offset:  command offset\r
+    ROOMBA_COMMAND_OFFSET + ROOMBA_COMMAND_LEN,                         // command_end:     end of command\r
+    ROOMBA_COMPLETE_DATA_LEN,                                           // complete_len:    complete length of frame\r
+    ROOMBA_STOP_BIT,                                                    // stop_bit:        flag: frame has stop bit\r
+    ROOMBA_LSB,                                                         // lsb_first:       flag: LSB first\r
+    ROOMBA_FLAGS                                                        // flags:           some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_RCMM_PROTOCOL == 1\r
 \r
-static const PROGMEM IRMP_PARAMETER imon_param =\r
+static const PROGMEM IRMP_PARAMETER rcmm_param =\r
 {\r
-    IRMP_IMON_PROTOCOL,                                                 // protocol:        ir protocol\r
-    IMON_PULSE_LEN,                                                     // pulse_1_len_min: minimum length of pulse with bit value 1\r
-    IMON_PULSE_REST_LEN,                                                // pulse_1_len_max: maximum length of pulse with bit value 1\r
-    IMON_PAUSE_LEN,                                                     // pause_1_len_min: minimum length of pause with bit value 1\r
-    IMON_PAUSE_REST_LEN,                                                // pause_1_len_max: maximum length of pause with bit value 1\r
-    IMON_PULSE_LEN,                                                     // pulse_0_len_min: minimum length of pulse with bit value 0\r
-    IMON_PULSE_REST_LEN,                                                // pulse_0_len_max: maximum length of pulse with bit value 0\r
-    IMON_PAUSE_LEN,                                                     // pause_0_len_min: minimum length of pause with bit value 0\r
-    IMON_PAUSE_REST_LEN,                                                // pause_0_len_max: maximum length of pause with bit value 0\r
-    IMON_ADDRESS_OFFSET,                                                // address_offset:  address offset\r
-    IMON_ADDRESS_OFFSET + IMON_ADDRESS_LEN,                             // address_end:     end of address\r
-    IMON_COMMAND_OFFSET,                                                // command_offset:  command offset\r
-    IMON_COMMAND_OFFSET + IMON_COMMAND_LEN,                             // command_end:     end of command\r
-    IMON_COMPLETE_DATA_LEN,                                             // complete_len:    complete length of frame\r
-    IMON_STOP_BIT,                                                      // stop_bit:        flag: frame has stop bit\r
-    IMON_LSB,                                                           // lsb_first:       flag: LSB first\r
-    IMON_FLAGS                                                          // flags:           some flags\r
+    IRMP_RCMM32_PROTOCOL,                                               // protocol:        ir protocol\r
+   \r
+    RCMM32_BIT_PULSE_LEN_MIN,                                           // pulse_1_len_min: here: minimum length of short pulse\r
+    RCMM32_BIT_PULSE_LEN_MAX,                                           // pulse_1_len_max: here: maximum length of short pulse\r
+    0,                                                                  // pause_1_len_min: here: minimum length of short pause\r
+    0,                                                                  // pause_1_len_max: here: maximum length of short pause\r
+    RCMM32_BIT_PULSE_LEN_MIN,                                           // pulse_0_len_min: here: not used\r
+    RCMM32_BIT_PULSE_LEN_MAX,                                           // pulse_0_len_max: here: not used\r
+    0,                                                                  // pause_0_len_min: here: not used\r
+    0,                                                                  // pause_0_len_max: here: not used\r
+    RCMM32_ADDRESS_OFFSET,                                              // address_offset:  address offset\r
+    RCMM32_ADDRESS_OFFSET + RCMM32_ADDRESS_LEN,                         // address_end:     end of address\r
+    RCMM32_COMMAND_OFFSET,                                              // command_offset:  command offset\r
+    RCMM32_COMMAND_OFFSET + RCMM32_COMMAND_LEN,                         // command_end:     end of command\r
+    RCMM32_COMPLETE_DATA_LEN,                                           // complete_len:    complete length of frame\r
+    RCMM32_STOP_BIT,                                                    // stop_bit:        flag: frame has stop bit\r
+    RCMM32_LSB,                                                         // lsb_first:       flag: LSB first\r
+    RCMM32_FLAGS                                                        // flags:           some flags\r
+};\r
+\r
+#endif\r
+\r
+#if IRMP_SUPPORT_RADIO1_PROTOCOL == 1\r
+\r
+static const PROGMEM IRMP_PARAMETER radio1_param =\r
+{\r
+    IRMP_RADIO1_PROTOCOL,                                               // protocol:        ir protocol\r
+   \r
+    RADIO1_1_PULSE_LEN_MIN,                                             // pulse_1_len_min: minimum length of pulse with bit value 1\r
+    RADIO1_1_PULSE_LEN_MAX,                                             // pulse_1_len_max: maximum length of pulse with bit value 1\r
+    RADIO1_1_PAUSE_LEN_MIN,                                             // pause_1_len_min: minimum length of pause with bit value 1\r
+    RADIO1_1_PAUSE_LEN_MAX,                                             // pause_1_len_max: maximum length of pause with bit value 1\r
+    RADIO1_0_PULSE_LEN_MIN,                                             // pulse_0_len_min: minimum length of pulse with bit value 0\r
+    RADIO1_0_PULSE_LEN_MAX,                                             // pulse_0_len_max: maximum length of pulse with bit value 0\r
+    RADIO1_0_PAUSE_LEN_MIN,                                             // pause_0_len_min: minimum length of pause with bit value 0\r
+    RADIO1_0_PAUSE_LEN_MAX,                                             // pause_0_len_max: maximum length of pause with bit value 0\r
+    RADIO1_ADDRESS_OFFSET,                                              // address_offset:  address offset\r
+    RADIO1_ADDRESS_OFFSET + RADIO1_ADDRESS_LEN,                         // address_end:     end of address\r
+    RADIO1_COMMAND_OFFSET,                                              // command_offset:  command offset\r
+    RADIO1_COMMAND_OFFSET + RADIO1_COMMAND_LEN,                         // command_end:     end of command\r
+    RADIO1_COMPLETE_DATA_LEN,                                           // complete_len:    complete length of frame\r
+    RADIO1_STOP_BIT,                                                    // stop_bit:        flag: frame has stop bit\r
+    RADIO1_LSB,                                                         // lsb_first:       flag: LSB first\r
+    RADIO1_FLAGS                                                        // flags:           some flags\r
 };\r
 \r
 #endif\r
@@ -1536,9 +1742,12 @@ static volatile uint16_t                    irmp_address;
 static volatile uint16_t                    irmp_command;\r
 static volatile uint16_t                    irmp_id;                    // only used for SAMSUNG protocol\r
 static volatile uint8_t                     irmp_flags;\r
+// static volatile uint8_t                  irmp_busy_flag;\r
 \r
 #ifdef ANALYZE\r
+#define input(x)                            (x)\r
 static uint8_t                              IRMP_PIN;\r
+static uint8_t                              radio;\r
 #endif\r
 \r
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
@@ -1550,10 +1759,44 @@ static uint8_t                              IRMP_PIN;
 void\r
 irmp_init (void)\r
 {\r
-#ifndef PIC_CCS_COMPILER\r
+#if defined(PIC_CCS) || defined(PIC_C18)                                // PIC: do nothing\r
+#elif defined (ARM_STM32)                                               // STM32\r
+   GPIO_InitTypeDef     GPIO_InitStructure;\r
+\r
+   /* GPIOx clock enable */\r
+ #if defined (ARM_STM32L1XX)\r
+   RCC_AHBPeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r
+ #elif defined (ARM_STM32F10X)\r
+   RCC_APB2PeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r
+ #elif defined (ARM_STM32F4XX)\r
+   RCC_AHB1PeriphClockCmd(IRMP_PORT_RCC, ENABLE);\r
+ #endif\r
+\r
+   /* GPIO Configuration */\r
+   GPIO_InitStructure.GPIO_Pin = IRMP_BIT;\r
+ #if defined (ARM_STM32L1XX) || defined (ARM_STM32F4XX)\r
+   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;\r
+   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;\r
+   GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;\r
+   GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;\r
+ #elif defined (ARM_STM32F10X)\r
+   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;\r
+   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
+ #endif\r
+   GPIO_Init(IRMP_PORT, &GPIO_InitStructure);\r
+#elif defined(STELLARIS_ARM_CORTEX_M4)\r
+     // Enable the GPIO port\r
+     ROM_SysCtlPeripheralEnable(IRMP_PORT_PERIPH);\r
+\r
+     // Set as an input\r
+     ROM_GPIODirModeSet(IRMP_PORT_BASE, IRMP_PORT_PIN, GPIO_DIR_MODE_IN);\r
+     ROM_GPIOPadConfigSet(IRMP_PORT_BASE, IRMP_PORT_PIN,\r
+                          GPIO_STRENGTH_2MA,\r
+                          GPIO_PIN_TYPE_STD_WPU);\r
+#else                                                                   // AVR\r
     IRMP_PORT &= ~(1<<IRMP_BIT);                                        // deactivate pullup\r
     IRMP_DDR &= ~(1<<IRMP_BIT);                                         // set pin to input\r
-#endif // PIC_CCS_COMPILER\r
+#endif\r
 \r
 #if IRMP_LOGGING == 1\r
     irmp_uart_init ();\r
@@ -1585,7 +1828,15 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
                     rtc = TRUE;\r
                 }\r
                 break;\r
+\r
+#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1\r
+            case IRMP_SAMSUNG48_PROTOCOL:\r
+                irmp_command = (irmp_command & 0x00FF) | ((irmp_id & 0x00FF) << 8);\r
+                rtc = TRUE;\r
+                break;\r
+#endif\r
 #endif\r
+\r
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
             case IRMP_NEC_PROTOCOL:\r
                 if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r
@@ -1595,7 +1846,9 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
                 }\r
                 else if (irmp_address == 0x87EE)\r
                 {\r
+#ifdef ANALYZE\r
                     ANALYZE_PRINTF ("Switching to APPLE protocol\n");\r
+#endif // ANALYZE\r
                     irmp_protocol = IRMP_APPLE_PROTOCOL;\r
                     irmp_address = (irmp_command & 0xFF00) >> 8;\r
                     irmp_command &= 0x00FF;\r
@@ -1603,6 +1856,15 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
                 }\r
                 break;\r
 #endif\r
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1\r
+            case IRMP_BOSE_PROTOCOL:\r
+                if ((irmp_command >> 8) == (~irmp_command & 0x00FF))\r
+                {\r
+                    irmp_command &= 0xff;\r
+                    rtc = TRUE;\r
+                }\r
+                break;\r
+#endif\r
 #if IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1\r
             case IRMP_SIEMENS_PROTOCOL:\r
             case IRMP_RUWIDO_PROTOCOL:\r
@@ -1621,12 +1883,24 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
                 }\r
                 break;\r
 #endif\r
+#if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
+            case IRMP_RC5_PROTOCOL:\r
+                irmp_address &= ~0x20;                              // clear toggle bit\r
+                rtc = TRUE;\r
+                break;\r
+#endif\r
 #if IRMP_SUPPORT_IR60_PROTOCOL == 1\r
             case IRMP_IR60_PROTOCOL:\r
                 if (irmp_command != 0x007d)                         // 0x007d (== 62<<1 + 1) is start instruction frame\r
                 {\r
                     rtc = TRUE;\r
                 }\r
+                else\r
+                {\r
+#ifdef ANALYZE\r
+                    ANALYZE_PRINTF("Info IR60: got start instruction frame\n");\r
+#endif // ANALYZE\r
+                }\r
                 break;\r
 #endif\r
 #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
@@ -1660,12 +1934,16 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
                     }\r
                     else\r
                     {\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF("error NETBOX: bit6/7 must be 0/1\n");\r
+#endif // ANALYZE\r
                     }\r
                 }\r
                 else\r
                 {\r
+#ifdef ANALYZE\r
                     ANALYZE_PRINTF("error NETBOX: last bit not set\n");\r
+#endif // ANALYZE\r
                 }\r
                 break;\r
 #endif\r
@@ -1681,14 +1959,20 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
                 }\r
                 else\r
                 {\r
+#ifdef ANALYZE\r
                     ANALYZE_PRINTF ("CRC error in LEGO protocol\n");\r
-                    rtc = TRUE;\r
+#endif // ANALYZE\r
+                    // rtc = TRUE;                              // don't accept codes with CRC errors\r
                 }\r
                 break;\r
             }\r
 #endif\r
+\r
             default:\r
+            {\r
                 rtc = TRUE;\r
+                break;\r
+            }\r
         }\r
 \r
         if (rtc)\r
@@ -1708,20 +1992,44 @@ irmp_get_data (IRMP_DATA * irmp_data_p)
     return rtc;\r
 }\r
 \r
+// uint8_t\r
+// irmp_is_busy (void)\r
+// {\r
+//     return irmp_busy_flag;\r
+// }\r
+\r
+#if IRMP_USE_CALLBACK == 1\r
+void\r
+irmp_set_callback_ptr (void (*cb)(uint8_t))\r
+{\r
+    irmp_callback_ptr = cb;\r
+}\r
+#endif // IRMP_USE_CALLBACK == 1\r
+\r
 // these statics must not be volatile, because they are only used by irmp_store_bit(), which is called by irmp_ISR()\r
 static uint16_t irmp_tmp_address;                                                       // ir address\r
 static uint16_t irmp_tmp_command;                                                       // ir command\r
 \r
-#if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
+#if (IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)) || IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
 static uint16_t irmp_tmp_address2;                                                      // ir address\r
 static uint16_t irmp_tmp_command2;                                                      // ir command\r
 #endif\r
 \r
+#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1\r
+static uint16_t irmp_lgair_address;                                                     // ir address\r
+static uint16_t irmp_lgair_command;                                                     // ir command\r
+#endif\r
+\r
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
 static uint16_t irmp_tmp_id;                                                            // ir id (only SAMSUNG)\r
 #endif\r
 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
 static uint8_t  xor_check[6];                                                           // check kaseikyo "parity" bits\r
+static uint8_t  genre2;                                                                 // save genre2 bits here, later copied to MSB in flags\r
+#endif\r
+\r
+#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+static uint8_t  parity;                                                                 // number of '1' of the first 14 bits, check if even.\r
 #endif\r
 \r
 /*---------------------------------------------------------------------------------------------------------------------------------------------------\r
@@ -1736,6 +2044,44 @@ static uint8_t  xor_check[6];
 static void\r
 irmp_store_bit (uint8_t value)\r
 {\r
+#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+    if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL)\r
+    {\r
+        if (irmp_bit < 14)\r
+        {\r
+            if (value)\r
+            {\r
+                parity++;\r
+            }\r
+        }\r
+        else if (irmp_bit == 14)\r
+        {\r
+            if (value)                                                                                      // value == 1: even parity\r
+            {\r
+                if (parity & 0x01)\r
+                {\r
+                    parity = PARITY_CHECK_FAILED;\r
+                }\r
+                else\r
+                {\r
+                    parity = PARITY_CHECK_OK;\r
+                }\r
+            }\r
+            else\r
+            {\r
+                if (parity & 0x01)                                                                          // value == 0: odd parity\r
+                {\r
+                    parity = PARITY_CHECK_OK;\r
+                }\r
+                else\r
+                {\r
+                    parity = PARITY_CHECK_FAILED;\r
+                }\r
+            }\r
+        }\r
+    }\r
+#endif\r
+\r
 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r
     if (irmp_bit == 0 && irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL)\r
     {\r
@@ -1760,7 +2106,16 @@ irmp_store_bit (uint8_t value)
     {\r
         if (irmp_param.lsb_first)\r
         {\r
-            irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - irmp_param.command_offset));   // CV wants cast\r
+#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1\r
+            if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit >= 32)\r
+            {\r
+                irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - 32));   // CV wants cast\r
+            }\r
+            else\r
+#endif\r
+            {\r
+                irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - irmp_param.command_offset));   // CV wants cast\r
+            }\r
         }\r
         else\r
         {\r
@@ -1769,39 +2124,68 @@ irmp_store_bit (uint8_t value)
         }\r
     }\r
 \r
+#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1\r
+    if (irmp_param.protocol == IRMP_NEC_PROTOCOL || irmp_param.protocol == IRMP_NEC42_PROTOCOL)\r
+    {\r
+        if (irmp_bit < 8)\r
+        {\r
+            irmp_lgair_address <<= 1;                                                               // LGAIR uses MSB\r
+            irmp_lgair_address |= value;\r
+        }\r
+        else if (irmp_bit < 24)\r
+        {\r
+            irmp_lgair_command <<= 1;                                                               // LGAIR uses MSB\r
+            irmp_lgair_command |= value;\r
+        }\r
+    }\r
+    // NO else!\r
+#endif\r
+\r
 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
-    else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit >= 13 && irmp_bit < 26)\r
+    if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit >= 13 && irmp_bit < 26)\r
     {\r
         irmp_tmp_address2 |= (((uint16_t) (value)) << (irmp_bit - 13));                             // CV wants cast\r
     }\r
+    else\r
 #endif\r
 \r
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
-    else if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)\r
+    if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN)\r
     {\r
         irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - SAMSUNG_ID_OFFSET));                    // store with LSB first\r
     }\r
+    else\r
 #endif\r
 \r
 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
-    else if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && irmp_bit >= 20 && irmp_bit < 24)\r
+    if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)\r
     {\r
-        irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - 8));                   // store 4 system bits in upper nibble with LSB first\r
-    }\r
-\r
-    if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && irmp_bit < KASEIKYO_COMPLETE_DATA_LEN)\r
-    {\r
-        if (value)\r
+        if (irmp_bit >= 20 && irmp_bit < 24)\r
         {\r
-            xor_check[irmp_bit / 8] |= 1 << (irmp_bit % 8);\r
+            irmp_tmp_command |= (((uint16_t) (value)) << (irmp_bit - 8));       // store 4 system bits (genre 1) in upper nibble with LSB first\r
         }\r
-        else\r
+        else if (irmp_bit >= 24 && irmp_bit < 28)\r
         {\r
-            xor_check[irmp_bit / 8] &= ~(1 << (irmp_bit % 8));\r
+            genre2 |= (((uint8_t) (value)) << (irmp_bit - 20));                 // store 4 system bits (genre 2) in upper nibble with LSB first\r
         }\r
-    }\r
 \r
+        if (irmp_bit < KASEIKYO_COMPLETE_DATA_LEN)\r
+        {\r
+            if (value)\r
+            {\r
+                xor_check[irmp_bit / 8] |= 1 << (irmp_bit % 8);\r
+            }\r
+            else\r
+            {\r
+                xor_check[irmp_bit / 8] &= ~(1 << (irmp_bit % 8));\r
+            }\r
+        }\r
+    }\r
+    else\r
 #endif\r
+    {\r
+        ;\r
+    }\r
 \r
     irmp_bit++;\r
 }\r
@@ -1853,10 +2237,11 @@ irmp_ISR (void)
     static PAUSE_LEN    irmp_pause_time;                                        // count bit time for pause\r
     static uint16_t     last_irmp_address = 0xFFFF;                             // save last irmp address to recognize key repetition\r
     static uint16_t     last_irmp_command = 0xFFFF;                             // save last irmp command to recognize key repetition\r
-    static uint16_t     repetition_len;                                         // SIRCS repeats frame 2-5 times with 45 ms pause\r
+    static uint16_t     key_repetition_len;                                     // SIRCS repeats frame 2-5 times with 45 ms pause\r
     static uint8_t      repetition_frame_number;\r
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
     static uint16_t     last_irmp_denon_command;                                // save last irmp command to recognize DENON frame repetition\r
+    static uint16_t     denon_repetition_len = 0xFFFF;                          // denon repetition len of 2nd auto generated frame\r
 #endif\r
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
     static uint8_t      rc5_cmd_bit6;                                           // bit 6 of RC5 command is the inverted 2nd start bit\r
@@ -1871,10 +2256,23 @@ irmp_ISR (void)
 \r
 #ifdef ANALYZE\r
     time_counter++;\r
-#endif\r
+#endif // ANALYZE\r
 \r
     irmp_input = input(IRMP_PIN);\r
 \r
+#if IRMP_USE_CALLBACK == 1\r
+    if (irmp_callback_ptr)\r
+    {\r
+        static uint8_t last_inverted_input;\r
+\r
+        if (last_inverted_input != !irmp_input)\r
+        {\r
+            (*irmp_callback_ptr) (! irmp_input);\r
+            last_inverted_input = !irmp_input;\r
+        }\r
+    }\r
+#endif // IRMP_USE_CALLBACK == 1\r
+\r
     irmp_log(irmp_input);                                                       // log ir signal, if IRMP_LOGGING defined\r
 \r
     if (! irmp_ir_detected)                                                     // ir code already detected?\r
@@ -1883,12 +2281,13 @@ irmp_ISR (void)
         {                                                                       // no...\r
             if (! irmp_input)                                                   // receiving burst?\r
             {                                                                   // yes...\r
+//              irmp_busy_flag = TRUE;\r
 #ifdef ANALYZE\r
                 if (! irmp_pulse_time)\r
                 {\r
-                    ANALYZE_PRINTF("%8d [starting pulse]\n", time_counter);\r
+                    ANALYZE_PRINTF("%8.3fms [starting pulse]\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r
                 }\r
-#endif\r
+#endif // ANALYZE\r
                 irmp_pulse_time++;                                              // increment counter\r
             }\r
             else\r
@@ -1900,12 +2299,21 @@ irmp_ISR (void)
                     wait_for_space          = 0;\r
                     irmp_tmp_command        = 0;\r
                     irmp_tmp_address        = 0;\r
+#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
+                    genre2                  = 0;\r
+#endif\r
+#if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
+                    irmp_tmp_id = 0;\r
+#endif\r
 \r
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1) || IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
                     irmp_tmp_command2       = 0;\r
                     irmp_tmp_address2       = 0;\r
 #endif\r
-\r
+#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1\r
+                    irmp_lgair_command      = 0;\r
+                    irmp_lgair_address      = 0;\r
+#endif\r
                     irmp_bit                = 0xff;\r
                     irmp_pause_time         = 1;                                // 1st pause: set to 1, not to 0!\r
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
@@ -1914,9 +2322,26 @@ irmp_ISR (void)
                 }\r
                 else\r
                 {\r
-                    if (repetition_len < 0xFFFF)                                // avoid overflow of counter\r
+                    if (key_repetition_len < 0xFFFF)                            // avoid overflow of counter\r
                     {\r
-                        repetition_len++;\r
+                        key_repetition_len++;\r
+\r
+#if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
+                        if (denon_repetition_len < 0xFFFF)                      // avoid overflow of counter\r
+                        {\r
+                            denon_repetition_len++;\r
+\r
+                            if (denon_repetition_len >= DENON_AUTO_REPETITION_PAUSE_LEN && last_irmp_denon_command != 0)\r
+                            {\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("%8.3fms warning: did not receive inverted command repetition\n",\r
+                                                (double) (time_counter * 1000) / F_INTERRUPTS);\r
+#endif // ANALYZE\r
+                                last_irmp_denon_command = 0;\r
+                                denon_repetition_len = 0xFFFF;\r
+                            }\r
+                        }\r
+#endif // IRMP_SUPPORT_DENON_PROTOCOL == 1\r
                     }\r
                 }\r
             }\r
@@ -1944,9 +2369,12 @@ irmp_ISR (void)
                         else\r
 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
                         {\r
-                            ANALYZE_PRINTF ("%8d error 1: pause after start bit pulse %d too long: %d\n", time_counter, irmp_pulse_time, irmp_pause_time);\r
+#ifdef ANALYZE\r
+                            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);\r
                             ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                         }\r
+\r
                         irmp_start_bit_detected = 0;                            // reset flags, let's wait for another start bit\r
                         irmp_pulse_time         = 0;\r
                         irmp_pause_time         = 0;\r
@@ -1960,15 +2388,19 @@ irmp_ISR (void)
                     irmp_param2.protocol = 0;\r
 #endif\r
 \r
-                    ANALYZE_PRINTF ("%8d [start-bit: pulse = %2d, pause = %2d]\n", time_counter, irmp_pulse_time, irmp_pause_time);\r
+#ifdef ANALYZE\r
+                    ANALYZE_PRINTF ("%8.3fms [start-bit: pulse = %2d, pause = %2d]\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_pulse_time, irmp_pause_time);\r
+#endif // ANALYZE\r
 \r
 #if IRMP_SUPPORT_SIRCS_PROTOCOL == 1\r
                     if (irmp_pulse_time >= SIRCS_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SIRCS_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= SIRCS_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SIRCS_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's SIRCS\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = SIRCS, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         SIRCS_START_BIT_PULSE_LEN_MIN, SIRCS_START_BIT_PULSE_LEN_MAX,\r
                                         SIRCS_START_BIT_PAUSE_LEN_MIN, SIRCS_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) (IRMP_PARAMETER *) &sircs_param;\r
                     }\r
                     else\r
@@ -1979,9 +2411,11 @@ irmp_ISR (void)
                         irmp_pulse_time >= JVC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= JVC_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= JVC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= JVC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r
                     {\r
-                        ANALYZE_PRINTF ("protocol = NEC or JVC repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = NEC or JVC (type 1) repeat frame, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         JVC_START_BIT_PULSE_LEN_MIN, JVC_START_BIT_PULSE_LEN_MAX,\r
                                         JVC_REPEAT_START_BIT_PAUSE_LEN_MIN, JVC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r
                     }\r
                     else\r
@@ -1992,37 +2426,102 @@ irmp_ISR (void)
                         irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)\r
                     {\r
 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = NEC42, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r
                                         NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &nec42_param;\r
 #else\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = NEC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r
                                         NEC_START_BIT_PAUSE_LEN_MIN, NEC_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r
 #endif\r
-\r
                     }\r
                     else if (irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN        && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r
                              irmp_pause_time >= NEC_REPEAT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_REPEAT_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's NEC\r
-                        ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
-                                        NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r
-                                        NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+                        if (irmp_protocol == IRMP_JVC_PROTOCOL)                 // last protocol was JVC, awaiting repeat frame\r
+                        {                                                       // some jvc remote controls use nec repetition frame for jvc repetition frame\r
+#ifdef ANALYZE\r
+                            ANALYZE_PRINTF ("protocol = JVC repeat frame type 2, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                            NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r
+                                            NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                            irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r
+                        }\r
+                        else\r
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+                        {\r
+#ifdef ANALYZE\r
+                            ANALYZE_PRINTF ("protocol = NEC (repetition frame), start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                            NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r
+                                            NEC_REPEAT_START_BIT_PAUSE_LEN_MIN, NEC_REPEAT_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
 \r
-                        irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param;\r
+                            irmp_param_p = (IRMP_PARAMETER *) &nec_rep_param;\r
+                        }\r
                     }\r
                     else\r
+\r
+#if IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+                    if (irmp_protocol == IRMP_JVC_PROTOCOL &&                   // last protocol was JVC, awaiting repeat frame\r
+                        irmp_pulse_time >= NEC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NEC_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= NEC_0_PAUSE_LEN_MIN         && irmp_pause_time <= NEC_0_PAUSE_LEN_MAX)\r
+                    {                                                           // it's JVC repetition type 3\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = JVC repeat frame type 3, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        NEC_START_BIT_PULSE_LEN_MIN, NEC_START_BIT_PULSE_LEN_MAX,\r
+                                        NEC_0_PAUSE_LEN_MIN, NEC_0_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &nec_param;\r
+                    }\r
+                    else\r
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+\r
 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\r
 \r
+#if IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1\r
+                    if (irmp_pulse_time >= TELEFUNKEN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= TELEFUNKEN_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= TELEFUNKEN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= TELEFUNKEN_START_BIT_PAUSE_LEN_MAX)\r
+                    {\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = TELEFUNKEN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        TELEFUNKEN_START_BIT_PULSE_LEN_MIN, TELEFUNKEN_START_BIT_PULSE_LEN_MAX,\r
+                                        TELEFUNKEN_START_BIT_PAUSE_LEN_MIN, TELEFUNKEN_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &telefunken_param;\r
+                    }\r
+                    else\r
+#endif // IRMP_SUPPORT_TELEFUNKEN_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r
+                    if (irmp_pulse_time >= ROOMBA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= ROOMBA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ROOMBA_START_BIT_PAUSE_LEN_MAX)\r
+                    {\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = ROOMBA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        ROOMBA_START_BIT_PULSE_LEN_MIN, ROOMBA_START_BIT_PULSE_LEN_MAX,\r
+                                        ROOMBA_START_BIT_PAUSE_LEN_MIN, ROOMBA_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &roomba_param;\r
+                    }\r
+                    else\r
+#endif // IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r
+\r
 #if IRMP_SUPPORT_NIKON_PROTOCOL == 1\r
                     if (irmp_pulse_time >= NIKON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NIKON_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= NIKON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NIKON_START_BIT_PAUSE_LEN_MAX)\r
                     {\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = NIKON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         NIKON_START_BIT_PULSE_LEN_MIN, NIKON_START_BIT_PULSE_LEN_MAX,\r
                                         NIKON_START_BIT_PAUSE_LEN_MIN, NIKON_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &nikon_param;\r
                     }\r
                     else\r
@@ -2032,9 +2531,11 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= SAMSUNG_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's SAMSUNG\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = SAMSUNG, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         SAMSUNG_START_BIT_PULSE_LEN_MIN, SAMSUNG_START_BIT_PULSE_LEN_MAX,\r
                                         SAMSUNG_START_BIT_PAUSE_LEN_MIN, SAMSUNG_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &samsung_param;\r
                     }\r
                     else\r
@@ -2044,9 +2545,11 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= MATSUSHITA_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MATSUSHITA_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= MATSUSHITA_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MATSUSHITA_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's MATSUSHITA\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = MATSUSHITA, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         MATSUSHITA_START_BIT_PULSE_LEN_MIN, MATSUSHITA_START_BIT_PULSE_LEN_MAX,\r
                                         MATSUSHITA_START_BIT_PAUSE_LEN_MIN, MATSUSHITA_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &matsushita_param;\r
                     }\r
                     else\r
@@ -2056,21 +2559,39 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= KASEIKYO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KASEIKYO_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= KASEIKYO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KASEIKYO_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's KASEIKYO\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = KASEIKYO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         KASEIKYO_START_BIT_PULSE_LEN_MIN, KASEIKYO_START_BIT_PULSE_LEN_MAX,\r
                                         KASEIKYO_START_BIT_PAUSE_LEN_MIN, KASEIKYO_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &kaseikyo_param;\r
                     }\r
                     else\r
 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
 \r
+#if IRMP_SUPPORT_RADIO1_PROTOCOL == 1\r
+                    if (irmp_pulse_time >= RADIO1_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RADIO1_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= RADIO1_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RADIO1_START_BIT_PAUSE_LEN_MAX)\r
+                    {\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = RADIO1, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        RADIO1_START_BIT_PULSE_LEN_MIN, RADIO1_START_BIT_PULSE_LEN_MAX,\r
+                                        RADIO1_START_BIT_PAUSE_LEN_MIN, RADIO1_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &radio1_param;\r
+                    }\r
+                    else\r
+#endif // IRMP_SUPPORT_RRADIO1_PROTOCOL == 1\r
+\r
 #if IRMP_SUPPORT_RECS80_PROTOCOL == 1\r
                     if (irmp_pulse_time >= RECS80_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= RECS80_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's RECS80\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = RECS80, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         RECS80_START_BIT_PULSE_LEN_MIN, RECS80_START_BIT_PULSE_LEN_MAX,\r
                                         RECS80_START_BIT_PAUSE_LEN_MIN, RECS80_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &recs80_param;\r
                     }\r
                     else\r
@@ -2086,6 +2607,7 @@ irmp_ISR (void)
                         if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r
                             irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("protocol = RC5 or FDC\n");\r
                             ANALYZE_PRINTF ("FDC start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                             FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r
@@ -2093,6 +2615,7 @@ irmp_ISR (void)
                             ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+#endif // ANALYZE\r
                             memcpy_P (&irmp_param2, &fdc_param, sizeof (IRMP_PARAMETER));\r
                         }\r
                         else\r
@@ -2102,6 +2625,7 @@ irmp_ISR (void)
                         if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r
                             irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("protocol = RC5 or RCCAR\n");\r
                             ANALYZE_PRINTF ("RCCAR start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                             RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r
@@ -2109,16 +2633,19 @@ irmp_ISR (void)
                             ANALYZE_PRINTF ("RC5 start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX);\r
+#endif // ANALYZE\r
                             memcpy_P (&irmp_param2, &rccar_param, sizeof (IRMP_PARAMETER));\r
                         }\r
                         else\r
 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("protocol = RC5, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
                                             2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX,\r
                                             RC5_START_BIT_LEN_MIN, RC5_START_BIT_LEN_MAX,\r
                                             2 * RC5_START_BIT_LEN_MIN, 2 * RC5_START_BIT_LEN_MAX);\r
+#endif // ANALYZE\r
                         }\r
 \r
                         irmp_param_p = (IRMP_PARAMETER *) &rc5_param;\r
@@ -2143,10 +2670,12 @@ irmp_ISR (void)
                         ((irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX) ||\r
                          (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)))\r
                     {                                                           // it's DENON\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = DENON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r
                                         DENON_PULSE_LEN_MIN, DENON_PULSE_LEN_MAX,\r
                                         DENON_1_PAUSE_LEN_MIN, DENON_1_PAUSE_LEN_MAX,\r
                                         DENON_0_PAUSE_LEN_MIN, DENON_0_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &denon_param;\r
                     }\r
                     else\r
@@ -2157,22 +2686,40 @@ irmp_ISR (void)
                         ((irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX) ||\r
                          (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)))\r
                     {                                                           // it's THOMSON\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = THOMSON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r
                                         THOMSON_PULSE_LEN_MIN, THOMSON_PULSE_LEN_MAX,\r
                                         THOMSON_1_PAUSE_LEN_MIN, THOMSON_1_PAUSE_LEN_MAX,\r
                                         THOMSON_0_PAUSE_LEN_MIN, THOMSON_0_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &thomson_param;\r
                     }\r
                     else\r
 #endif // IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r
 \r
+#if IRMP_SUPPORT_BOSE_PROTOCOL == 1\r
+                    if (irmp_pulse_time >= BOSE_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= BOSE_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= BOSE_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BOSE_START_BIT_PAUSE_LEN_MAX)\r
+                    {\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = BOSE, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        BOSE_START_BIT_PULSE_LEN_MIN, BOSE_START_BIT_PULSE_LEN_MAX,\r
+                                        BOSE_START_BIT_PAUSE_LEN_MIN, BOSE_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &bose_param;\r
+                    }\r
+                    else\r
+#endif // IRMP_SUPPORT_BOSE_PROTOCOL == 1\r
+\r
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
                     if (irmp_pulse_time >= RC6_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RC6_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= RC6_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RC6_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's RC6\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = RC6, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         RC6_START_BIT_PULSE_LEN_MIN, RC6_START_BIT_PULSE_LEN_MAX,\r
                                         RC6_START_BIT_PAUSE_LEN_MIN, RC6_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &rc6_param;\r
                         last_pause = 0;\r
                         last_value = 1;\r
@@ -2184,9 +2731,11 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= RECS80EXT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RECS80EXT_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= RECS80EXT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RECS80EXT_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's RECS80EXT\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = RECS80EXT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         RECS80EXT_START_BIT_PULSE_LEN_MIN, RECS80EXT_START_BIT_PULSE_LEN_MAX,\r
                                         RECS80EXT_START_BIT_PAUSE_LEN_MIN, RECS80EXT_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &recs80ext_param;\r
                     }\r
                     else\r
@@ -2196,18 +2745,35 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= NUBERT_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NUBERT_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= NUBERT_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NUBERT_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's NUBERT\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = NUBERT, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         NUBERT_START_BIT_PULSE_LEN_MIN, NUBERT_START_BIT_PULSE_LEN_MAX,\r
                                         NUBERT_START_BIT_PAUSE_LEN_MIN, NUBERT_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &nubert_param;\r
                     }\r
                     else\r
 #endif // IRMP_SUPPORT_NUBERT_PROTOCOL == 1\r
 \r
+#if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1\r
+                    if (irmp_pulse_time >= SPEAKER_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= SPEAKER_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= SPEAKER_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SPEAKER_START_BIT_PAUSE_LEN_MAX)\r
+                    {                                                           // it's SPEAKER\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = SPEAKER, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        SPEAKER_START_BIT_PULSE_LEN_MIN, SPEAKER_START_BIT_PULSE_LEN_MAX,\r
+                                        SPEAKER_START_BIT_PAUSE_LEN_MIN, SPEAKER_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &speaker_param;\r
+                    }\r
+                    else\r
+#endif // IRMP_SUPPORT_SPEAKER_PROTOCOL == 1\r
+\r
 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
                     if (irmp_pulse_time >= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN && irmp_pulse_time <= BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX)\r
                     {                                                           // it's BANG_OLUFSEN\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = BANG_OLUFSEN\n");\r
                         ANALYZE_PRINTF ("start bit 1 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r
@@ -2221,6 +2787,7 @@ irmp_ISR (void)
                         ANALYZE_PRINTF ("start bit 4 timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         BANG_OLUFSEN_START_BIT4_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PULSE_LEN_MAX,\r
                                         BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT4_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &bang_olufsen_param;\r
                         last_value = 0;\r
                     }\r
@@ -2231,9 +2798,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 &&\r
                         irmp_pause_time >= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX)\r
                     {                                                           // it's GRUNDIG\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = GRUNDIG, pre bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN, GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX,\r
                                         GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN, GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &grundig_param;\r
                         last_pause = irmp_pause_time;\r
                         last_value  = 1;\r
@@ -2247,11 +2816,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) || \r
                          (irmp_pause_time >= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX)))\r
                     {                                                           // it's RUWIDO or SIEMENS\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = RUWIDO, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n",\r
                                         SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN,   SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r
                                         2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PULSE_LEN_MAX,\r
                                         SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN,   SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX,\r
                                         2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &ruwido_param;\r
                         last_pause = irmp_pause_time;\r
                         last_value  = 1;\r
@@ -2263,9 +2834,11 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX)\r
                     {\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = FDC, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX,\r
                                         FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &fdc_param;\r
                     }\r
                     else\r
@@ -2275,9 +2848,11 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= RCCAR_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCCAR_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= RCCAR_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_START_BIT_PAUSE_LEN_MAX)\r
                     {\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = RCCAR, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         RCCAR_START_BIT_PULSE_LEN_MIN, RCCAR_START_BIT_PULSE_LEN_MAX,\r
                                         RCCAR_START_BIT_PAUSE_LEN_MIN, RCCAR_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &rccar_param;\r
                     }\r
                     else\r
@@ -2287,9 +2862,11 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= KATHREIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= KATHREIN_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= KATHREIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= KATHREIN_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's KATHREIN\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = KATHREIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         KATHREIN_START_BIT_PULSE_LEN_MIN, KATHREIN_START_BIT_PULSE_LEN_MAX,\r
                                         KATHREIN_START_BIT_PAUSE_LEN_MIN, KATHREIN_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &kathrein_param;\r
                     }\r
                     else\r
@@ -2299,52 +2876,80 @@ irmp_ISR (void)
                     if (irmp_pulse_time >= NETBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= NETBOX_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= NETBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NETBOX_START_BIT_PAUSE_LEN_MAX)\r
                     {                                                           // it's NETBOX\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = NETBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         NETBOX_START_BIT_PULSE_LEN_MIN, NETBOX_START_BIT_PULSE_LEN_MAX,\r
                                         NETBOX_START_BIT_PAUSE_LEN_MIN, NETBOX_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &netbox_param;\r
                     }\r
                     else\r
 #endif // IRMP_SUPPORT_NETBOX_PROTOCOL == 1\r
 \r
-#if IRMP_SUPPORT_MERLIN_PROTOCOL == 1\r
-                    if (irmp_pulse_time >= MERLIN_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= MERLIN_START_BIT_PULSE_LEN_MAX &&\r
-                        irmp_pause_time >= MERLIN_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= MERLIN_START_BIT_PAUSE_LEN_MAX)\r
-                    {                                                           // it's MERLIN\r
-                        ANALYZE_PRINTF ("protocol = MERLIN, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
-                                        MERLIN_START_BIT_PULSE_LEN_MIN, MERLIN_START_BIT_PULSE_LEN_MAX,\r
-                                        MERLIN_START_BIT_PAUSE_LEN_MIN, MERLIN_START_BIT_PAUSE_LEN_MAX);\r
-                        irmp_param_p = (IRMP_PARAMETER *) &merlin_param;\r
-                    }\r
-                    else\r
-#endif // IRMP_SUPPORT_MERLIN_PROTOCOL == 1\r
-\r
 #if IRMP_SUPPORT_LEGO_PROTOCOL == 1\r
                     if (irmp_pulse_time >= LEGO_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= LEGO_START_BIT_PULSE_LEN_MAX &&\r
                         irmp_pause_time >= LEGO_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= LEGO_START_BIT_PAUSE_LEN_MAX)\r
                     {\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = LEGO, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
                                         LEGO_START_BIT_PULSE_LEN_MIN, LEGO_START_BIT_PULSE_LEN_MAX,\r
                                         LEGO_START_BIT_PAUSE_LEN_MIN, LEGO_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                         irmp_param_p = (IRMP_PARAMETER *) &lego_param;\r
                     }\r
                     else\r
-#endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\r
+#endif // IRMP_SUPPORT_LEGO_PROTOCOL == 1\r
 \r
-#if IRMP_SUPPORT_IMON_PROTOCOL == 1\r
-                    if (irmp_pulse_time >= IMON_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= IMON_START_BIT_PULSE_LEN_MAX &&\r
-                        irmp_pause_time >= IMON_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= IMON_START_BIT_PAUSE_LEN_MAX)\r
-                    {                                                           // it's IMON\r
-                        ANALYZE_PRINTF ("protocol = IMON, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
-                                        IMON_START_BIT_PULSE_LEN_MIN, IMON_START_BIT_PULSE_LEN_MAX,\r
-                                        IMON_START_BIT_PAUSE_LEN_MIN, IMON_START_BIT_PAUSE_LEN_MAX);\r
-                        irmp_param_p = (IRMP_PARAMETER *) &imon_param;\r
+#if IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1\r
+                    if (irmp_pulse_time >= A1TVBOX_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= A1TVBOX_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= A1TVBOX_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= A1TVBOX_START_BIT_PAUSE_LEN_MAX)\r
+                    {                                                           // it's A1TVBOX\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = A1TVBOX, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        A1TVBOX_START_BIT_PULSE_LEN_MIN, A1TVBOX_START_BIT_PULSE_LEN_MAX,\r
+                                        A1TVBOX_START_BIT_PAUSE_LEN_MIN, A1TVBOX_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &a1tvbox_param;\r
+                        last_pause = 0;\r
+                        last_value = 1;\r
                     }\r
                     else\r
-#endif // IRMP_SUPPORT_IMON_PROTOCOL == 1\r
+#endif // IRMP_SUPPORT_A1TVBOX_PROTOCOL == 1\r
 \r
+#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+                    if (irmp_pulse_time >= ORTEK_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= ORTEK_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= ORTEK_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= ORTEK_START_BIT_PAUSE_LEN_MAX)\r
+                    {                                                           // it's ORTEK (Hama)\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = ORTEK, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        ORTEK_START_BIT_PULSE_LEN_MIN, ORTEK_START_BIT_PULSE_LEN_MAX,\r
+                                        ORTEK_START_BIT_PAUSE_LEN_MIN, ORTEK_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &ortek_param;\r
+                        last_pause  = 0;\r
+                        last_value  = 1;\r
+                        parity      = 0;\r
+                    }\r
+                    else\r
+#endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_RCMM_PROTOCOL == 1\r
+                    if (irmp_pulse_time >= RCMM32_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= RCMM32_START_BIT_PULSE_LEN_MAX &&\r
+                        irmp_pause_time >= RCMM32_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_START_BIT_PAUSE_LEN_MAX)\r
+                    {                                                           // it's RCMM\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("protocol = RCMM, start bit timings: pulse: %3d - %3d, pause: %3d - %3d\n",\r
+                                        RCMM32_START_BIT_PULSE_LEN_MIN, RCMM32_START_BIT_PULSE_LEN_MAX,\r
+                                        RCMM32_START_BIT_PAUSE_LEN_MIN, RCMM32_START_BIT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
+                        irmp_param_p = (IRMP_PARAMETER *) &rcmm_param;\r
+                    }\r
+                    else\r
+#endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1\r
                     {\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("protocol = UNKNOWN\n");\r
+#endif // ANALYZE\r
                         irmp_start_bit_detected = 0;                            // wait for another start bit...\r
                     }\r
 \r
@@ -2352,27 +2957,32 @@ irmp_ISR (void)
                     {\r
                         memcpy_P (&irmp_param, irmp_param_p, sizeof (IRMP_PARAMETER));\r
 \r
-#ifdef ANALYZE\r
                         if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max);\r
                             ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max);\r
+#endif // ANALYZE\r
                         }\r
                         else\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_1_len_min, irmp_param.pulse_1_len_max,\r
                                             2 * irmp_param.pulse_1_len_min, 2 * irmp_param.pulse_1_len_max);\r
                             ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_1_len_min, irmp_param.pause_1_len_max,\r
                                             2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max);\r
+#endif // ANALYZE\r
                         }\r
 \r
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
                         if (irmp_param2.protocol)\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param2.pulse_0_len_min, irmp_param2.pulse_0_len_max);\r
                             ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param2.pause_0_len_min, irmp_param2.pause_0_len_max);\r
                             ANALYZE_PRINTF ("pulse_1: %3d - %3d\n", irmp_param2.pulse_1_len_min, irmp_param2.pulse_1_len_max);\r
                             ANALYZE_PRINTF ("pause_1: %3d - %3d\n", irmp_param2.pause_1_len_min, irmp_param2.pause_1_len_max);\r
+#endif // ANALYZE\r
                         }\r
 #endif\r
 \r
@@ -2380,16 +2990,30 @@ irmp_ISR (void)
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
                         if (irmp_param.protocol == IRMP_RC6_PROTOCOL)\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("pulse_toggle: %3d - %3d\n", RC6_TOGGLE_BIT_LEN_MIN, RC6_TOGGLE_BIT_LEN_MAX);\r
+#endif // ANALYZE\r
                         }\r
 #endif\r
 \r
                         if (! (irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))\r
                         {\r
-                            ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", 2 * irmp_param.pulse_1_len_min, 2 * irmp_param.pulse_1_len_max);\r
-                            ANALYZE_PRINTF ("pause_0: %3d - %3d\n", 2 * irmp_param.pause_1_len_min, 2 * irmp_param.pause_1_len_max);\r
+#ifdef ANALYZE\r
+                            ANALYZE_PRINTF ("pulse_0: %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r
+                            ANALYZE_PRINTF ("pause_0: %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max);\r
+#endif // ANALYZE\r
+                        }\r
+                        else\r
+                        {\r
+#ifdef ANALYZE\r
+                            ANALYZE_PRINTF ("pulse: %3d - %3d or %3d - %3d\n", irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max,\r
+                                            2 * irmp_param.pulse_0_len_min, 2 * irmp_param.pulse_0_len_max);\r
+                            ANALYZE_PRINTF ("pause: %3d - %3d or %3d - %3d\n", irmp_param.pause_0_len_min, irmp_param.pause_0_len_max,\r
+                                            2 * irmp_param.pause_0_len_min, 2 * irmp_param.pause_0_len_max);\r
+#endif // ANALYZE\r
                         }\r
 \r
+#ifdef ANALYZE\r
 #if IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL == 1\r
                         if (irmp_param.protocol == IRMP_BANG_OLUFSEN_PROTOCOL)\r
                         {\r
@@ -2414,17 +3038,20 @@ irmp_ISR (void)
                     {\r
                         if (irmp_pause_time > irmp_param.pulse_1_len_max && irmp_pause_time <= 2 * irmp_param.pulse_1_len_max)\r
                         {\r
-                            ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+#ifdef ANALYZE\r
+                            ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
                             ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r
                             ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                             irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0 : 1);\r
                         }\r
                         else if (! last_value)  // && irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r
                         {\r
-                            ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
-\r
+#ifdef ANALYZE\r
+                            ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
                             ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r
                             ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                             irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0);\r
                         }\r
                     }\r
@@ -2443,19 +3070,25 @@ irmp_ISR (void)
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
                     if (irmp_param.protocol == IRMP_DENON_PROTOCOL)\r
                     {\r
-                        ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+#endif // ANALYZE\r
 \r
                         if (irmp_pause_time >= DENON_1_PAUSE_LEN_MIN && irmp_pause_time <= DENON_1_PAUSE_LEN_MAX)\r
                         {                                                       // pause timings correct for "1"?\r
-                          ANALYZE_PUTCHAR ('1');                                  // yes, store 1\r
-                          ANALYZE_NEWLINE ();\r
-                          irmp_store_bit (1);\r
+#ifdef ANALYZE\r
+                            ANALYZE_PUTCHAR ('1');                                  // yes, store 1\r
+                            ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
+                            irmp_store_bit (1);\r
                         }\r
                         else // if (irmp_pause_time >= DENON_0_PAUSE_LEN_MIN && irmp_pause_time <= DENON_0_PAUSE_LEN_MAX)\r
                         {                                                       // pause timings correct for "0"?\r
-                          ANALYZE_PUTCHAR ('0');                                  // yes, store 0\r
-                          ANALYZE_NEWLINE ();\r
-                          irmp_store_bit (0);\r
+#ifdef ANALYZE\r
+                            ANALYZE_PUTCHAR ('0');                                  // yes, store 0\r
+                            ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
+                            irmp_store_bit (0);\r
                         }\r
                     }\r
                     else\r
@@ -2463,18 +3096,24 @@ irmp_ISR (void)
 #if IRMP_SUPPORT_THOMSON_PROTOCOL == 1\r
                     if (irmp_param.protocol == IRMP_THOMSON_PROTOCOL)\r
                     {\r
-                        ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+#endif // ANALYZE\r
 \r
                         if (irmp_pause_time >= THOMSON_1_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_1_PAUSE_LEN_MAX)\r
                         {                                                       // pause timings correct for "1"?\r
+#ifdef ANALYZE\r
                           ANALYZE_PUTCHAR ('1');                                  // yes, store 1\r
                           ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                           irmp_store_bit (1);\r
                         }\r
                         else // if (irmp_pause_time >= THOMSON_0_PAUSE_LEN_MIN && irmp_pause_time <= THOMSON_0_PAUSE_LEN_MAX)\r
                         {                                                       // pause timings correct for "0"?\r
+#ifdef ANALYZE\r
                           ANALYZE_PUTCHAR ('0');                                  // yes, store 0\r
                           ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                           irmp_store_bit (0);\r
                         }\r
                     }\r
@@ -2511,13 +3150,15 @@ irmp_ISR (void)
                             {\r
                                 ANALYZE_PRINTF ("stop bit detected\n");\r
                             }\r
-#endif\r
+#endif // ANALYZE\r
                             irmp_param.stop_bit = 0;\r
                         }\r
                         else\r
                         {\r
-                            ANALYZE_PRINTF ("error: stop bit timing wrong\n");\r
-\r
+#ifdef ANALYZE\r
+                            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",\r
+                                            irmp_bit, irmp_pulse_time, irmp_param.pulse_0_len_min, irmp_param.pulse_0_len_max);\r
+#endif // ANALYZE\r
                             irmp_start_bit_detected = 0;                        // wait for another start bit...\r
                             irmp_pulse_time         = 0;\r
                             irmp_pause_time         = 0;\r
@@ -2548,22 +3189,15 @@ irmp_ISR (void)
                             got_light = TRUE;                                                       // this is a lie, but helps (generates stop bit)\r
                         }\r
                         else\r
-#if 1\r
-                        // MERLIN generates no stop bit, here is the timeout condition:\r
-                        if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_SERIAL) && irmp_param.protocol == IRMP_MERLIN_PROTOCOL &&\r
-                            irmp_pause_time >= MERLIN_PULSE_LEN * (MERLIN_COMPLETE_DATA_LEN - irmp_bit))\r
-                        {\r
-                            got_light = TRUE;                                                       // this is a lie, but helps (generates stop bit)\r
-                        }\r
-                        else\r
-#endif\r
 #endif\r
 #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1\r
                         if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && !irmp_param.stop_bit)\r
                         {\r
-                            if (irmp_pause_time > IR60_TIMEOUT_LEN && irmp_bit == 6)\r
+                            if (irmp_pause_time > IR60_TIMEOUT_LEN && (irmp_bit == 5 || irmp_bit == 6))\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("Switching to IR60 protocol\n");\r
+#endif // ANALYZE\r
                                 got_light = TRUE;                                       // this is a lie, but generates a stop bit ;-)\r
                                 irmp_param.stop_bit = TRUE;                             // set flag\r
 \r
@@ -2585,7 +3219,9 @@ irmp_ISR (void)
                             }\r
                             else if (irmp_bit >= GRUNDIG_COMPLETE_DATA_LEN)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("Switching to NOKIA protocol\n");\r
+#endif // ANALYZE\r
                                 irmp_param.protocol         = IRMP_NOKIA_PROTOCOL;      // change protocol\r
                                 irmp_param.address_offset   = NOKIA_ADDRESS_OFFSET;\r
                                 irmp_param.address_end      = NOKIA_ADDRESS_OFFSET + NOKIA_ADDRESS_LEN;\r
@@ -2612,7 +3248,9 @@ irmp_ISR (void)
                             }\r
                             else if (irmp_bit >= RUWIDO_COMPLETE_DATA_LEN)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("Switching to SIEMENS protocol\n");\r
+#endif // ANALYZE\r
                                 irmp_param.protocol         = IRMP_SIEMENS_PROTOCOL;    // change protocol\r
                                 irmp_param.address_offset   = SIEMENS_ADDRESS_OFFSET;\r
                                 irmp_param.address_end      = SIEMENS_ADDRESS_OFFSET + SIEMENS_ADDRESS_LEN;\r
@@ -2625,12 +3263,29 @@ irmp_ISR (void)
                                 irmp_tmp_address <<= 2;\r
                                 irmp_tmp_address |= (irmp_tmp_command >> 6);\r
                                 irmp_tmp_command &= 0x003F;\r
-                                irmp_tmp_command <<= 4;\r
+//                              irmp_tmp_command <<= 4;\r
                                 irmp_tmp_command |= last_value;\r
                             }\r
                         }\r
                         else\r
 #endif\r
+#if IRMP_SUPPORT_ROOMBA_PROTOCOL == 1\r
+                        if (irmp_param.protocol == IRMP_ROOMBA_PROTOCOL &&                          // Roomba has no stop bit\r
+                            irmp_bit >= ROOMBA_COMPLETE_DATA_LEN - 1)                               // it's the last data bit...\r
+                        {                                                                           // break and close this frame\r
+                            if (irmp_pulse_time >= ROOMBA_1_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_1_PULSE_LEN_MAX)\r
+                            {\r
+                                irmp_pause_time = ROOMBA_1_PAUSE_LEN_EXACT;\r
+                            }\r
+                            else if (irmp_pulse_time >= ROOMBA_0_PULSE_LEN_MIN && irmp_pulse_time <= ROOMBA_0_PULSE_LEN_MAX)\r
+                            {\r
+                                irmp_pause_time = ROOMBA_0_PAUSE_LEN;\r
+                            }\r
+\r
+                            got_light = TRUE;                                                       // this is a lie, but helps (generates stop bit)\r
+                        }\r
+                        else\r
+#endif\r
 #if IRMP_SUPPORT_MANCHESTER == 1\r
                         if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER) &&\r
                             irmp_pause_time >= 2 * irmp_param.pause_1_len_max && irmp_bit >= irmp_param.complete_len - 2 && !irmp_param.stop_bit)\r
@@ -2649,7 +3304,9 @@ irmp_ISR (void)
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r
                             else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17))      // it was a JVC stop bit\r
                             {\r
-                                ANALYZE_PRINTF ("Switching to JVC protocol\n");\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);\r
+#endif // ANALYZE\r
                                 irmp_param.stop_bit     = TRUE;                                     // set flag\r
                                 irmp_param.protocol     = IRMP_JVC_PROTOCOL;                        // switch protocol\r
                                 irmp_param.complete_len = irmp_bit;                                 // patch length: 16 or 17\r
@@ -2658,12 +3315,28 @@ irmp_ISR (void)
                                 irmp_start_bit_detected = 1;                                        // tricky: don't wait for another start bit...\r
                             }\r
 #endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1\r
+                            else if (irmp_param.protocol == IRMP_NEC_PROTOCOL && (irmp_bit == 28 || irmp_bit == 29))      // it was a LGAIR stop bit\r
+                            {\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("Switching to LGAIR protocol, irmp_bit = %d\n", irmp_bit);\r
+#endif // ANALYZE\r
+                                irmp_param.stop_bit     = TRUE;                                     // set flag\r
+                                irmp_param.protocol     = IRMP_LGAIR_PROTOCOL;                      // switch protocol\r
+                                irmp_param.complete_len = irmp_bit;                                 // patch length: 16 or 17\r
+                                irmp_tmp_command        = irmp_lgair_command;                       // set command: upper 8 bits are command bits\r
+                                irmp_tmp_address        = irmp_lgair_address;                       // lower 4 bits are address bits\r
+                                irmp_start_bit_detected = 1;                                        // tricky: don't wait for another start bit...\r
+                            }\r
+#endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1\r
 \r
 #if IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
-                            else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 32)  // it was a NEC stop bit\r
+                            else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 32)      // it was a NEC stop bit\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("Switching to NEC protocol\n");\r
+#endif // ANALYZE\r
                                 irmp_param.stop_bit     = TRUE;                                     // set flag\r
                                 irmp_param.protocol     = IRMP_NEC_PROTOCOL;                        // switch protocol\r
                                 irmp_param.complete_len = irmp_bit;                                 // patch length: 16 or 17\r
@@ -2671,31 +3344,85 @@ irmp_ISR (void)
                                 //        0123456789ABC0123456789ABC0123456701234567\r
                                 // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc\r
                                 // NEC:   AAAAAAAAaaaaaaaaCCCCCCCCcccccccc\r
-                                irmp_tmp_address        |= (irmp_tmp_address2 & 0x0007) << 12;\r
+                                irmp_tmp_address        |= (irmp_tmp_address2 & 0x0007) << 13;      // fm 2012-02-13: 12 -> 13\r
                                 irmp_tmp_command        = (irmp_tmp_address2 >> 3) | (irmp_tmp_command << 10);\r
                             }\r
 #endif // IRMP_SUPPORT_NEC_PROTOCOL == 1\r
+#if IRMP_SUPPORT_LGAIR_PROTOCOL == 1\r
+                            else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 28)      // it was a NEC stop bit\r
+                            {\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("Switching to LGAIR protocol\n");\r
+#endif // ANALYZE\r
+                                irmp_param.stop_bit     = TRUE;                                     // set flag\r
+                                irmp_param.protocol     = IRMP_LGAIR_PROTOCOL;                      // switch protocol\r
+                                irmp_param.complete_len = irmp_bit;                                 // patch length: 16 or 17\r
+                                irmp_tmp_address        = irmp_lgair_address;\r
+                                irmp_tmp_command        = irmp_lgair_command;\r
+                            }\r
+#endif // IRMP_SUPPORT_LGAIR_PROTOCOL == 1\r
 #if IRMP_SUPPORT_JVC_PROTOCOL == 1\r
-                            else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit == 16)  // it was a JVC stop bit\r
+                            else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && (irmp_bit == 16 || irmp_bit == 17))  // it was a JVC stop bit\r
                             {\r
-                                ANALYZE_PRINTF ("Switching to JVC protocol\n");\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("Switching to JVC protocol, irmp_bit = %d\n", irmp_bit);\r
+#endif // ANALYZE\r
                                 irmp_param.stop_bit     = TRUE;                                     // set flag\r
                                 irmp_param.protocol     = IRMP_JVC_PROTOCOL;                        // switch protocol\r
                                 irmp_param.complete_len = irmp_bit;                                 // patch length: 16 or 17\r
 \r
-                                //        0123456789ABC0123456789ABC0123456701234567\r
-                                // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc\r
-                                // JVC:   AAAACCCCCCCCCCCC\r
-                                irmp_tmp_command        = (irmp_tmp_address >> 4) | (irmp_tmp_address2 << 9);   // set command: upper 12 bits are command bits\r
-                                irmp_tmp_address        = irmp_tmp_address & 0x000F;                            // lower 4 bits are address bits\r
+                                //        0123456789ABC0123456789ABC0123456701234567\r
+                                // NEC42: AAAAAAAAAAAAAaaaaaaaaaaaaaCCCCCCCCcccccccc\r
+                                // JVC:   AAAACCCCCCCCCCCC\r
+                                irmp_tmp_command        = (irmp_tmp_address >> 4) | (irmp_tmp_address2 << 9);   // set command: upper 12 bits are command bits\r
+                                irmp_tmp_address        = irmp_tmp_address & 0x000F;                            // lower 4 bits are address bits\r
+                            }\r
+#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
+#endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1\r
+                            else if (irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL && irmp_bit == 32)          // it was a SAMSUNG32 stop bit\r
+                            {\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");\r
+#endif // ANALYZE\r
+                                irmp_param.protocol         = IRMP_SAMSUNG32_PROTOCOL;\r
+                                irmp_param.command_offset   = SAMSUNG32_COMMAND_OFFSET;\r
+                                irmp_param.command_end      = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;\r
+                                irmp_param.complete_len     = SAMSUNG32_COMPLETE_DATA_LEN;\r
+                            }\r
+#endif // IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
+\r
+#if IRMP_SUPPORT_RCMM_PROTOCOL == 1\r
+                            else if (irmp_param.protocol == IRMP_RCMM32_PROTOCOL && (irmp_bit == 12 || irmp_bit == 24))  // it was a RCMM stop bit\r
+                            {\r
+                                if (irmp_bit == 12)\r
+                                {\r
+                                    irmp_tmp_command = (irmp_tmp_address & 0xFF);                   // set command: lower 8 bits are command bits\r
+                                    irmp_tmp_address >>= 8;                                         // upper 4 bits are address bits\r
+\r
+#ifdef ANALYZE\r
+                                    ANALYZE_PRINTF ("Switching to RCMM12 protocol, irmp_bit = %d\n", irmp_bit);\r
+#endif // ANALYZE\r
+                                    irmp_param.protocol     = IRMP_RCMM12_PROTOCOL;                 // switch protocol\r
+                                }\r
+                                else // if ((irmp_bit == 24)\r
+                                {\r
+#ifdef ANALYZE\r
+                                    ANALYZE_PRINTF ("Switching to RCMM24 protocol, irmp_bit = %d\n", irmp_bit);\r
+#endif // ANALYZE\r
+                                    irmp_param.protocol     = IRMP_RCMM24_PROTOCOL;                 // switch protocol\r
+                                }\r
+                                irmp_param.stop_bit     = TRUE;                                     // set flag\r
+                                irmp_param.complete_len = irmp_bit;                                 // patch length\r
                             }\r
-#endif // IRMP_SUPPORT_JVC_PROTOCOL == 1\r
-#endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
+#endif // IRMP_SUPPORT_RCMM_PROTOCOL == 1\r
                             else\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("error 2: pause %d after data bit %d too long\n", irmp_pause_time, irmp_bit);\r
                                 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
-\r
+#endif // ANALYZE\r
                                 irmp_start_bit_detected = 0;                    // wait for another start bit...\r
                                 irmp_pulse_time         = 0;\r
                                 irmp_pause_time         = 0;\r
@@ -2710,7 +3437,9 @@ irmp_ISR (void)
 \r
                 if (got_light)\r
                 {\r
-                    ANALYZE_PRINTF ("%8d [bit %2d: pulse = %3d, pause = %3d] ", time_counter, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+#ifdef ANALYZE\r
+                    ANALYZE_PRINTF ("%8.3fms [bit %2d: pulse = %3d, pause = %3d] ", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit, irmp_pulse_time, irmp_pause_time);\r
+#endif // ANALYZE\r
 \r
 #if IRMP_SUPPORT_MANCHESTER == 1\r
                     if ((irmp_param.flags & IRMP_PARAM_FLAG_IS_MANCHESTER))                                     // Manchester\r
@@ -2725,7 +3454,9 @@ irmp_ISR (void)
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
                             if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN)         // RC6 toggle bit\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PUTCHAR ('T');\r
+#endif // ANALYZE\r
                                 if (irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG)                      // RC6 mode 6A\r
                                 {\r
                                     irmp_store_bit (1);\r
@@ -2736,18 +3467,24 @@ irmp_ISR (void)
                                     irmp_store_bit (0);\r
                                     last_value = 0;\r
                                 }\r
+#ifdef ANALYZE\r
                                 ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                             }\r
                             else\r
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '0' : '1');\r
+#endif // ANALYZE\r
                                 irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 0  :  1 );\r
 \r
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
                                 if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 4 && irmp_pulse_time > RC6_TOGGLE_BIT_LEN_MIN)      // RC6 toggle bit\r
                                 {\r
+#ifdef ANALYZE\r
                                     ANALYZE_PUTCHAR ('T');\r
+#endif // ANALYZE\r
                                     irmp_store_bit (1);\r
 \r
                                     if (irmp_pause_time > 2 * irmp_param.pause_1_len_max)\r
@@ -2758,18 +3495,24 @@ irmp_ISR (void)
                                     {\r
                                         last_value = 1;\r
                                     }\r
+#ifdef ANALYZE\r
                                     ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                                 }\r
                                 else\r
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
                                 {\r
+#ifdef ANALYZE\r
                                     ANALYZE_PUTCHAR ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? '1' : '0');\r
+#endif // ANALYZE\r
                                     irmp_store_bit ((irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 :   0 );\r
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
                                     if (! irmp_param2.protocol)\r
 #endif\r
                                     {\r
+#ifdef ANALYZE\r
                                         ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                                     }\r
                                     last_value = (irmp_param.flags & IRMP_PARAM_FLAG_1ST_PULSE_IS_1) ? 1 : 0;\r
                                 }\r
@@ -2790,19 +3533,25 @@ irmp_ISR (void)
                                 manchester_value = last_value;\r
                             }\r
 \r
+#ifdef ANALYZE\r
                             ANALYZE_PUTCHAR (manchester_value + '0');\r
+#endif // ANALYZE\r
 \r
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && (IRMP_SUPPORT_FDC_PROTOCOL == 1 || IRMP_SUPPORT_RCCAR_PROTOCOL == 1)\r
                             if (! irmp_param2.protocol)\r
 #endif\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                             }\r
 \r
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
                             if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_bit == 1 && manchester_value == 1)     // RC6 mode != 0 ???\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("Switching to RC6A protocol\n");\r
+#endif // ANALYZE\r
                                 irmp_param.complete_len = RC6_COMPLETE_DATA_LEN_LONG;\r
                                 irmp_param.address_offset = 5;\r
                                 irmp_param.address_end = irmp_param.address_offset + 15;\r
@@ -2822,7 +3571,9 @@ irmp_ISR (void)
                                 ((irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX) ||\r
                                  (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)))\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PUTCHAR ('?');\r
+#endif // ANALYZE\r
                                 irmp_param.protocol = 0;                // switch to FDC, see below\r
                             }\r
                             else\r
@@ -2833,16 +3584,20 @@ irmp_ISR (void)
                                 ((irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX) ||\r
                                  (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)))\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PUTCHAR ('?');\r
+#endif // ANALYZE\r
                                 irmp_param.protocol = 0;                // switch to RCCAR, see below\r
                             }\r
                             else\r
 #endif // IRMP_SUPPORT_RCCAR_PROTOCOL == 1\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PUTCHAR ('?');\r
                                 ANALYZE_NEWLINE ();\r
                                 ANALYZE_PRINTF ("error 3 manchester: timing not correct: data bit %d,  pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
                                 ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                                 irmp_start_bit_detected = 0;                            // reset flags and wait for next start bit\r
                                 irmp_pause_time         = 0;\r
                             }\r
@@ -2853,18 +3608,24 @@ irmp_ISR (void)
                         {\r
                             if (irmp_pause_time >= FDC_1_PAUSE_LEN_MIN && irmp_pause_time <= FDC_1_PAUSE_LEN_MAX)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("   1 (FDC)\n");\r
+#endif // ANALYZE\r
                                 irmp_store_bit2 (1);\r
                             }\r
                             else if (irmp_pause_time >= FDC_0_PAUSE_LEN_MIN && irmp_pause_time <= FDC_0_PAUSE_LEN_MAX)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("   0 (FDC)\n");\r
+#endif // ANALYZE\r
                                 irmp_store_bit2 (0);\r
                             }\r
 \r
                             if (! irmp_param.protocol)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("Switching to FDC protocol\n");\r
+#endif // ANALYZE\r
                                 memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r
                                 irmp_param2.protocol = 0;\r
                                 irmp_tmp_address = irmp_tmp_address2;\r
@@ -2877,18 +3638,24 @@ irmp_ISR (void)
                         {\r
                             if (irmp_pause_time >= RCCAR_1_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_1_PAUSE_LEN_MAX)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("   1 (RCCAR)\n");\r
+#endif // ANALYZE\r
                                 irmp_store_bit2 (1);\r
                             }\r
                             else if (irmp_pause_time >= RCCAR_0_PAUSE_LEN_MIN && irmp_pause_time <= RCCAR_0_PAUSE_LEN_MAX)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("   0 (RCCAR)\n");\r
+#endif // ANALYZE\r
                                 irmp_store_bit2 (0);\r
                             }\r
 \r
                             if (! irmp_param.protocol)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PRINTF ("Switching to RCCAR protocol\n");\r
+#endif // ANALYZE\r
                                 memcpy (&irmp_param, &irmp_param2, sizeof (IRMP_PARAMETER));\r
                                 irmp_param2.protocol = 0;\r
                                 irmp_tmp_address = irmp_tmp_address2;\r
@@ -2908,7 +3675,9 @@ irmp_ISR (void)
                     {\r
                         while (irmp_bit < irmp_param.complete_len && irmp_pulse_time > irmp_param.pulse_1_len_max)\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PUTCHAR ('1');\r
+#endif // ANALYZE\r
                             irmp_store_bit (1);\r
 \r
                             if (irmp_pulse_time >= irmp_param.pulse_1_len_min)\r
@@ -2923,7 +3692,9 @@ irmp_ISR (void)
 \r
                         while (irmp_bit < irmp_param.complete_len && irmp_pause_time > irmp_param.pause_1_len_max)\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PUTCHAR ('0');\r
+#endif // ANALYZE\r
                             irmp_store_bit (0);\r
 \r
                             if (irmp_pause_time >= irmp_param.pause_1_len_min)\r
@@ -2935,7 +3706,9 @@ irmp_ISR (void)
                                 irmp_pause_time = 0;\r
                             }\r
                         }\r
+#ifdef ANALYZE\r
                         ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                         wait_for_space = 0;\r
                     }\r
                     else\r
@@ -2947,39 +3720,56 @@ irmp_ISR (void)
                         if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX &&\r
                             irmp_pause_time >= SAMSUNG_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_START_BIT_PAUSE_LEN_MAX)\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("SYNC\n");\r
+#endif // ANALYZE\r
                             wait_for_space = 0;\r
-                            irmp_tmp_id = 0;\r
                             irmp_bit++;\r
                         }\r
                         else  if (irmp_pulse_time >= SAMSUNG_PULSE_LEN_MIN && irmp_pulse_time <= SAMSUNG_PULSE_LEN_MAX)\r
                         {\r
+#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1\r
+#ifdef ANALYZE\r
+                            ANALYZE_PRINTF ("Switching to SAMSUNG48 protocol ");\r
+#endif // ANALYZE\r
+                            irmp_param.protocol         = IRMP_SAMSUNG48_PROTOCOL;\r
+                            irmp_param.command_offset   = SAMSUNG48_COMMAND_OFFSET;\r
+                            irmp_param.command_end      = SAMSUNG48_COMMAND_OFFSET + SAMSUNG48_COMMAND_LEN;\r
+                            irmp_param.complete_len     = SAMSUNG48_COMPLETE_DATA_LEN;\r
+#else\r
+#ifdef ANALYZE\r
+                            ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol ");\r
+#endif // ANALYZE\r
                             irmp_param.protocol         = IRMP_SAMSUNG32_PROTOCOL;\r
                             irmp_param.command_offset   = SAMSUNG32_COMMAND_OFFSET;\r
                             irmp_param.command_end      = SAMSUNG32_COMMAND_OFFSET + SAMSUNG32_COMMAND_LEN;\r
                             irmp_param.complete_len     = SAMSUNG32_COMPLETE_DATA_LEN;\r
-\r
+#endif\r
                             if (irmp_pause_time >= SAMSUNG_1_PAUSE_LEN_MIN && irmp_pause_time <= SAMSUNG_1_PAUSE_LEN_MAX)\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PUTCHAR ('1');\r
                                 ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                                 irmp_store_bit (1);\r
                                 wait_for_space = 0;\r
                             }\r
                             else\r
                             {\r
+#ifdef ANALYZE\r
                                 ANALYZE_PUTCHAR ('0');\r
                                 ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                                 irmp_store_bit (0);\r
                                 wait_for_space = 0;\r
                             }\r
-\r
-                            ANALYZE_PRINTF ("Switching to SAMSUNG32 protocol\n");\r
                         }\r
                         else\r
                         {                                                           // timing incorrect!\r
+#ifdef ANALYZE\r
                             ANALYZE_PRINTF ("error 3 Samsung: timing not correct: data bit %d,  pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
                             ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                             irmp_start_bit_detected = 0;                            // reset flags and wait for next start bit\r
                             irmp_pause_time         = 0;\r
                         }\r
@@ -2995,9 +3785,10 @@ irmp_ISR (void)
 #endif // IRMP_SUPPORT_NEC42_PROTOCOL == 1\r
                         irmp_bit == 8 && irmp_pause_time >= NEC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= NEC_START_BIT_PAUSE_LEN_MAX)\r
                     {\r
-printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("Switching to NEC16 protocol\n");\r
-                        irmp_param.protocol = IRMP_NEC16_PROTOCOL;\r
+#endif // ANALYZE\r
+                        irmp_param.protocol         = IRMP_NEC16_PROTOCOL;\r
                         irmp_param.address_offset   = NEC16_ADDRESS_OFFSET;\r
                         irmp_param.address_end      = NEC16_ADDRESS_OFFSET + NEC16_ADDRESS_LEN;\r
                         irmp_param.command_offset   = NEC16_COMMAND_OFFSET;\r
@@ -3017,14 +3808,18 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                             {\r
                                 if (irmp_pause_time >= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_START_BIT3_PAUSE_LEN_MAX)\r
                                 {\r
+#ifdef ANALYZE\r
                                     ANALYZE_PRINTF ("3rd start bit\n");\r
+#endif // ANALYZE\r
                                     wait_for_space = 0;\r
                                     irmp_bit++;\r
                                 }\r
                                 else\r
                                 {                                                   // timing incorrect!\r
+#ifdef ANALYZE\r
                                     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);\r
                                     ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                                     irmp_start_bit_detected = 0;                    // reset flags and wait for next start bit\r
                                     irmp_pause_time         = 0;\r
                                 }\r
@@ -3033,14 +3828,18 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                             {\r
                                 if (irmp_pause_time >= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_TRAILER_BIT_PAUSE_LEN_MAX)\r
                                 {\r
+#ifdef ANALYZE\r
                                     ANALYZE_PRINTF ("trailer bit\n");\r
+#endif // ANALYZE\r
                                     wait_for_space = 0;\r
                                     irmp_bit++;\r
                                 }\r
                                 else\r
                                 {                                                   // timing incorrect!\r
+#ifdef ANALYZE\r
                                     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);\r
                                     ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                                     irmp_start_bit_detected = 0;                    // reset flags and wait for next start bit\r
                                     irmp_pause_time         = 0;\r
                                 }\r
@@ -3049,31 +3848,39 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                             {\r
                                 if (irmp_pause_time >= BANG_OLUFSEN_1_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_1_PAUSE_LEN_MAX)\r
                                 {                                                   // pulse & pause timings correct for "1"?\r
+#ifdef ANALYZE\r
                                     ANALYZE_PUTCHAR ('1');\r
                                     ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                                     irmp_store_bit (1);\r
                                     last_value = 1;\r
                                     wait_for_space = 0;\r
                                 }\r
                                 else if (irmp_pause_time >= BANG_OLUFSEN_0_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_0_PAUSE_LEN_MAX)\r
                                 {                                                   // pulse & pause timings correct for "0"?\r
+#ifdef ANALYZE\r
                                     ANALYZE_PUTCHAR ('0');\r
                                     ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                                     irmp_store_bit (0);\r
                                     last_value = 0;\r
                                     wait_for_space = 0;\r
                                 }\r
                                 else if (irmp_pause_time >= BANG_OLUFSEN_R_PAUSE_LEN_MIN && irmp_pause_time <= BANG_OLUFSEN_R_PAUSE_LEN_MAX)\r
                                 {\r
+#ifdef ANALYZE\r
                                     ANALYZE_PUTCHAR (last_value + '0');\r
                                     ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                                     irmp_store_bit (last_value);\r
                                     wait_for_space = 0;\r
                                 }\r
                                 else\r
                                 {                                                   // timing incorrect!\r
+#ifdef ANALYZE\r
                                     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);\r
                                     ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                                     irmp_start_bit_detected = 0;                    // reset flags and wait for next start bit\r
                                     irmp_pause_time         = 0;\r
                                 }\r
@@ -3081,8 +3888,10 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                         }\r
                         else\r
                         {                                                           // timing incorrect!\r
+#ifdef ANALYZE\r
                             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);\r
                             ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                             irmp_start_bit_detected = 0;                            // reset flags and wait for next start bit\r
                             irmp_pause_time         = 0;\r
                         }\r
@@ -3090,19 +3899,70 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                     else\r
 #endif // IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL\r
 \r
+#if IRMP_SUPPORT_RCMM_PROTOCOL == 1\r
+                    if (irmp_param.protocol == IRMP_RCMM32_PROTOCOL)\r
+                    {\r
+                        if (irmp_pause_time >= RCMM32_BIT_00_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_00_PAUSE_LEN_MAX)\r
+                        {\r
+#ifdef ANALYZE\r
+                            ANALYZE_PUTCHAR ('0');\r
+                            ANALYZE_PUTCHAR ('0');\r
+#endif // ANALYZE\r
+                            irmp_store_bit (0);\r
+                            irmp_store_bit (0);\r
+                        }\r
+                        else if (irmp_pause_time >= RCMM32_BIT_01_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_01_PAUSE_LEN_MAX)\r
+                        {\r
+#ifdef ANALYZE\r
+                            ANALYZE_PUTCHAR ('0');\r
+                            ANALYZE_PUTCHAR ('1');\r
+#endif // ANALYZE\r
+                            irmp_store_bit (0);\r
+                            irmp_store_bit (1);\r
+                        }\r
+                        else if (irmp_pause_time >= RCMM32_BIT_10_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_10_PAUSE_LEN_MAX)\r
+                        {\r
+#ifdef ANALYZE\r
+                            ANALYZE_PUTCHAR ('1');\r
+                            ANALYZE_PUTCHAR ('0');\r
+#endif // ANALYZE\r
+                            irmp_store_bit (1);\r
+                            irmp_store_bit (0);\r
+                        }\r
+                        else if (irmp_pause_time >= RCMM32_BIT_11_PAUSE_LEN_MIN && irmp_pause_time <= RCMM32_BIT_11_PAUSE_LEN_MAX)\r
+                        {\r
+#ifdef ANALYZE\r
+                            ANALYZE_PUTCHAR ('1');\r
+                            ANALYZE_PUTCHAR ('1');\r
+#endif // ANALYZE\r
+                            irmp_store_bit (1);\r
+                            irmp_store_bit (1);\r
+                        }\r
+#ifdef ANALYZE\r
+                        ANALYZE_PRINTF ("\n");\r
+#endif // ANALYZE\r
+                        wait_for_space = 0;\r
+                    }\r
+                    else\r
+#endif\r
\r
                     if (irmp_pulse_time >= irmp_param.pulse_1_len_min && irmp_pulse_time <= irmp_param.pulse_1_len_max &&\r
                         irmp_pause_time >= irmp_param.pause_1_len_min && irmp_pause_time <= irmp_param.pause_1_len_max)\r
                     {                                                               // pulse & pause timings correct for "1"?\r
+#ifdef ANALYZE\r
                         ANALYZE_PUTCHAR ('1');\r
                         ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                         irmp_store_bit (1);\r
                         wait_for_space = 0;\r
                     }\r
                     else if (irmp_pulse_time >= irmp_param.pulse_0_len_min && irmp_pulse_time <= irmp_param.pulse_0_len_max &&\r
                              irmp_pause_time >= irmp_param.pause_0_len_min && irmp_pause_time <= irmp_param.pause_0_len_max)\r
                     {                                                               // pulse & pause timings correct for "0"?\r
+#ifdef ANALYZE\r
                         ANALYZE_PUTCHAR ('0');\r
                         ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                         irmp_store_bit (0);\r
                         wait_for_space = 0;\r
                     }\r
@@ -3120,14 +3980,18 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                         if (irmp_bit == 8)\r
                         {\r
                             irmp_bit++;\r
+#ifdef ANALYZE\r
                             ANALYZE_PUTCHAR ('S');\r
                             ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                             irmp_tmp_command <<= 1;\r
                         }\r
                         else\r
                         {\r
+#ifdef ANALYZE\r
                             ANALYZE_PUTCHAR ('S');\r
                             ANALYZE_NEWLINE ();\r
+#endif // ANALYZE\r
                             irmp_store_bit (1);\r
                         }\r
                         wait_for_space = 0;\r
@@ -3135,8 +3999,10 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                     else\r
 #endif // IRMP_SUPPORT_KATHREIN_PROTOCOL\r
                     {                                                               // timing incorrect!\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("error 3: timing not correct: data bit %d,  pulse: %d, pause: %d\n", irmp_bit, irmp_pulse_time, irmp_pause_time);\r
                         ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                         irmp_start_bit_detected = 0;                                // reset flags and wait for next start bit\r
                         irmp_pause_time         = 0;\r
                     }\r
@@ -3159,7 +4025,7 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
 \r
             if (irmp_start_bit_detected && irmp_bit == irmp_param.complete_len && irmp_param.stop_bit == 0)    // enough bits received?\r
             {\r
-                if (last_irmp_command == irmp_tmp_command && repetition_len < AUTO_FRAME_REPETITION_LEN)\r
+                if (last_irmp_command == irmp_tmp_command && key_repetition_len < AUTO_FRAME_REPETITION_LEN)\r
                 {\r
                     repetition_frame_number++;\r
                 }\r
@@ -3172,9 +4038,24 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                 // if SIRCS protocol and the code will be repeated within 50 ms, we will ignore 2nd and 3rd repetition frame\r
                 if (irmp_param.protocol == IRMP_SIRCS_PROTOCOL && (repetition_frame_number == 1 || repetition_frame_number == 2))\r
                 {\r
+#ifdef ANALYZE\r
                     ANALYZE_PRINTF ("code skipped: SIRCS auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
-                                    repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
-                    repetition_len = 0;\r
+                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+#endif // ANALYZE\r
+                    key_repetition_len = 0;\r
+                }\r
+                else\r
+#endif\r
+\r
+#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+                // if ORTEK protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame\r
+                if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL && repetition_frame_number == 1)\r
+                {\r
+#ifdef ANALYZE\r
+                    ANALYZE_PRINTF ("code skipped: ORTEK auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
+                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+#endif // ANALYZE\r
+                    key_repetition_len = 0;\r
                 }\r
                 else\r
 #endif\r
@@ -3183,20 +4064,24 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                 // if KASEIKYO protocol and the code will be repeated within 50 ms, we will ignore 2nd repetition frame\r
                 if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL && repetition_frame_number == 1)\r
                 {\r
+#ifdef ANALYZE\r
                     ANALYZE_PRINTF ("code skipped: KASEIKYO auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
-                                    repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
-                    repetition_len = 0;\r
+                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+#endif // ANALYZE\r
+                    key_repetition_len = 0;\r
                 }\r
                 else\r
 #endif\r
 \r
 #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1\r
-                // if SAMSUNG32 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r
-                if (irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL && (repetition_frame_number & 0x01))\r
+                // if SAMSUNG32 or SAMSUNG48 protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r
+                if ((irmp_param.protocol == IRMP_SAMSUNG32_PROTOCOL || irmp_param.protocol == IRMP_SAMSUNG48_PROTOCOL) && (repetition_frame_number & 0x01))\r
                 {\r
-                    ANALYZE_PRINTF ("code skipped: SAMSUNG32 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
-                                    repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
-                    repetition_len = 0;\r
+#ifdef ANALYZE\r
+                    ANALYZE_PRINTF ("code skipped: SAMSUNG32/SAMSUNG48 auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
+                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+#endif // ANALYZE\r
+                    key_repetition_len = 0;\r
                 }\r
                 else\r
 #endif\r
@@ -3205,15 +4090,32 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                 // if NUBERT protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r
                 if (irmp_param.protocol == IRMP_NUBERT_PROTOCOL && (repetition_frame_number & 0x01))\r
                 {\r
+#ifdef ANALYZE\r
                     ANALYZE_PRINTF ("code skipped: NUBERT auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
-                                    repetition_frame_number + 1, repetition_len, AUTO_FRAME_REPETITION_LEN);\r
-                    repetition_len = 0;\r
+                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+#endif // ANALYZE\r
+                    key_repetition_len = 0;\r
+                }\r
+                else\r
+#endif\r
+\r
+#if IRMP_SUPPORT_SPEAKER_PROTOCOL == 1\r
+                // if SPEAKER protocol and the code will be repeated within 50 ms, we will ignore every 2nd frame\r
+                if (irmp_param.protocol == IRMP_SPEAKER_PROTOCOL && (repetition_frame_number & 0x01))\r
+                {\r
+#ifdef ANALYZE\r
+                    ANALYZE_PRINTF ("code skipped: SPEAKER auto repetition frame #%d, counter = %d, auto repetition len = %d\n",\r
+                                    repetition_frame_number + 1, key_repetition_len, AUTO_FRAME_REPETITION_LEN);\r
+#endif // ANALYZE\r
+                    key_repetition_len = 0;\r
                 }\r
                 else\r
 #endif\r
 \r
                 {\r
-                    ANALYZE_PRINTF ("%8d code detected, length = %d\n", time_counter, irmp_bit);\r
+#ifdef ANALYZE\r
+                    ANALYZE_PRINTF ("%8.3fms code detected, length = %d\n", (double) (time_counter * 1000) / F_INTERRUPTS, irmp_bit);\r
+#endif // ANALYZE\r
                     irmp_ir_detected = TRUE;\r
 \r
 #if IRMP_SUPPORT_DENON_PROTOCOL == 1\r
@@ -3222,16 +4124,31 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                         if ((~irmp_tmp_command & 0x3FF) == last_irmp_denon_command) // command bits must be inverted\r
                         {\r
                             irmp_tmp_command = last_irmp_denon_command;             // use command received before!\r
+                            last_irmp_denon_command = 0;\r
 \r
                             irmp_protocol = irmp_param.protocol;                    // store protocol\r
                             irmp_address = irmp_tmp_address;                        // store address\r
-                            irmp_command = irmp_tmp_command ;                       // store command\r
+                            irmp_command = irmp_tmp_command                       // store command\r
                         }\r
                         else\r
                         {\r
-                            ANALYZE_PRINTF ("waiting for inverted command repetition\n");\r
-                            irmp_ir_detected = FALSE;\r
-                            last_irmp_denon_command = irmp_tmp_command;\r
+                            if ((irmp_tmp_command & 0x01) == 0x00)\r
+                            {\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("%8.3fms info Denon: waiting for inverted command repetition\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r
+#endif // ANALYZE\r
+                                last_irmp_denon_command = irmp_tmp_command;\r
+                                denon_repetition_len = 0;\r
+                                irmp_ir_detected = FALSE;\r
+                            }\r
+                            else\r
+                            {\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("%8.3fms warning Denon: got unexpected inverted command, ignoring it\n", (double) (time_counter * 1000) / F_INTERRUPTS);\r
+#endif // ANALYZE\r
+                                last_irmp_denon_command = 0;\r
+                                irmp_ir_detected = FALSE;\r
+                            }\r
                         }\r
                     }\r
                     else\r
@@ -3240,7 +4157,9 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
 #if IRMP_SUPPORT_GRUNDIG_PROTOCOL == 1\r
                     if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && irmp_tmp_command == 0x01ff)\r
                     {                                                               // Grundig start frame?\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("Detected GRUNDIG start frame, ignoring it\n");\r
+#endif // ANALYZE\r
                         irmp_ir_detected = FALSE;\r
                     }\r
                     else\r
@@ -3249,7 +4168,9 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
 #if IRMP_SUPPORT_NOKIA_PROTOCOL == 1\r
                     if (irmp_param.protocol == IRMP_NOKIA_PROTOCOL && irmp_tmp_address == 0x00ff && irmp_tmp_command == 0x00fe)\r
                     {                                                               // Nokia start frame?\r
+#ifdef ANALYZE\r
                         ANALYZE_PRINTF ("Detected NOKIA start frame, ignoring it\n");\r
+#endif // ANALYZE\r
                         irmp_ir_detected = FALSE;\r
                     }\r
                     else\r
@@ -3258,18 +4179,23 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
                         if (irmp_param.protocol == IRMP_NEC_PROTOCOL && irmp_bit == 0)  // repetition frame\r
                         {\r
-                            if (repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)\r
+                            if (key_repetition_len < NEC_FRAME_REPEAT_PAUSE_LEN_MAX)\r
                             {\r
-                                ANALYZE_PRINTF ("Detected NEC repetition frame, repetition_len = %d\n", repetition_len);\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("Detected NEC repetition frame, key_repetition_len = %d\n", key_repetition_len);\r
+                                ANALYZE_ONLY_NORMAL_PRINTF("REPETETION FRAME                ");\r
+#endif // ANALYZE\r
                                 irmp_tmp_address = last_irmp_address;                   // address is last address\r
                                 irmp_tmp_command = last_irmp_command;                   // command is last command\r
                                 irmp_flags |= IRMP_FLAG_REPETITION;\r
-                                repetition_len = 0;\r
+                                key_repetition_len = 0;\r
                             }\r
                             else\r
                             {\r
-                                ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, repetition_len = %d > %d\n",\r
-                                                repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("Detected NEC repetition frame, ignoring it: timeout occured, key_repetition_len = %d > %d\n",\r
+                                                key_repetition_len, NEC_FRAME_REPEAT_PAUSE_LEN_MAX);\r
+#endif // ANALYZE\r
                                 irmp_ir_detected = FALSE;\r
                             }\r
                         }\r
@@ -3278,28 +4204,54 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
 #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
                         if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL)\r
                         {\r
-                            uint8_t xor;\r
-                            // ANALYZE_PRINTF ("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",\r
-                            //                 xor_check[0], xor_check[1], xor_check[2], xor_check[3], xor_check[4], xor_check[5]);\r
+                            uint8_t xor_value;\r
 \r
-                            xor = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);\r
+                            xor_value = (xor_check[0] & 0x0F) ^ ((xor_check[0] & 0xF0) >> 4) ^ (xor_check[1] & 0x0F) ^ ((xor_check[1] & 0xF0) >> 4);\r
 \r
-                            if (xor != (xor_check[2] & 0x0F))\r
+                            if (xor_value != (xor_check[2] & 0x0F))\r
                             {\r
-                                ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor, xor_check[2] & 0x0F);\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("error 4: wrong XOR check for customer id: 0x%1x 0x%1x\n", xor_value, xor_check[2] & 0x0F);\r
+#endif // ANALYZE\r
                                 irmp_ir_detected = FALSE;\r
                             }\r
 \r
-                            xor = xor_check[2] ^ xor_check[3] ^ xor_check[4];\r
+                            xor_value = xor_check[2] ^ xor_check[3] ^ xor_check[4];\r
 \r
-                            if (xor != xor_check[5])\r
+                            if (xor_value != xor_check[5])\r
                             {\r
-                                ANALYZE_PRINTF ("error 4: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check[5]);\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor_value, xor_check[5]);\r
+#endif // ANALYZE\r
                                 irmp_ir_detected = FALSE;\r
                             }\r
+\r
+                            irmp_flags |= genre2;       // write the genre2 bits into MSB of the flag byte\r
                         }\r
 #endif // IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1\r
 \r
+#if IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+                        if (irmp_param.protocol == IRMP_ORTEK_PROTOCOL)\r
+                        {\r
+                            if (parity == PARITY_CHECK_FAILED)\r
+                            {\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("error 6: parity check failed\n");\r
+#endif // ANALYZE\r
+                                irmp_ir_detected = FALSE;\r
+                            }\r
+\r
+                            if ((irmp_tmp_address & 0x03) == 0x02)\r
+                            {\r
+#ifdef ANALYZE\r
+                                ANALYZE_PRINTF ("code skipped: ORTEK end of transmission frame (key release)\n");\r
+#endif // ANALYZE\r
+                                irmp_ir_detected = FALSE;\r
+                            }\r
+                            irmp_tmp_address >>= 2;\r
+                        }\r
+#endif // IRMP_SUPPORT_ORTEK_PROTOCOL == 1\r
+\r
 #if IRMP_SUPPORT_RC6_PROTOCOL == 1\r
                         if (irmp_param.protocol == IRMP_RC6_PROTOCOL && irmp_param.complete_len == RC6_COMPLETE_DATA_LEN_LONG)     // RC6 mode = 6?\r
                         {\r
@@ -3307,8 +4259,9 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                         }\r
                         else\r
 #endif // IRMP_SUPPORT_RC6_PROTOCOL == 1\r
-\r
-                        irmp_protocol = irmp_param.protocol;\r
+                        {\r
+                            irmp_protocol = irmp_param.protocol;\r
+                        }\r
 \r
 #if IRMP_SUPPORT_FDC_PROTOCOL == 1\r
                         if (irmp_param.protocol == IRMP_FDC_PROTOCOL)\r
@@ -3328,7 +4281,10 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
 \r
                         irmp_address = irmp_tmp_address;                            // store address\r
 #if IRMP_SUPPORT_NEC_PROTOCOL == 1\r
-                        last_irmp_address = irmp_tmp_address;                       // store as last address, too\r
+                        if (irmp_param.protocol == IRMP_NEC_PROTOCOL)\r
+                        {\r
+                            last_irmp_address = irmp_tmp_address;                   // store as last address, too\r
+                        }\r
 #endif\r
 \r
 #if IRMP_SUPPORT_RC5_PROTOCOL == 1\r
@@ -3347,9 +4303,9 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
 \r
                 if (irmp_ir_detected)\r
                 {\r
-                    if (last_irmp_command == irmp_command &&\r
-                        last_irmp_address == irmp_address &&\r
-                        repetition_len < IRMP_KEY_REPETITION_LEN)\r
+                    if (last_irmp_command == irmp_tmp_command &&\r
+                        last_irmp_address == irmp_tmp_address &&\r
+                        key_repetition_len < IRMP_KEY_REPETITION_LEN)\r
                     {\r
                         irmp_flags |= IRMP_FLAG_REPETITION;\r
                     }\r
@@ -3357,11 +4313,13 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
                     last_irmp_address = irmp_tmp_address;                           // store as last address, too\r
                     last_irmp_command = irmp_tmp_command;                           // store as last command, too\r
 \r
-                    repetition_len = 0;\r
+                    key_repetition_len = 0;\r
                 }\r
                 else\r
                 {\r
+#ifdef ANALYZE\r
                     ANALYZE_ONLY_NORMAL_PUTCHAR ('\n');\r
+#endif // ANALYZE\r
                 }\r
 \r
                 irmp_start_bit_detected = 0;                                        // and wait for next start bit\r
@@ -3378,6 +4336,12 @@ printf ("! %d %d !\n", irmp_pause_time, NEC_START_BIT_PAUSE_LEN_MAX);
             }\r
         }\r
     }\r
+\r
+#if defined(STELLARIS_ARM_CORTEX_M4)\r
+    // Clear the timer interrupt\r
+    TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT);\r
+#endif\r
+\r
     return (irmp_ir_detected);\r
 }\r
 \r
@@ -3473,6 +4437,11 @@ print_timings (void)
             NUBERT_0_PULSE_LEN_MIN, NUBERT_0_PULSE_LEN_MAX, NUBERT_0_PAUSE_LEN_MIN, NUBERT_0_PAUSE_LEN_MAX,\r
             NUBERT_1_PULSE_LEN_MIN, NUBERT_1_PULSE_LEN_MAX, NUBERT_1_PAUSE_LEN_MIN, NUBERT_1_PAUSE_LEN_MAX);\r
 \r
+    printf ("SPEAKER        1  %3d - %3d  %3d - %3d  %3d - %3d  %3d - %3d  %3d - %3d  %3d - %3d\n",\r
+            SPEAKER_START_BIT_PULSE_LEN_MIN, SPEAKER_START_BIT_PULSE_LEN_MAX, SPEAKER_START_BIT_PAUSE_LEN_MIN, SPEAKER_START_BIT_PAUSE_LEN_MAX,\r
+            SPEAKER_0_PULSE_LEN_MIN, SPEAKER_0_PULSE_LEN_MAX, SPEAKER_0_PAUSE_LEN_MIN, SPEAKER_0_PAUSE_LEN_MAX,\r
+            SPEAKER_1_PULSE_LEN_MIN, SPEAKER_1_PULSE_LEN_MAX, SPEAKER_1_PAUSE_LEN_MIN, SPEAKER_1_PAUSE_LEN_MAX);\r
+\r
     printf ("BANG_OLUFSEN   1  %3d - %3d  %3d - %3d\n",\r
             BANG_OLUFSEN_START_BIT1_PULSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PULSE_LEN_MAX,\r
             BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MIN, BANG_OLUFSEN_START_BIT1_PAUSE_LEN_MAX);\r
@@ -3526,6 +4495,19 @@ print_timings (void)
             LEGO_PULSE_LEN_MIN, LEGO_PULSE_LEN_MAX, LEGO_0_PAUSE_LEN_MIN, LEGO_0_PAUSE_LEN_MAX,\r
             LEGO_PULSE_LEN_MIN, LEGO_PULSE_LEN_MAX, LEGO_1_PAUSE_LEN_MIN, LEGO_1_PAUSE_LEN_MAX);\r
 \r
+    printf ("\n");\r
+    printf ("PROTOCOL       S  S-PULSE    S-PAUSE    PULSE      PAUSE-00   PAUSE-01   PAUSE-10   PAUSE-11\n");\r
+    printf ("================================================================================================\n");\r
+    printf ("RCMM           1   %3d        %3d        %3d        %3d        %3d        %3d        %3d\n",\r
+            (uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PULSE_TIME), (uint8_t)(F_INTERRUPTS * RCMM32_START_BIT_PAUSE_TIME),\r
+            (uint8_t)(F_INTERRUPTS * RCMM32_PULSE_TIME),\r
+            (uint8_t)(F_INTERRUPTS * RCMM32_00_PAUSE_TIME), (uint8_t)(F_INTERRUPTS * RCMM32_01_PAUSE_TIME),\r
+            (uint8_t)(F_INTERRUPTS * RCMM32_10_PAUSE_TIME), (uint8_t)(F_INTERRUPTS * RCMM32_11_PAUSE_TIME));\r
+    printf ("RCMM           1  %3d - %3d  %3d - %3d  %3d - %3d  %3d - %3d  %3d - %3d  %3d - %3d  %3d - %3d\n",\r
+            RCMM32_START_BIT_PULSE_LEN_MIN, RCMM32_START_BIT_PULSE_LEN_MAX, RCMM32_START_BIT_PAUSE_LEN_MIN, RCMM32_START_BIT_PAUSE_LEN_MAX,\r
+            RCMM32_BIT_PULSE_LEN_MIN, RCMM32_BIT_PULSE_LEN_MAX, RCMM32_BIT_00_PAUSE_LEN_MIN, RCMM32_BIT_00_PAUSE_LEN_MAX,\r
+            RCMM32_BIT_01_PAUSE_LEN_MIN, RCMM32_BIT_01_PAUSE_LEN_MAX, RCMM32_BIT_10_PAUSE_LEN_MIN, RCMM32_BIT_10_PAUSE_LEN_MAX,\r
+            RCMM32_BIT_11_PAUSE_LEN_MIN, RCMM32_BIT_11_PAUSE_LEN_MAX);\r
 }\r
 \r
 void\r
@@ -3553,7 +4535,7 @@ print_spectrum (char * text, int * buf, int is_pulse)
         }\r
     }\r
 \r
-    for (i = 1; i < 100; i++)\r
+    for (i = 1; i < 200; i++)\r
     {\r
         if (buf[i] > 0)\r
         {\r
@@ -3747,6 +4729,10 @@ get_fdc_key (uint16_t cmd)
 static int         analyze = FALSE;\r
 static int         list = FALSE;\r
 static IRMP_DATA   irmp_data;\r
+static int         expected_protocol;\r
+static int         expected_address;\r
+static int         expected_command;\r
+static int         do_check_expected_values;\r
 \r
 static void\r
 next_tick (void)\r
@@ -3763,15 +4749,15 @@ next_tick (void)
 \r
             if (verbose)\r
             {\r
-                printf ("%8d ", time_counter);\r
+                printf ("%8.3fms ", (double) (time_counter * 1000) / F_INTERRUPTS);\r
             }\r
 \r
             if (irmp_data.protocol == IRMP_FDC_PROTOCOL && (key = get_fdc_key (irmp_data.command)) != 0)\r
             {\r
                 if ((key >= 0x20 && key < 0x7F) || key >= 0xA0)\r
                 {\r
-                    printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = '%c'\n",\r
-                            irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags, key, key);\r
+                    printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key='%c'",\r
+                            irmp_data.protocol,  irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags, key, key);\r
                 }\r
                 else if (key == '\r' || key == '\t' || key == KEY_ESCAPE || (key >= 0x80 && key <= 0x9F))                 // function keys\r
                 {\r
@@ -3812,19 +4798,39 @@ next_tick (void)
                         default                  : p = "<UNKNWON>";     break;\r
                     }\r
 \r
-                    printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x, key = %s\n",\r
-                            irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags, key, p);\r
+                    printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x, key=%s",\r
+                            irmp_data.protocol, irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags, key, p);\r
+                }\r
+                else\r
+                {\r
+                    printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x, asc=0x%02x",\r
+                            irmp_data.protocol,  irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags, key);\r
+                }\r
+            }\r
+            else\r
+            {\r
+                printf ("p=%2d (%s), a=0x%04x, c=0x%04x, f=0x%02x",\r
+                        irmp_data.protocol, irmp_protocol_names[irmp_data.protocol], irmp_data.address, irmp_data.command, irmp_data.flags);\r
+            }\r
+\r
+            if (do_check_expected_values)\r
+            {\r
+                if (irmp_data.protocol != expected_protocol ||\r
+                    irmp_data.address  != expected_address  ||\r
+                    irmp_data.command  != expected_command)\r
+                {\r
+                    printf ("\nerror 7: expected values differ: p=%2d (%s), a=0x%04x, c=0x%04x\n",\r
+                            expected_protocol, irmp_protocol_names[expected_protocol], expected_address, expected_command);\r
                 }\r
                 else\r
                 {\r
-                    printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x, asc = 0x%02x\n",\r
-                            irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags, key);\r
+                    printf (" checked!\n");\r
                 }\r
+                do_check_expected_values = FALSE;                           // only check 1st frame in a line!\r
             }\r
             else\r
             {\r
-                printf ("p = %2d, a = 0x%04x, c = 0x%04x, f = 0x%02x\n",\r
-                        irmp_data.protocol, irmp_data.address, irmp_data.command, irmp_data.flags);\r
+                putchar ('\n');\r
             }\r
         }\r
     }\r
@@ -3870,6 +4876,10 @@ main (int argc, char ** argv)
             print_timings ();\r
             return (0);\r
         }\r
+        else if (! strcmp (argv[1], "-r"))\r
+        {\r
+            radio = TRUE;\r
+        }\r
     }\r
 \r
     for (i = 0; i < 256; i++)\r
@@ -3955,6 +4965,7 @@ main (int argc, char ** argv)
         else if (ch == '\n')\r
         {\r
             IRMP_PIN = 0xff;\r
+            time_counter = 0;\r
 \r
             if (list && pause > 0)\r
             {\r
@@ -3964,7 +4975,7 @@ main (int argc, char ** argv)
 \r
             if (! analyze)\r
             {\r
-                for (i = 0; i < (int) ((8000.0 * F_INTERRUPTS) / 10000); i++)               // newline: long pause of 800 msec\r
+                for (i = 0; i < (int) ((10000.0 * F_INTERRUPTS) / 10000); i++)               // newline: long pause of 10000 msec\r
                 {\r
                     next_tick ();\r
                 }\r
@@ -3974,6 +4985,8 @@ main (int argc, char ** argv)
         }\r
         else if (ch == '#')\r
         {\r
+            time_counter = 0;\r
+\r
             if (analyze)\r
             {\r
                 while ((ch = getchar()) != '\n' && ch != EOF)\r
@@ -3983,13 +4996,81 @@ main (int argc, char ** argv)
             }\r
             else\r
             {\r
+                char            buf[1024];\r
+                char *          p;\r
+                int             idx = -1;\r
+\r
                 puts ("-------------------------------------------------------------------");\r
                 putchar (ch);\r
 \r
+\r
                 while ((ch = getchar()) != '\n' && ch != EOF)\r
                 {\r
                     if (ch != '\r')                                                         // ignore CR in DOS/Windows files\r
                     {\r
+                        if (ch == '[' && idx == -1)\r
+                        {\r
+                            idx = 0;\r
+                        }\r
+                        else if (idx >= 0)\r
+                        {\r
+                            if (ch == ']')\r
+                            {\r
+                                do_check_expected_values = FALSE;\r
+                                buf[idx] = '\0';\r
+                                idx = -1;\r
+\r
+                                expected_protocol = atoi (buf);\r
+\r
+                                if (expected_protocol > 0)\r
+                                {\r
+                                    p = buf;\r
+                                    while (*p)\r
+                                    {\r
+                                        if (*p == 'x')\r
+                                        {\r
+                                            p++;\r
+\r
+                                            if (sscanf (p, "%x", &expected_address) == 1)\r
+                                            {\r
+                                                do_check_expected_values = TRUE;\r
+                                            }\r
+                                            break;\r
+                                        }\r
+                                        p++;\r
+                                    }\r
+\r
+                                    if (do_check_expected_values)\r
+                                    {\r
+                                        do_check_expected_values = FALSE;\r
+\r
+                                        while (*p)\r
+                                        {\r
+                                            if (*p == 'x')\r
+                                            {\r
+                                                p++;\r
+\r
+                                                if (sscanf (p, "%x", &expected_command) == 1)\r
+                                                {\r
+                                                    do_check_expected_values = TRUE;\r
+                                                }\r
+                                                break;\r
+                                            }\r
+                                            p++;\r
+                                        }\r
+\r
+                                        if (do_check_expected_values)\r
+                                        {\r
+                                            // printf ("!%2d %04x %04x!\n", expected_protocol, expected_address, expected_command);\r
+                                        }\r
+                                    }\r
+                                }\r
+                            }\r
+                            else if (idx < 1024 - 2)\r
+                            {\r
+                                buf[idx++] = ch;\r
+                            }\r
+                        }\r
                         putchar (ch);\r
                     }\r
                 }\r