mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2026-01-21 16:52:38 +00:00
Merge pull request #69 from vk2tds/master
LG A/C remote protocol decoding
This commit is contained in:
53
IRremote.cpp
53
IRremote.cpp
@@ -14,6 +14,7 @@
|
|||||||
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
|
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
|
||||||
*
|
*
|
||||||
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
|
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
|
||||||
|
* LG added by Darryl Smith (based on the JVC protocol)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
@@ -459,6 +460,12 @@ int IRrecv::decode(decode_results *results) {
|
|||||||
if (decodePanasonic(results)) {
|
if (decodePanasonic(results)) {
|
||||||
return DECODED;
|
return DECODED;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
Serial.println("Attempting LG decode");
|
||||||
|
#endif
|
||||||
|
if (decodeLG(results)) {
|
||||||
|
return DECODED;
|
||||||
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.println("Attempting JVC decode");
|
Serial.println("Attempting JVC decode");
|
||||||
#endif
|
#endif
|
||||||
@@ -876,6 +883,52 @@ long IRrecv::decodePanasonic(decode_results *results) {
|
|||||||
results->bits = PANASONIC_BITS;
|
results->bits = PANASONIC_BITS;
|
||||||
return DECODED;
|
return DECODED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long IRrecv::decodeLG(decode_results *results) {
|
||||||
|
long data = 0;
|
||||||
|
int offset = 1; // Skip first space
|
||||||
|
|
||||||
|
// Initial mark
|
||||||
|
if (!MATCH_MARK(results->rawbuf[offset], LG_HDR_MARK)) {
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
offset++;
|
||||||
|
if (irparams.rawlen < 2 * LG_BITS + 1 ) {
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
// Initial space
|
||||||
|
if (!MATCH_SPACE(results->rawbuf[offset], LG_HDR_SPACE)) {
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
offset++;
|
||||||
|
for (int i = 0; i < LG_BITS; i++) {
|
||||||
|
if (!MATCH_MARK(results->rawbuf[offset], LG_BIT_MARK)) {
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
offset++;
|
||||||
|
if (MATCH_SPACE(results->rawbuf[offset], LG_ONE_SPACE)) {
|
||||||
|
data = (data << 1) | 1;
|
||||||
|
}
|
||||||
|
else if (MATCH_SPACE(results->rawbuf[offset], LG_ZERO_SPACE)) {
|
||||||
|
data <<= 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
//Stop bit
|
||||||
|
if (!MATCH_MARK(results->rawbuf[offset], LG_BIT_MARK)){
|
||||||
|
return ERR;
|
||||||
|
}
|
||||||
|
// Success
|
||||||
|
results->bits = LG_BITS;
|
||||||
|
results->value = data;
|
||||||
|
results->decode_type = LG;
|
||||||
|
return DECODED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
long IRrecv::decodeJVC(decode_results *results) {
|
long IRrecv::decodeJVC(decode_results *results) {
|
||||||
long data = 0;
|
long data = 0;
|
||||||
int offset = 1; // Skip first space
|
int offset = 1; // Skip first space
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
|
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
|
||||||
*
|
*
|
||||||
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
|
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
|
||||||
|
* LG added by Darryl Smith (based on the JVC protocol)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef IRremote_h
|
#ifndef IRremote_h
|
||||||
@@ -46,6 +47,7 @@ public:
|
|||||||
#define SANYO 9
|
#define SANYO 9
|
||||||
#define MITSUBISHI 10
|
#define MITSUBISHI 10
|
||||||
#define SAMSUNG 11
|
#define SAMSUNG 11
|
||||||
|
#define LG 12
|
||||||
#define UNKNOWN -1
|
#define UNKNOWN -1
|
||||||
|
|
||||||
// Decoded value for NEC when a repeat code is received
|
// Decoded value for NEC when a repeat code is received
|
||||||
@@ -70,6 +72,7 @@ private:
|
|||||||
long decodeRC5(decode_results *results);
|
long decodeRC5(decode_results *results);
|
||||||
long decodeRC6(decode_results *results);
|
long decodeRC6(decode_results *results);
|
||||||
long decodePanasonic(decode_results *results);
|
long decodePanasonic(decode_results *results);
|
||||||
|
long decodeLG(decode_results *results);
|
||||||
long decodeJVC(decode_results *results);
|
long decodeJVC(decode_results *results);
|
||||||
long decodeSAMSUNG(decode_results *results);
|
long decodeSAMSUNG(decode_results *results);
|
||||||
long decodeHash(decode_results *results);
|
long decodeHash(decode_results *results);
|
||||||
|
|||||||
@@ -159,6 +159,13 @@
|
|||||||
#define JVC_ZERO_SPACE 550
|
#define JVC_ZERO_SPACE 550
|
||||||
#define JVC_RPT_LENGTH 60000
|
#define JVC_RPT_LENGTH 60000
|
||||||
|
|
||||||
|
#define LG_HDR_MARK 8000
|
||||||
|
#define LG_HDR_SPACE 4000
|
||||||
|
#define LG_BIT_MARK 600
|
||||||
|
#define LG_ONE_SPACE 1600
|
||||||
|
#define LG_ZERO_SPACE 550
|
||||||
|
#define LG_RPT_LENGTH 60000
|
||||||
|
|
||||||
#define SAMSUNG_HDR_MARK 5000
|
#define SAMSUNG_HDR_MARK 5000
|
||||||
#define SAMSUNG_HDR_SPACE 5000
|
#define SAMSUNG_HDR_SPACE 5000
|
||||||
#define SAMSUNG_BIT_MARK 560
|
#define SAMSUNG_BIT_MARK 560
|
||||||
@@ -214,6 +221,7 @@ extern volatile irparams_t irparams;
|
|||||||
#define MIN_RC6_SAMPLES 1
|
#define MIN_RC6_SAMPLES 1
|
||||||
#define PANASONIC_BITS 48
|
#define PANASONIC_BITS 48
|
||||||
#define JVC_BITS 16
|
#define JVC_BITS 16
|
||||||
|
#define LG_BITS 28
|
||||||
#define SAMSUNG_BITS 32
|
#define SAMSUNG_BITS 32
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright 2009 Ken Shirriff
|
* Copyright 2009 Ken Shirriff
|
||||||
* http://arcfn.com
|
* http://arcfn.com
|
||||||
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
|
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
|
||||||
|
* LG added by Darryl Smith (based on the JVC protocol)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <IRremote.h>
|
#include <IRremote.h>
|
||||||
@@ -48,6 +49,9 @@ void dump(decode_results *results) {
|
|||||||
Serial.print(results->panasonicAddress,HEX);
|
Serial.print(results->panasonicAddress,HEX);
|
||||||
Serial.print(" Value: ");
|
Serial.print(" Value: ");
|
||||||
}
|
}
|
||||||
|
else if (results->decode_type == LG) {
|
||||||
|
Serial.print("Decoded LG: ");
|
||||||
|
}
|
||||||
else if (results->decode_type == JVC) {
|
else if (results->decode_type == JVC) {
|
||||||
Serial.print("Decoded JVC: ");
|
Serial.print("Decoded JVC: ");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user