From f98b4bb5c7c14af6b06c4e3a629e1d851da5b85a Mon Sep 17 00:00:00 2001 From: Armin Date: Fri, 15 Jul 2022 13:47:33 +0200 Subject: [PATCH] Added Kaseikyo Panasonic decode. --- README.md | 3 + examples/AllProtocols/AllProtocols.ino | 97 +++++++++--------------- src/TinyIRReceiver.h | 4 +- src/TinyIRReceiver.hpp | 8 +- src/irmp.h | 7 -- src/irmp.hpp | 100 ++++++++++++++----------- src/irmpArduinoExt.hpp | 4 +- src/irmpVersion.h | 7 ++ src/irmpprotocols.h | 8 +- src/irsnd.hpp | 2 +- 10 files changed, 114 insertions(+), 126 deletions(-) diff --git a/README.md b/README.md index 8567b58..cf056be 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,9 @@ The **tone library (using timer 2) is still available**. You can use it alternat https://www.mikrocontroller.net/topic/irmp-infrared-multi-protocol-decoder?goto=6996113#6996137 # Revision History +### Version 3.6.2 +- Added Kaseikyo Panasonic decode. + ### Version 3.6.1 - Fixed NO_LED_FEEDBACK_CODE bug. diff --git a/examples/AllProtocols/AllProtocols.ino b/examples/AllProtocols/AllProtocols.ino index 908d35a..36e2e41 100644 --- a/examples/AllProtocols/AllProtocols.ino +++ b/examples/AllProtocols/AllProtocols.ino @@ -28,45 +28,6 @@ * */ -/* - * Activate the type of LCD you use - * Default is serial LCD with 2 rows of 16 characters (1602). - */ -//#define USE_PARALLEL_LCD -#if !defined(USE_PARALLEL_LCD) && !defined(USE_NO_LCD) -#define USE_SERIAL_LCD -#endif - -/* - * Define the size of your LCD - */ -#if !defined(USE_2004_LCD) -#define USE_1602_LCD -#endif -//#define USE_2004_LCD - -/* - * Imports and definitions for LCD - */ -#if defined(USE_SERIAL_LCD) -#include // Use an up to date library version which has the init method -#endif -#if defined(USE_PARALLEL_LCD) -#include -#endif - -#if defined(USE_1602_LCD) -// definitions for a 1602 LCD -#define LCD_COLUMNS 16 -#define LCD_ROWS 2 -#endif -#if defined(USE_2004_LCD) -// definitions for a 2004 LCD -#define LCD_COLUMNS 20 -#define LCD_ROWS 4 -#endif - - #include #include "PinDefinitionsAndMore.h" @@ -95,12 +56,32 @@ IRMP_DATA irmp_data; -#if defined(USE_SERIAL_LCD) && defined(USE_PARALLEL_LCD) -#error Cannot use parallel and serial LCD simultaneously +/* + * Activate the type of LCD you use + * Default is serial LCD with 2 rows of 16 characters (1602). + */ +//#define USE_NO_LCD +//#define USE_PARALLEL_LCD +#if defined(USE_PARALLEL_LCD) +#include +#elif !defined(USE_NO_LCD) +#define USE_SERIAL_LCD +#include // Use an up to date library version, which has the init method #endif -#if defined(USE_SERIAL_LCD) || defined(USE_PARALLEL_LCD) -#define USE_LCD +/* + * Define the size of your LCD + */ +//#define USE_2004_LCD +#if defined(USE_2004_LCD) +// definitions for a 2004 LCD +#define LCD_COLUMNS 20 +#define LCD_ROWS 4 +#else +#define USE_1602_LCD +// definitions for a 1602 LCD +#define LCD_COLUMNS 16 +#define LCD_ROWS 2 #endif #if defined(USE_SERIAL_LCD) @@ -110,21 +91,21 @@ LiquidCrystal_I2C myLCD(0x27, LCD_COLUMNS, LCD_ROWS); // set the LCD address to LiquidCrystal myLCD(4, 5, 6, 7, 8, 9); #endif -#if defined(__AVR__) && !(defined(__AVR_ATmega4809__) || defined(__AVR_ATtiny1616__) || defined(__AVR_ATtiny3216__) || defined(__AVR_ATtiny3217__)) +#if defined(USE_SERIAL_LCD) || defined(USE_PARALLEL_LCD) +#define USE_LCD +# if defined(__AVR__) && defined(ADCSRA) && defined(ADATE) // For cyclically display of VCC #include "ADCUtils.hpp" #define MILLIS_BETWEEN_VOLTAGE_PRINT 5000 +uint32_t volatile sMillisOfLastVoltagePrint; +# endif #endif void handleReceivedIRData(); -void irmp_result_print_LCD(); +void printIRResultOnLCD(); bool volatile sIRMPDataAvailable = false; -#if defined(__AVR__) && !(defined(__AVR_ATmega4809__) || defined(__AVR_ATtiny1616__) || defined(__AVR_ATtiny3216__) || defined(__AVR_ATtiny3217__)) -uint32_t volatile sMillisOfLastVoltagePrint; -#endif - void setup() { Serial.begin(115200); @@ -140,10 +121,10 @@ void setup() irmp_register_complete_callback_function(&handleReceivedIRData); Serial.print(F("Ready to receive IR signals of protocols: ")); - irmp_print_active_protocols (&Serial); + irmp_print_active_protocols(&Serial); Serial.println(F("at pin " STR(IRMP_INPUT_PIN))); -#if defined(__AVR__) && !(defined(__AVR_ATmega4809__) || defined(__AVR_ATtiny1616__) || defined(__AVR_ATtiny3216__) || defined(__AVR_ATtiny3217__)) +#if defined(USE_LCD) && defined(__AVR__) && defined(ADCSRA) && defined(ADATE) getVCCVoltageMillivoltSimple(); // to initialize ADC mux and reference #endif @@ -179,14 +160,14 @@ void loop() # if defined(USE_SERIAL_LCD) disableIRTimerInterrupt(); // disable timer interrupt, since it disturbs the serial output # endif - irmp_result_print_LCD(); + printIRResultOnLCD(); # if defined(USE_SERIAL_LCD) enableIRTimerInterrupt(); # endif #endif } -#if defined(__AVR__) && defined(ADATE) +#if defined(USE_LCD) && defined(__AVR__) && defined(ADCSRA) && defined(ADATE) /* * Periodically print VCC */ @@ -195,18 +176,12 @@ void loop() sMillisOfLastVoltagePrint = millis(); uint16_t tVCC = getVCCVoltageMillivoltSimple(); - Serial.print(F("VCC=")); - Serial.print(tVCC); - Serial.println(F("mV")); - -# if defined(USE_LCD) myLCD.setCursor(10, 0); myLCD.print(' '); myLCD.print(tVCC / 1000); myLCD.print('.'); myLCD.print(((tVCC + 5) / 10) % 100); myLCD.print('V'); -# endif } #endif } @@ -244,7 +219,7 @@ void handleReceivedIRData() * 3 milliseconds for repeat output * */ -void irmp_result_print_LCD() +void printIRResultOnLCD() { #if defined(USE_LCD) static uint8_t sLastProtocolIndex; @@ -252,7 +227,6 @@ void irmp_result_print_LCD() # if (LCD_ROWS >= 4) static uint8_t sLastCommandPrintPosition = 13; - const uint8_t tStartRow = 2; # else @@ -285,7 +259,6 @@ void irmp_result_print_LCD() * Show protocol name */ myLCD.setCursor(0, tStartRow); - myLCD.print(F("P=")); # if defined(__AVR__) const char *tProtocolStringPtr = (char*) pgm_read_word(&irmp_protocol_names[irmp_data.protocol]); myLCD.print((__FlashStringHelper*) (tProtocolStringPtr)); diff --git a/src/TinyIRReceiver.h b/src/TinyIRReceiver.h index 50f5679..b179a51 100644 --- a/src/TinyIRReceiver.h +++ b/src/TinyIRReceiver.h @@ -63,8 +63,8 @@ void handleReceivedTinyIRData(uint16_t aAddress, uint8_t aCommand, bool isRepeat */ #define lowerValue25Percent(aDuration) (aDuration - (aDuration / 4)) #define upperValue25Percent(aDuration) (aDuration + (aDuration / 4)) -#define lowerValue(aDuration) (aDuration - (aDuration / 2)) -#define upperValue(aDuration) (aDuration + (aDuration / 2)) +#define lowerValue50Percent(aDuration) (aDuration / 2) // (aDuration - (aDuration / 2)) +#define upperValue50Percent(aDuration) (aDuration + (aDuration / 2)) /* * The states for the state machine diff --git a/src/TinyIRReceiver.hpp b/src/TinyIRReceiver.hpp index b206e7c..d3ffa7f 100644 --- a/src/TinyIRReceiver.hpp +++ b/src/TinyIRReceiver.hpp @@ -6,7 +6,7 @@ * * No parity check is done! * On a completely received IR command, the user function handleReceivedIRData(uint16_t aAddress, uint8_t aCommand, bool isRepetition) - * is called in Interrupt context but with interrupts being enabled to enable use of delay() etc. + * is called in interrupt context but with interrupts being enabled to enable use of delay() etc. * !!!!!!!!!!!!!!!!!!!!!! * Functions called in interrupt context should be running as short as possible, * so if you require longer action, save the data (address + command) and handle them in the main loop. @@ -187,7 +187,8 @@ void IRPinChangeInterruptHandler(void) else if (tState == IR_RECEIVER_STATE_WAITING_FOR_DATA_MARK) { // Check data space length - if (tMicrosOfMarkOrSpace >= lowerValue(NEC_ZERO_SPACE) && tMicrosOfMarkOrSpace <= upperValue(NEC_ONE_SPACE)) { + if (tMicrosOfMarkOrSpace >= lowerValue50Percent(NEC_ZERO_SPACE) + && tMicrosOfMarkOrSpace <= upperValue50Percent(NEC_ONE_SPACE)) { // We have a valid bit here tState = IR_RECEIVER_STATE_WAITING_FOR_DATA_SPACE; if (tMicrosOfMarkOrSpace >= 2 * NEC_UNIT) { @@ -228,7 +229,8 @@ void IRPinChangeInterruptHandler(void) else if (tState == IR_RECEIVER_STATE_WAITING_FOR_DATA_SPACE) { // Check data mark length - if (tMicrosOfMarkOrSpace >= lowerValue(NEC_BIT_MARK) && tMicrosOfMarkOrSpace <= upperValue(NEC_BIT_MARK)) { + if (tMicrosOfMarkOrSpace >= lowerValue50Percent(NEC_BIT_MARK) + && tMicrosOfMarkOrSpace <= upperValue50Percent(NEC_BIT_MARK)) { /* * We have a valid mark here, check for transmission complete */ diff --git a/src/irmp.h b/src/irmp.h index 683e13a..8733c09 100644 --- a/src/irmp.h +++ b/src/irmp.h @@ -182,13 +182,6 @@ void irmp_register_complete_callback_function(void (*aCompleteCallbackFunction)( # define IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL 0 #endif -#if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 && IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 -# warning PANASONIC protocol conflicts wih KASEIKYO, please enable only one of both protocols -# warning PANASONIC protocol disabled -# undef IRMP_SUPPORT_PANASONIC_PROTOCOL -# define IRMP_SUPPORT_PANASONIC_PROTOCOL 0 -#endif - #if IRMP_SUPPORT_RC5_PROTOCOL == 1 && IRMP_SUPPORT_ORTEK_PROTOCOL == 1 # warning RC5 protocol conflicts wih ORTEK, please enable only one of both protocols # warning ORTEK protocol disabled diff --git a/src/irmp.hpp b/src/irmp.hpp index ee6da38..606a65c 100644 --- a/src/irmp.hpp +++ b/src/irmp.hpp @@ -198,17 +198,6 @@ #define MITSU_HEAVY_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) #define MITSU_HEAVY_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * MITSU_HEAVY_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define VINCENT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define VINCENT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define VINCENT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) -#define VINCENT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) -#define VINCENT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) -#define VINCENT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1) -#define VINCENT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define VINCENT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) -#define VINCENT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) -#define VINCENT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) - #define PANASONIC_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) #define PANASONIC_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) #define PANASONIC_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) @@ -220,6 +209,17 @@ #define PANASONIC_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) #define PANASONIC_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * PANASONIC_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define VINCENT_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PULSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define VINCENT_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PULSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define VINCENT_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) +#define VINCENT_START_BIT_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_START_BIT_PAUSE_TIME * MAX_TOLERANCE_10 + 0.5) + 1) +#define VINCENT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_PULSE_TIME * MIN_TOLERANCE_40 + 0.5) - 1) +#define VINCENT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_PULSE_TIME * MAX_TOLERANCE_40 + 0.5) + 1) +#define VINCENT_1_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_1_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define VINCENT_1_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_1_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) +#define VINCENT_0_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * VINCENT_0_PAUSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) +#define VINCENT_0_PAUSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * VINCENT_0_PAUSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) + #define RECS80_START_BIT_PULSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MIN_TOLERANCE_20 + 0.5) - 1) #define RECS80_START_BIT_PULSE_LEN_MAX ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PULSE_TIME * MAX_TOLERANCE_20 + 0.5) + 1) #define RECS80_START_BIT_PAUSE_LEN_MIN ((uint_fast8_t)(F_INTERRUPTS * RECS80_START_BIT_PAUSE_TIME * MIN_TOLERANCE_10 + 0.5) - 1) @@ -2475,10 +2475,7 @@ uint_fast8_t #endif irmp_get_data (IRMP_DATA * irmp_data_p) { - uint_fast8_t rtc = FALSE; -#if IRMP_SUPPORT_MERLIN_PROTOCOL == 1 - uint_fast8_t cmd_len = 0; -#endif + uint_fast8_t tReturnCode = FALSE; if (irmp_ir_detected) { @@ -2489,17 +2486,17 @@ irmp_get_data (IRMP_DATA * irmp_data_p) if ((irmp_command >> 8) == (~irmp_command & 0x00FF)) { irmp_command &= 0xff; - irmp_command |= irmp_id << 8; - rtc = TRUE; +// irmp_command |= irmp_id << 8; // for samsung32 irmp_id looks to be the same as irmp_command + tReturnCode = TRUE; } break; -#if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 +# if IRMP_SUPPORT_SAMSUNG48_PROTOCOL == 1 case IRMP_SAMSUNG48_PROTOCOL: irmp_command = (irmp_command & 0x00FF) | ((irmp_id & 0x00FF) << 8); - rtc = TRUE; + tReturnCode = TRUE; break; -#endif +# endif #endif #if IRMP_SUPPORT_NEC_PROTOCOL == 1 @@ -2511,7 +2508,6 @@ irmp_get_data (IRMP_DATA * irmp_data_p) irmp_address &= 0xff; } irmp_command &= 0xff; - rtc = TRUE; } else if (irmp_address == 0x87EE) { @@ -2519,25 +2515,40 @@ irmp_get_data (IRMP_DATA * irmp_data_p) irmp_protocol = IRMP_APPLE_PROTOCOL; irmp_address = (irmp_command & 0xFF00) >> 8; // address was received in command! irmp_command &= 0x00FF; - rtc = TRUE; } else { ANALYZE_PRINTF1 ("ONKYO protocol detected\n"); irmp_protocol = IRMP_ONKYO_PROTOCOL; - rtc = TRUE; } + tReturnCode = TRUE; break; -#endif - -#if IRMP_SUPPORT_NEC_PROTOCOL == 1 case IRMP_VINCENT_PROTOCOL: if ((irmp_command >> 8) == (irmp_command & 0x00FF)) { irmp_command &= 0xff; - rtc = TRUE; + tReturnCode = TRUE; + } + break; +#endif + +#if IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 + case IRMP_KASEIKYO_PROTOCOL: + /* + * Todo AJ 14.7.22 The bit before the command (not existent bit 16 of command) is skipped and I have a Panasonic remote where it is 1 for 2 buttons + * and the 4 LSB command bits are always zero for this remote + */ + if( irmp_address == 0x2002) // PANASONIC_VENDOR_ID_CODE + { + ANALYZE_PRINTF1 ("Kaseikyo_Panasonic protocol detected\n"); + irmp_protocol = IRMP_PANASONIC_PROTOCOL; + irmp_command = irmp_command >> 4; // remove the 4 zero bits + irmp_address = (irmp_command & 0xF00) >> 8; // LSB address (genre1) was received in command! + irmp_address |= irmp_flags & 0xF0; // MSB of address(genre2 bits) are located in MSB of the flag byte + irmp_command &= 0x00FF; } + tReturnCode = TRUE; break; #endif @@ -2546,7 +2557,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) if ((irmp_command >> 8) == (~irmp_command & 0x00FF)) { irmp_command &= 0xff; - rtc = TRUE; + tReturnCode = TRUE; } break; #endif @@ -2555,7 +2566,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) case IRMP_MERLIN_PROTOCOL: if (irmp_bit == 10) { - rtc = TRUE; + tReturnCode = TRUE; } else if (irmp_bit >= 19 && ((irmp_bit - 3) % 8 == 0)) { @@ -2564,8 +2575,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) irmp_command >>= 1; irmp_command |= ((irmp_address & 1) << (irmp_bit - 12)); irmp_address >>= 1; - cmd_len = (irmp_bit - 11) >> 3; - rtc = TRUE; + tReturnCode = TRUE; } } break; @@ -2577,7 +2587,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) if (((irmp_command >> 1) & 0x0001) == (~irmp_command & 0x0001)) { irmp_command >>= 1; - rtc = TRUE; + tReturnCode = TRUE; } break; #endif @@ -2585,27 +2595,27 @@ irmp_get_data (IRMP_DATA * irmp_data_p) case IRMP_KATHREIN_PROTOCOL: if (irmp_command != 0x0000) { - rtc = TRUE; + tReturnCode = TRUE; } break; #endif #if IRMP_SUPPORT_RC5_PROTOCOL == 1 case IRMP_RC5_PROTOCOL: irmp_address &= ~0x20; // clear toggle bit - rtc = TRUE; + tReturnCode = TRUE; break; #endif #if IRMP_SUPPORT_S100_PROTOCOL == 1 case IRMP_S100_PROTOCOL: irmp_address &= ~0x20; // clear toggle bit - rtc = TRUE; + tReturnCode = TRUE; break; #endif #if IRMP_SUPPORT_IR60_PROTOCOL == 1 case IRMP_IR60_PROTOCOL: if (irmp_command != 0x007d) // 0x007d (== 62<<1 + 1) is start instruction frame { - rtc = TRUE; + tReturnCode = TRUE; } else { @@ -2622,7 +2632,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) irmp_command = ((irmp_command & 0x1000) >> 2) | // V-Bit: V 0 0 0 0 0 0 0 0 0 0 ((irmp_command & 0x0003) << 8) | // C-Bits: 0 C1 C0 0 0 0 0 0 0 0 0 ((irmp_command & 0x0FF0) >> 4); // D-Bits: D7 D6 D5 D4 D3 D2 D1 D0 - rtc = TRUE; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0 + tReturnCode = TRUE; // Summe: V C1 C0 D7 D6 D5 D4 D3 D2 D1 D0 break; #endif @@ -2634,13 +2644,13 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { irmp_command >>= 5; irmp_command &= 0x7F; - rtc = TRUE; + tReturnCode = TRUE; } else if ((irmp_command & 0x1f) == 0x10) // key released: 000 01 (LSB) { irmp_command >>= 5; irmp_command |= 0x80; - rtc = TRUE; + tReturnCode = TRUE; } else { @@ -2661,7 +2671,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) if ((irmp_command & 0x000F) == crc) { irmp_command >>= 4; - rtc = TRUE; + tReturnCode = TRUE; } else { @@ -2679,7 +2689,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) { irmp_address >>= 3; irmp_command >>= 6; - rtc = TRUE; + tReturnCode = TRUE; } break; #endif @@ -2700,7 +2710,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) if (((irmp_command + (0x0055 + (channel << 4))) & 0x7F) == checksum) { // checksum correct? irmp_address = channel + 1; // set address to channel + 1 - rtc = TRUE; + tReturnCode = TRUE; } break; } @@ -2708,12 +2718,12 @@ irmp_get_data (IRMP_DATA * irmp_data_p) default: { - rtc = TRUE; + tReturnCode = TRUE; break; } } - if (rtc) + if (tReturnCode) { irmp_data_p->protocol = irmp_protocol; irmp_data_p->address = irmp_address; @@ -2732,7 +2742,7 @@ irmp_get_data (IRMP_DATA * irmp_data_p) irmp_ir_detected = FALSE; } - return rtc; + return tReturnCode; } #if IRMP_USE_CALLBACK == 1 diff --git a/src/irmpArduinoExt.hpp b/src/irmpArduinoExt.hpp index 70044a9..403ab9a 100644 --- a/src/irmpArduinoExt.hpp +++ b/src/irmpArduinoExt.hpp @@ -288,7 +288,7 @@ const uint8_t irmp_used_protocol_index[] PROGMEM = #if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1 IRMP_TECHNICS_PROTOCOL, #endif -#if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 +#if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 || IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 // Panasonic vendor ID for kaseikyo IRMP_PANASONIC_PROTOCOL, #endif #if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1 @@ -469,7 +469,7 @@ const char * const irmp_used_protocol_names[] PROGMEM = #if IRMP_SUPPORT_TECHNICS_PROTOCOL == 1 proto_technics, #endif -#if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 +#if IRMP_SUPPORT_PANASONIC_PROTOCOL == 1 || IRMP_SUPPORT_KASEIKYO_PROTOCOL == 1 // Panasonic vendor ID for kaseikyo proto_panasonic, #endif #if IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL == 1 diff --git a/src/irmpVersion.h b/src/irmpVersion.h index fe767b9..ee90ede 100644 --- a/src/irmpVersion.h +++ b/src/irmpVersion.h @@ -13,5 +13,12 @@ #define VERSION_IRMP "3.6.1" #define VERSION_IRMP_MAJOR 3 #define VERSION_IRMP_MINOR 6 +#define VERSION_IRMP_PATCH 0 +/* + * Macro to convert 3 version parts into an integer + * To be used in preprocessor comparisons, such as #if VERSION_IRMP_HEX >= VERSION_HEX_VALUE(3, 7, 0) + */ +#define VERSION_HEX_VALUE(major, minor, patch) ((major << 16) | (minor << 8) | (patch)) +#define VERSION_IRMP_HEX VERSION_HEX_VALUE(VERSION_IRMP_MAJOR, VERSION_IRMP_MINOR, VERSION_IRMP_PATCH) #endif /* SRC_LIB_IRMPVERSION_H_ */ diff --git a/src/irmpprotocols.h b/src/irmpprotocols.h index 90cc09e..76aad08 100644 --- a/src/irmpprotocols.h +++ b/src/irmpprotocols.h @@ -346,7 +346,7 @@ typedef uint8_t PAUSE_LEN; #define TECHNICS_COMPLETE_DATA_LEN 22 // complete length /*--------------------------------------------------------------------------------------------------------------------------------------------------- - * KASEIKYO: + * KASEIKYO: 48 bit *--------------------------------------------------------------------------------------------------------------------------------------------------- */ #define KASEIKYO_START_BIT_PULSE_TIME 3456.0e-6 // 3380 usec pulse @@ -357,7 +357,7 @@ typedef uint8_t PAUSE_LEN; #define KASEIKYO_AUTO_REPETITION_PAUSE_TIME 74.0e-3 // repetition after 74 ms #define KASEIKYO_FRAME_REPEAT_PAUSE_TIME 74.0e-3 // frame repeat after 74 ms #define KASEIKYO_ADDRESS_OFFSET 0 // skip 0 bits -#define KASEIKYO_ADDRESS_LEN 16 // read 16 address bits +#define KASEIKYO_ADDRESS_LEN 16 // read 16 address / manufacturer bits #define KASEIKYO_COMMAND_OFFSET 28 // skip 28 bits (16 manufacturer & 4 parity & 8 genre) #define KASEIKYO_COMMAND_LEN 12 // read 12 command bits (10 real command & 2 id) #define KASEIKYO_COMPLETE_DATA_LEN 48 // complete length @@ -367,7 +367,7 @@ typedef uint8_t PAUSE_LEN; #define KASEIKYO_FLAGS 0 // flags /*--------------------------------------------------------------------------------------------------------------------------------------------------- - * PANASONIC (Beamer), start bit timings similar to KASEIKYO + * PANASONIC (Beamer), start bit timings similar to KASEIKYO 56 bit *--------------------------------------------------------------------------------------------------------------------------------------------------- */ #define PANASONIC_START_BIT_PULSE_TIME 3600.0e-6 // 3600 usec pulse @@ -388,7 +388,7 @@ typedef uint8_t PAUSE_LEN; #define PANASONIC_FLAGS 0 // flags /*--------------------------------------------------------------------------------------------------------------------------------------------------- - * MITSUBISHI-Heavy Aircondition, timings similar to PANASONIC beamer + * MITSUBISHI-Heavy Aircondition, timings similar to PANASONIC beamer 88 bit *--------------------------------------------------------------------------------------------------------------------------------------------------- */ #define MITSU_HEAVY_START_BIT_PULSE_TIME 3200.0e-6 // 3600 usec pulse diff --git a/src/irsnd.hpp b/src/irsnd.hpp index f0fd31d..6df2eab 100644 --- a/src/irsnd.hpp +++ b/src/irsnd.hpp @@ -2235,7 +2235,7 @@ irsnd_ISR (void) pause_0_len = IRSND_KASEIKYO_0_PAUSE_LEN - 1; has_stop_bit = KASEIKYO_STOP_BIT; complete_data_len = KASEIKYO_COMPLETE_DATA_LEN; - n_auto_repetitions = (repeat_counter == 0) ? KASEIKYO_FRAMES : 1; // 2 frames auto repetition if first frame + n_auto_repetitions = KASEIKYO_FRAMES; // 1 frame auto_repetition_pause_len = IRSND_KASEIKYO_AUTO_REPETITION_PAUSE_LEN; // 75 ms pause repeat_frame_pause_len = IRSND_KASEIKYO_FRAME_REPEAT_PAUSE_LEN; irsnd_set_freq (IRSND_FREQ_38_KHZ);