From f60c464437d9976037876933079a7a2e1792bfb8 Mon Sep 17 00:00:00 2001 From: ukw Date: Fri, 24 Feb 2012 11:44:08 +0000 Subject: [PATCH] Version 2.1.2: - removed GRUNDIG2 (identical with IR60) - fixed bug in IR60 decoder - fixed bug in CRC detection of Kaseikyo frames git-svn-id: svn://mikrocontroller.net/irmp@90 aeb2e35e-bfc4-4214-b83c-9e8de998ed28 --- IR-Data/test-suite.sh | 19 ++++----- README.txt | 2 +- irmp.c | 94 ++++++++----------------------------------- irmp.h | 19 +-------- irmpconfig.h | 3 +- 5 files changed, 30 insertions(+), 107 deletions(-) diff --git a/IR-Data/test-suite.sh b/IR-Data/test-suite.sh index 58a2c9a..3e68111 100644 --- a/IR-Data/test-suite.sh +++ b/IR-Data/test-suite.sh @@ -70,9 +70,9 @@ do echo "testing $j ..." if tmpsrc/irmp -v < $j | grep -q error then - tmpsrc/irmp -v < $j | grep error - echo "test failed" - exit 1 + tmpsrc/irmp -v < $j | grep error + echo "test failed" + exit 1 fi done @@ -85,15 +85,16 @@ for j in \ recs80-15kHz.txt \ samsung32-15kHz.txt \ t-home-mediareceiver-15kHz.txt \ + tp400vt-15kHz.txt \ universal-15kHz.txt \ xbox360-15kHz.txt do echo "testing $j ..." if tmpsrc/irmp-15kHz -v < $j | grep -q error then - tmpsrc/irmp-15kHz -v < $j | grep error - echo "test failed" - exit 1 + tmpsrc/irmp-15kHz -v < $j | grep error + echo "test failed" + exit 1 fi done @@ -105,9 +106,9 @@ do echo "testing $j ..." if tmpsrc/irmp-20kHz -v < $j | grep -q error then - tmpsrc/irmp-20kHz -v < $j | grep error - echo "test failed" - exit 1 + tmpsrc/irmp-20kHz -v < $j | grep error + echo "test failed" + exit 1 fi done diff --git a/README.txt b/README.txt index 28176c1..269b77c 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ IRMP - Infrared Multi Protocol Decoder -------------------------------------- -Version IRMP: 2.1.0 16.02.2012 +Version IRMP: 2.1.2 24.02.2012 Version IRSND: 2.1.0 16.02.2012 Dokumentation: diff --git a/irmp.c b/irmp.c index ea36ed0..e31da17 100644 --- a/irmp.c +++ b/irmp.c @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.c,v 1.115 2012/02/21 08:41:46 fm Exp $ + * $Id: irmp.c,v 1.116 2012/02/24 11:40:41 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -375,7 +375,6 @@ typedef unsigned int16 uint16_t; IRMP_SUPPORT_RC6_PROTOCOL == 1 || \ IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 || \ IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 || \ - IRMP_SUPPORT_GRUNDIG2_PROTOCOL == 1 || \ IRMP_SUPPORT_IR60_PROTOCOL #define IRMP_SUPPORT_MANCHESTER 1 #else @@ -586,10 +585,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) #define IR60_TIMEOUT_LEN ((uint8_t)(F_INTERRUPTS * IR60_TIMEOUT_TIME * 0.5)) -#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define GRUNDIG_NOKIA_IR60_START_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define GRUNDIG_NOKIA_IR60_BIT_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define GRUNDIG_NOKIA_IR60_BIT_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_BIT_TIME * MAX_TOLERANCE_10 + 0.5) + 1) #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) + 1) #define GRUNDIG_NOKIA_IR60_PRE_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG_NOKIA_IR60_PRE_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) @@ -602,15 +601,6 @@ typedef unsigned int16 uint16_t; #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) #define SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * SIEMENS_OR_RUWIDO_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define GRUNDIG2_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG2_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define GRUNDIG2_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG2_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define GRUNDIG2_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG2_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define GRUNDIG2_START_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG2_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define GRUNDIG2_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG2_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define GRUNDIG2_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG2_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define GRUNDIG2_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * GRUNDIG2_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define GRUNDIG2_BIT_PAUSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * GRUNDIG2_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) - #define FDC_START_BIT_PULSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) // 5%: avoid conflict with NETBOX #define FDC_START_BIT_PULSE_LEN_MAX ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PULSE_TIME * MAX_TOLERANCE_05 + 0.5)) #define FDC_START_BIT_PAUSE_LEN_MIN ((uint8_t)(F_INTERRUPTS * FDC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_05 + 0.5) - 1) @@ -1364,31 +1354,6 @@ static const PROGMEM IRMP_PARAMETER ruwido_param = #endif -#if IRMP_SUPPORT_GRUNDIG2_PROTOCOL == 1 - -static const PROGMEM IRMP_PARAMETER grundig2_param = -{ - IRMP_GRUNDIG2_PROTOCOL, // protocol: ir protocol - GRUNDIG2_BIT_PULSE_LEN_MIN, // pulse_1_len_min: here: minimum length of short pulse - GRUNDIG2_BIT_PULSE_LEN_MAX, // pulse_1_len_max: here: maximum length of short pulse - GRUNDIG2_BIT_PAUSE_LEN_MIN, // pause_1_len_min: here: minimum length of short pause - GRUNDIG2_BIT_PAUSE_LEN_MAX, // pause_1_len_max: here: maximum length of short pause - 0, // pulse_0_len_min: here: not used - 0, // pulse_0_len_max: here: not used - 0, // pause_0_len_min: here: not used - 0, // pause_0_len_max: here: not used - GRUNDIG2_ADDRESS_OFFSET, // address_offset: address offset - GRUNDIG2_ADDRESS_OFFSET + GRUNDIG2_ADDRESS_LEN, // address_end: end of address - GRUNDIG2_COMMAND_OFFSET, // command_offset: command offset - GRUNDIG2_COMMAND_OFFSET + GRUNDIG2_COMMAND_LEN, // command_end: end of command - GRUNDIG2_COMPLETE_DATA_LEN, // complete_len: complete length of frame - GRUNDIG2_STOP_BIT, // stop_bit: flag: frame has stop bit - GRUNDIG2_LSB, // lsb_first: flag: LSB first - GRUNDIG2_FLAGS // flags: some flags -}; - -#endif - #if IRMP_SUPPORT_FDC_PROTOCOL == 1 static const PROGMEM IRMP_PARAMETER fdc_param = @@ -1655,15 +1620,6 @@ irmp_get_data (IRMP_DATA * irmp_data_p) } break; #endif -#if IRMP_SUPPORT_GRUNDIG2_PROTOCOL == 1 - case IRMP_GRUNDIG2_PROTOCOL: - if (irmp_command & 0x0001) - { - irmp_command >>= 1; - rtc = TRUE; - } - break; -#endif #if IRMP_SUPPORT_KATHREIN_PROTOCOL == 1 case IRMP_KATHREIN_PROTOCOL: if (irmp_command != 0x0000) @@ -1684,6 +1640,10 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { rtc = TRUE; } + else + { + ANALYZE_PRINTF("Info IR60: got start instruction frame\n"); + } break; #endif #if IRMP_SUPPORT_RCCAR_PROTOCOL == 1 @@ -1842,21 +1802,23 @@ irmp_store_bit (uint8_t value) } #if IRMP_SUPPORT_NEC42_PROTOCOL == 1 - else if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit >= 13 && irmp_bit < 26) + if (irmp_param.protocol == IRMP_NEC42_PROTOCOL && irmp_bit >= 13 && irmp_bit < 26) { irmp_tmp_address2 |= (((uint16_t) (value)) << (irmp_bit - 13)); // CV wants cast } + else #endif #if IRMP_SUPPORT_SAMSUNG_PROTOCOL == 1 - else if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN) + if (irmp_param.protocol == IRMP_SAMSUNG_PROTOCOL && irmp_bit >= SAMSUNG_ID_OFFSET && irmp_bit < SAMSUNG_ID_OFFSET + SAMSUNG_ID_LEN) { irmp_tmp_id |= (((uint16_t) (value)) << (irmp_bit - SAMSUNG_ID_OFFSET)); // store with LSB first } + else #endif #if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 - else if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL) + if (irmp_param.protocol == IRMP_KASEIKYO_PROTOCOL) { if (irmp_bit >= 20 && irmp_bit < 24) { @@ -2381,22 +2343,6 @@ irmp_ISR (void) else #endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 -#if IRMP_SUPPORT_GRUNDIG2_PROTOCOL == 1 - if ((irmp_pulse_time >= GRUNDIG2_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= GRUNDIG2_START_BIT_PULSE_LEN_MAX) && - (irmp_pause_time >= GRUNDIG2_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= GRUNDIG2_START_BIT_PAUSE_LEN_MAX)) - { // it's GRUNDIG2 - ANALYZE_PRINTF ("protocol = GRUNDIG2, start bit timings: pulse: %3d - %3d or %3d - %3d, pause: %3d - %3d or %3d - %3d\n", - GRUNDIG2_START_BIT_PULSE_LEN_MIN, GRUNDIG2_START_BIT_PULSE_LEN_MAX, - 2 * GRUNDIG2_START_BIT_PULSE_LEN_MIN, 2 * GRUNDIG2_START_BIT_PULSE_LEN_MAX, - GRUNDIG2_START_BIT_PAUSE_LEN_MIN, GRUNDIG2_START_BIT_PAUSE_LEN_MAX, - 2 * GRUNDIG2_START_BIT_PAUSE_LEN_MIN, 2 * GRUNDIG2_START_BIT_PAUSE_LEN_MAX); - irmp_param_p = (IRMP_PARAMETER *) &grundig2_param; - last_pause = irmp_pause_time; - last_value = 1; - } - else -#endif // IRMP_SUPPORT_SIEMENS_OR_RUWIDO_PROTOCOL == 1 - #if IRMP_SUPPORT_FDC_PROTOCOL == 1 if (irmp_pulse_time >= FDC_START_BIT_PULSE_LEN_MIN && irmp_pulse_time <= FDC_START_BIT_PULSE_LEN_MAX && irmp_pause_time >= FDC_START_BIT_PAUSE_LEN_MIN && irmp_pause_time <= FDC_START_BIT_PAUSE_LEN_MAX) @@ -2676,7 +2622,7 @@ irmp_ISR (void) #if IRMP_SUPPORT_GRUNDIG_NOKIA_IR60_PROTOCOL == 1 if (irmp_param.protocol == IRMP_GRUNDIG_PROTOCOL && !irmp_param.stop_bit) { - if (irmp_pause_time > IR60_TIMEOUT_LEN && irmp_bit == 6) + if (irmp_pause_time > IR60_TIMEOUT_LEN && (irmp_bit == 5 || irmp_bit == 6)) { ANALYZE_PRINTF ("Switching to IR60 protocol\n"); got_light = TRUE; // this is a lie, but generates a stop bit ;-) @@ -3416,7 +3362,7 @@ irmp_ISR (void) if (xor != xor_check[5]) { - ANALYZE_PRINTF ("error 4: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check[5]); + ANALYZE_PRINTF ("error 5: wrong XOR check for data bits: 0x%02x 0x%02x\n", xor, xor_check[5]); irmp_ir_detected = FALSE; } @@ -3634,14 +3580,6 @@ print_timings (void) 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_BIT_PULSE_LEN_MAX, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MIN, 2 * SIEMENS_OR_RUWIDO_BIT_PAUSE_LEN_MAX); - printf ("GRUNDIG2 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", - GRUNDIG2_START_BIT_PULSE_LEN_MIN, GRUNDIG2_START_BIT_PULSE_LEN_MAX, - GRUNDIG2_START_BIT_PAUSE_LEN_MIN, GRUNDIG2_START_BIT_PAUSE_LEN_MAX, - GRUNDIG2_BIT_PULSE_LEN_MIN, GRUNDIG2_BIT_PULSE_LEN_MAX, - GRUNDIG2_BIT_PAUSE_LEN_MIN, GRUNDIG2_BIT_PAUSE_LEN_MAX, - 2 * GRUNDIG2_BIT_PULSE_LEN_MIN, 2 * GRUNDIG2_BIT_PULSE_LEN_MAX, - 2 * GRUNDIG2_BIT_PAUSE_LEN_MIN, 2 * GRUNDIG2_BIT_PAUSE_LEN_MAX); - printf ("FDC 1 %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d %3d - %3d\n", FDC_START_BIT_PULSE_LEN_MIN, FDC_START_BIT_PULSE_LEN_MAX, FDC_START_BIT_PAUSE_LEN_MIN, FDC_START_BIT_PAUSE_LEN_MAX, FDC_PULSE_LEN_MIN, FDC_PULSE_LEN_MAX, FDC_0_PAUSE_LEN_MIN, FDC_0_PAUSE_LEN_MAX, diff --git a/irmp.h b/irmp.h index 140c5a7..f7a3b25 100644 --- a/irmp.h +++ b/irmp.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de * - * $Id: irmp.h,v 1.70 2012/02/21 08:41:46 fm Exp $ + * $Id: irmp.h,v 1.71 2012/02/24 11:40:41 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -79,9 +79,8 @@ typedef uint8_t PAUSE_LEN; #define IRMP_NEC42_PROTOCOL 28 // NEC with 42 bits #define IRMP_LEGO_PROTOCOL 29 // LEGO Power Functions RC #define IRMP_THOMSON_PROTOCOL 30 // Thomson -#define IRMP_GRUNDIG2_PROTOCOL 31 // Grundig, e.g. TP400 -#define IRMP_N_PROTOCOLS 31 // number of supported protocols +#define IRMP_N_PROTOCOLS 30 // number of supported protocols // some flags of struct IRMP_PARAMETER: #define IRMP_PARAM_FLAG_IS_MANCHESTER 0x01 @@ -482,20 +481,6 @@ typedef uint8_t PAUSE_LEN; #define THOMSON_LSB 0 // MSB...LSB #define THOMSON_FLAGS 0 // flags -#define GRUNDIG2_START_BIT_PULSE_TIME 550.0e-6 // 550 usec pulse -#define GRUNDIG2_START_BIT_PAUSE_TIME 2700.0e-6 // 2700 usec pause -#define GRUNDIG2_BIT_PULSE_TIME 550.0e-6 // 550 usec short pulse -#define GRUNDIG2_BIT_PAUSE_TIME 550.0e-6 // 550 usec short pause -#define GRUNDIG2_FRAME_REPEAT_PAUSE_TIME 100.0e-3 // frame repeat after 100ms -#define GRUNDIG2_STOP_BIT 0 // has no stop bit -#define GRUNDIG2_LSB 1 // MSB...LSB -#define GRUNDIG2_FLAGS (IRMP_PARAM_FLAG_IS_MANCHESTER | IRMP_PARAM_FLAG_1ST_PULSE_IS_1) // flags -#define GRUNDIG2_ADDRESS_OFFSET 0 // skip 0 bits -#define GRUNDIG2_ADDRESS_LEN 0 // read 0 bits -#define GRUNDIG2_COMMAND_OFFSET 0 // skip 0 bits -#define GRUNDIG2_COMMAND_LEN 7 // read 6 + 1 command bits, last bit is always 1 -#define GRUNDIG2_COMPLETE_DATA_LEN 7 // complete length - #define AUTO_FRAME_REPETITION_TIME 80.0e-3 // SIRCS/SAMSUNG32/NUBERT: automatic repetition after 25-50ms // KASEIKYO: automatic repetition after 75ms diff --git a/irmpconfig.h b/irmpconfig.h index 225a0e4..2eeeab9 100644 --- a/irmpconfig.h +++ b/irmpconfig.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009-2011 Frank Meyer - frank(at)fli4l.de * - * $Id: irmpconfig.h,v 1.80 2012/02/21 08:41:46 fm Exp $ + * $Id: irmpconfig.h,v 1.81 2012/02/24 11:40:41 fm Exp $ * * ATMEGA88 @ 8 MHz * @@ -62,7 +62,6 @@ #define IRMP_SUPPORT_NOKIA_PROTOCOL 0 // Nokia >= 10000 ~300 bytes // exotic protocols, enable here! Enable Remarks F_INTERRUPTS Program Space -#define IRMP_SUPPORT_GRUNDIG2_PROTOCOL 0 // Grundig TP400 >= 10000 ~300 bytes #define IRMP_SUPPORT_KATHREIN_PROTOCOL 0 // Kathrein >= 10000 ~200 bytes #define IRMP_SUPPORT_NUBERT_PROTOCOL 0 // NUBERT >= 10000 ~50 bytes #define IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL 0 // Bang & Olufsen >= 10000 ~200 bytes -- 2.39.2