mirror of
https://github.com/crankyoldgit/IRremoteESP8266.git
synced 2026-01-12 00:05:10 +08:00
Initial Nikai TV support. (#311)
* Initial support for Nikai TV devices. - See Issue #309 for more details and background. * Add reporting for Nikai to gc_decode.
This commit is contained in:
@@ -359,6 +359,11 @@ bool IRrecv::decode(decode_results *results, irparams_t *save) {
|
||||
if (decodeCOOLIX(results))
|
||||
return true;
|
||||
#endif
|
||||
#if DECODE_NIKAI
|
||||
DPRINTLN("Attempting Nikai decode");
|
||||
if (decodeNikai(results))
|
||||
return true;
|
||||
#endif
|
||||
/* NOTE: Disabled due to poor quality.
|
||||
#if DECODE_SANYO
|
||||
// The Sanyo S866500B decoder is very poor quality & depricated.
|
||||
|
||||
@@ -198,6 +198,10 @@ class IRrecv {
|
||||
bool decodeAiwaRCT501(decode_results *results,
|
||||
uint16_t nbits = AIWA_RC_T501_BITS, bool strict = true);
|
||||
#endif
|
||||
#if DECODE_NIKAI
|
||||
bool decodeNikai(decode_results *results, uint16_t nbits = NIKAI_BITS,
|
||||
bool strict = true);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // IRRECV_H_
|
||||
|
||||
@@ -132,6 +132,9 @@
|
||||
#define DECODE_TROTEC false // Not implemented.
|
||||
#define SEND_TROTEC true
|
||||
|
||||
#define DECODE_NIKAI true
|
||||
#define SEND_NIKAI true
|
||||
|
||||
/*
|
||||
* Always add to the end of the list and should never remove entries
|
||||
* or change order. Projects may save the type number for later usage
|
||||
@@ -167,7 +170,8 @@ enum decode_type_t {
|
||||
PRONTO,
|
||||
NEC_LIKE,
|
||||
ARGO,
|
||||
TROTEC
|
||||
TROTEC,
|
||||
NIKAI
|
||||
};
|
||||
|
||||
// Message lengths & required repeat values
|
||||
@@ -222,6 +226,7 @@ enum decode_type_t {
|
||||
#define TROTEC_COMMAND_LENGTH 9U
|
||||
#define WHYNTER_BITS 32U
|
||||
#define ARGO_COMMAND_LENGTH 12U
|
||||
#define NIKAI_BITS 24U
|
||||
|
||||
// Turn on Debugging information by uncommenting the following line.
|
||||
// #define DEBUG 1
|
||||
|
||||
@@ -175,12 +175,15 @@ class IRsend {
|
||||
uint16_t nbytes = ARGO_COMMAND_LENGTH,
|
||||
uint16_t repeat = 0);
|
||||
#endif
|
||||
|
||||
#if SEND_TROTEC
|
||||
void sendTrotec(unsigned char data[],
|
||||
uint16_t nbytes = TROTEC_COMMAND_LENGTH,
|
||||
uint16_t repeat = 0);
|
||||
#endif
|
||||
#if SEND_NIKAI
|
||||
void sendNikai(uint64_t data, uint16_t nbits = NIKAI_BITS,
|
||||
uint16_t repeat = 0);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef UNIT_TEST
|
||||
|
||||
120
src/ir_Nikai.cpp
Normal file
120
src/ir_Nikai.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
// Copyright 2009 Ken Shirriff
|
||||
// Copyright 2017 David Conran
|
||||
|
||||
#include <algorithm>
|
||||
#include "IRrecv.h"
|
||||
#include "IRsend.h"
|
||||
#include "IRtimer.h"
|
||||
#include "IRutils.h"
|
||||
|
||||
// NN NN IIIII KK KK AAA IIIII
|
||||
// NNN NN III KK KK AAAAA III
|
||||
// NN N NN III KKKK AA AA III
|
||||
// NN NNN III KK KK AAAAAAA III
|
||||
// NN NN IIIII KK KK AA AA IIIII
|
||||
|
||||
// Constants
|
||||
// Ref:
|
||||
// https://github.com/markszabo/IRremoteESP8266/issues/309
|
||||
#define NIKAI_TICK 500U
|
||||
#define NIKAI_HDR_MARK_TICKS 8U
|
||||
#define NIKAI_HDR_MARK (NIKAI_HDR_MARK_TICKS * NIKAI_TICK)
|
||||
#define NIKAI_HDR_SPACE_TICKS 8U
|
||||
#define NIKAI_HDR_SPACE (NIKAI_HDR_SPACE_TICKS * NIKAI_TICK)
|
||||
#define NIKAI_BIT_MARK_TICKS 1U
|
||||
#define NIKAI_BIT_MARK (NIKAI_BIT_MARK_TICKS * NIKAI_TICK)
|
||||
#define NIKAI_ONE_SPACE_TICKS 2U
|
||||
#define NIKAI_ONE_SPACE (NIKAI_ONE_SPACE_TICKS * NIKAI_TICK)
|
||||
#define NIKAI_ZERO_SPACE_TICKS 4U
|
||||
#define NIKAI_ZERO_SPACE (NIKAI_ZERO_SPACE_TICKS * NIKAI_TICK)
|
||||
#define NIKAI_MIN_GAP_TICKS 17U
|
||||
#define NIKAI_MIN_GAP (NIKAI_MIN_GAP_TICKS * NIKAI_TICK)
|
||||
|
||||
|
||||
#if SEND_NIKAI
|
||||
// Send a Nikai TV formatted message.
|
||||
//
|
||||
// Args:
|
||||
// data: The message to be sent.
|
||||
// nbits: The bit size of the message being sent. typically NIKAI_BITS.
|
||||
// repeat: The number of times the message is to be repeated.
|
||||
//
|
||||
// Status: ALPHA / Untested.
|
||||
//
|
||||
// Ref: https://github.com/markszabo/IRremoteESP8266/issues/309
|
||||
void IRsend::sendNikai(uint64_t data, uint16_t nbits, uint16_t repeat) {
|
||||
// Set 38kHz IR carrier frequency & a 1/3 (33%) duty cycle.
|
||||
enableIROut(38, 33);
|
||||
// We always send a message, even for repeat=0, hence '<= repeat'.
|
||||
for (uint16_t i=0; i <= repeat; i++) {
|
||||
// Header
|
||||
mark(NIKAI_HDR_MARK);
|
||||
space(NIKAI_HDR_SPACE);
|
||||
// Data
|
||||
sendData(NIKAI_BIT_MARK, NIKAI_ONE_SPACE, NIKAI_BIT_MARK,
|
||||
NIKAI_ZERO_SPACE, data, nbits, true);
|
||||
// Footer
|
||||
mark(NIKAI_BIT_MARK);
|
||||
space(NIKAI_MIN_GAP);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DECODE_NIKAI
|
||||
// Decode the supplied Nikai message.
|
||||
//
|
||||
// Args:
|
||||
// results: Ptr to the data to decode and where to store the decode result.
|
||||
// nbits: Nr. of bits to expect in the data portion.
|
||||
// Typically NIKAI_BITS.
|
||||
// strict: Flag to indicate if we strictly adhere to the specification.
|
||||
// Returns:
|
||||
// boolean: True if it can decode it, false if it can't.
|
||||
//
|
||||
// Status: ALPHA / Untested.
|
||||
//
|
||||
bool IRrecv::decodeNikai(decode_results *results, uint16_t nbits, bool strict) {
|
||||
if (results->rawlen < 2 * nbits + HEADER + FOOTER - 1)
|
||||
return false; // Can't possibly be a valid Nikai message.
|
||||
if (strict && nbits != NIKAI_BITS)
|
||||
return false; // We expect Nikai to be a certain sized message.
|
||||
|
||||
uint64_t data = 0;
|
||||
uint16_t offset = OFFSET_START;
|
||||
|
||||
// Header
|
||||
if (!matchMark(results->rawbuf[offset], NIKAI_HDR_MARK)) return false;
|
||||
// Calculate how long the common tick time is based on the header mark.
|
||||
uint32_t m_tick = results->rawbuf[offset++] * RAWTICK /
|
||||
NIKAI_HDR_MARK_TICKS;
|
||||
if (!matchSpace(results->rawbuf[offset], NIKAI_HDR_SPACE)) return false;
|
||||
// Calculate how long the common tick time is based on the header space.
|
||||
uint32_t s_tick = results->rawbuf[offset++] * RAWTICK /
|
||||
NIKAI_HDR_SPACE_TICKS;
|
||||
// Data
|
||||
match_result_t data_result = matchData(&(results->rawbuf[offset]), nbits,
|
||||
NIKAI_BIT_MARK_TICKS * m_tick,
|
||||
NIKAI_ONE_SPACE_TICKS * s_tick,
|
||||
NIKAI_BIT_MARK_TICKS * m_tick,
|
||||
NIKAI_ZERO_SPACE_TICKS * s_tick);
|
||||
if (data_result.success == false) return false;
|
||||
data = data_result.data;
|
||||
offset += data_result.used;
|
||||
// Footer
|
||||
if (!matchMark(results->rawbuf[offset++], NIKAI_BIT_MARK_TICKS * m_tick))
|
||||
return false;
|
||||
if (offset < results->rawlen &&
|
||||
!matchAtLeast(results->rawbuf[offset], NIKAI_MIN_GAP_TICKS * s_tick))
|
||||
return false;
|
||||
|
||||
// Compliance
|
||||
|
||||
// Success
|
||||
results->bits = nbits;
|
||||
results->value = data;
|
||||
results->decode_type = NIKAI;
|
||||
results->command = 0;
|
||||
results->address = 0;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -30,7 +30,7 @@ TESTS = IRutils_test IRsend_test ir_NEC_test ir_GlobalCache_test \
|
||||
ir_JVC_test ir_RCMM_test ir_LG_test ir_Mitsubishi_test ir_Sharp_test \
|
||||
ir_RC5_RC6_test ir_Panasonic_test ir_Dish_test ir_Whynter_test \
|
||||
ir_Aiwa_test ir_Denon_test ir_Sanyo_test ir_Daikin_test ir_Coolix_test \
|
||||
ir_Gree_test IRrecv_test ir_Pronto_test ir_Fujitsu_test
|
||||
ir_Gree_test IRrecv_test ir_Pronto_test ir_Fujitsu_test ir_Nikai_test
|
||||
|
||||
# All Google Test headers. Usually you shouldn't change this
|
||||
# definition.
|
||||
@@ -68,8 +68,8 @@ GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
|
||||
# All the IR protocol object files.
|
||||
PROTOCOLS = ir_NEC.o ir_Sony.o ir_Samsung.o ir_JVC.o ir_RCMM.o ir_RC5_RC6.o \
|
||||
ir_LG.o ir_Mitsubishi.o ir_Fujitsu.o ir_Sharp.o ir_Sanyo.o ir_Denon.o ir_Dish.o \
|
||||
ir_Panasonic.o ir_Whynter.o ir_Coolix.o ir_Aiwa.o ir_Sherwood.o \
|
||||
ir_Kelvinator.o ir_Daikin.o ir_Gree.o ir_Pronto.o
|
||||
ir_Panasonic.o ir_Whynter.o ir_Coolix.o ir_Aiwa.o ir_Sherwood.o \
|
||||
ir_Kelvinator.o ir_Daikin.o ir_Gree.o ir_Pronto.o ir_Nikai.o
|
||||
# Common object files
|
||||
COMMON_OBJ = IRutils.o IRtimer.o IRsend.o IRrecv.o ir_GlobalCache.o \
|
||||
$(PROTOCOLS) gtest_main.a
|
||||
@@ -337,3 +337,12 @@ ir_Pronto_test.o : ir_Pronto_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS)
|
||||
|
||||
ir_Pronto_test : $(COMMON_OBJ) ir_Pronto_test.o
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@
|
||||
|
||||
ir_Nikai.o : $(USER_DIR)/ir_Nikai.cpp $(GTEST_HEADERS)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Nikai.cpp
|
||||
|
||||
ir_Nikai_test.o : ir_Nikai_test.cpp $(COMMON_TEST_DEPS) $(GTEST_HEADERS)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -I$(USER_DIR) -c ir_Nikai_test.cpp
|
||||
|
||||
ir_Nikai_test : $(COMMON_OBJ) ir_Nikai_test.o
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@
|
||||
|
||||
210
test/ir_Nikai_test.cpp
Normal file
210
test/ir_Nikai_test.cpp
Normal file
@@ -0,0 +1,210 @@
|
||||
// Copyright 2017 David Conran
|
||||
|
||||
#include "IRsend.h"
|
||||
#include "IRsend_test.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
// Tests for sendNikai().
|
||||
// Test sending typical data only.
|
||||
TEST(TestSendNikai, SendDataOnly) {
|
||||
IRsendTest irsend(4);
|
||||
irsend.begin();
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendNikai(0xD5F2A); // Nikai TV Power Off.
|
||||
EXPECT_EQ("m4000s4000"
|
||||
"m500s2000m500s2000m500s2000m500s2000m500s1000m500s1000m500s2000"
|
||||
"m500s1000m500s2000m500s1000m500s2000m500s1000m500s1000m500s1000"
|
||||
"m500s1000m500s1000m500s2000m500s2000m500s1000m500s2000m500s1000"
|
||||
"m500s2000m500s1000m500s2000m500s8500",
|
||||
irsend.outputStr());
|
||||
|
||||
irsend.reset();
|
||||
}
|
||||
|
||||
// Test sending with different repeats.
|
||||
TEST(TestSendNikai, SendWithRepeats) {
|
||||
IRsendTest irsend(4);
|
||||
irsend.begin();
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendNikai(0xD5F2A, NIKAI_BITS, 1); // 1 repeat.
|
||||
EXPECT_EQ("m4000s4000"
|
||||
"m500s2000m500s2000m500s2000m500s2000m500s1000m500s1000m500s2000"
|
||||
"m500s1000m500s2000m500s1000m500s2000m500s1000m500s1000m500s1000"
|
||||
"m500s1000m500s1000m500s2000m500s2000m500s1000m500s2000m500s1000"
|
||||
"m500s2000m500s1000m500s2000m500s8500"
|
||||
"m4000s4000"
|
||||
"m500s2000m500s2000m500s2000m500s2000m500s1000m500s1000m500s2000"
|
||||
"m500s1000m500s2000m500s1000m500s2000m500s1000m500s1000m500s1000"
|
||||
"m500s1000m500s1000m500s2000m500s2000m500s1000m500s2000m500s1000"
|
||||
"m500s2000m500s1000m500s2000m500s8500",
|
||||
irsend.outputStr());
|
||||
irsend.sendNikai(0xD5F2A, NIKAI_BITS, 2); // 2 repeat.
|
||||
EXPECT_EQ("m4000s4000"
|
||||
"m500s2000m500s2000m500s2000m500s2000m500s1000m500s1000m500s2000"
|
||||
"m500s1000m500s2000m500s1000m500s2000m500s1000m500s1000m500s1000"
|
||||
"m500s1000m500s1000m500s2000m500s2000m500s1000m500s2000m500s1000"
|
||||
"m500s2000m500s1000m500s2000m500s8500"
|
||||
"m4000s4000"
|
||||
"m500s2000m500s2000m500s2000m500s2000m500s1000m500s1000m500s2000"
|
||||
"m500s1000m500s2000m500s1000m500s2000m500s1000m500s1000m500s1000"
|
||||
"m500s1000m500s1000m500s2000m500s2000m500s1000m500s2000m500s1000"
|
||||
"m500s2000m500s1000m500s2000m500s8500"
|
||||
"m4000s4000"
|
||||
"m500s2000m500s2000m500s2000m500s2000m500s1000m500s1000m500s2000"
|
||||
"m500s1000m500s2000m500s1000m500s2000m500s1000m500s1000m500s1000"
|
||||
"m500s1000m500s1000m500s2000m500s2000m500s1000m500s2000m500s1000"
|
||||
"m500s2000m500s1000m500s2000m500s8500",
|
||||
irsend.outputStr());
|
||||
}
|
||||
|
||||
// Tests for decodeNikai().
|
||||
|
||||
// Decode normal Nikai messages.
|
||||
TEST(TestDecodeNikai, NormalDecodeWithStrict) {
|
||||
IRsendTest irsend(4);
|
||||
IRrecv irrecv(4);
|
||||
irsend.begin();
|
||||
|
||||
// Normal Nikai 24-bit message.
|
||||
irsend.reset();
|
||||
irsend.sendNikai(0x123456);
|
||||
irsend.makeDecodeResult();
|
||||
ASSERT_TRUE(irrecv.decodeNikai(&irsend.capture, NIKAI_BITS, true));
|
||||
EXPECT_EQ(NIKAI, irsend.capture.decode_type);
|
||||
EXPECT_EQ(NIKAI_BITS, irsend.capture.bits);
|
||||
EXPECT_EQ(0x123456, irsend.capture.value);
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendNikai(0x101);
|
||||
irsend.makeDecodeResult();
|
||||
ASSERT_TRUE(irrecv.decodeNikai(&irsend.capture, NIKAI_BITS, true));
|
||||
EXPECT_EQ(NIKAI, irsend.capture.decode_type);
|
||||
EXPECT_EQ(NIKAI_BITS, irsend.capture.bits);
|
||||
EXPECT_EQ(0x101, irsend.capture.value);
|
||||
}
|
||||
|
||||
// Decode normal repeated Nikai messages.
|
||||
TEST(TestDecodeNikai, NormalDecodeWithRepeatAndStrict) {
|
||||
IRsendTest irsend(4);
|
||||
IRrecv irrecv(4);
|
||||
irsend.begin();
|
||||
|
||||
// Normal Nikai 24-bit message.
|
||||
irsend.reset();
|
||||
irsend.sendNikai(0xD5F2A, NIKAI_BITS, 2);
|
||||
irsend.makeDecodeResult();
|
||||
ASSERT_TRUE(irrecv.decodeNikai(&irsend.capture, NIKAI_BITS, true));
|
||||
EXPECT_EQ(NIKAI, irsend.capture.decode_type);
|
||||
EXPECT_EQ(NIKAI_BITS, irsend.capture.bits);
|
||||
EXPECT_EQ(0xD5F2A, irsend.capture.value);
|
||||
}
|
||||
|
||||
TEST(TestDecodeNikai, NormalDecodeWithNonStrict) {
|
||||
IRsendTest irsend(4);
|
||||
IRrecv irrecv(4);
|
||||
irsend.begin();
|
||||
|
||||
// Illegal under length (16-bit) message
|
||||
irsend.reset();
|
||||
irsend.sendNikai(0x0, 16);
|
||||
irsend.makeDecodeResult();
|
||||
// Should fail with strict on.
|
||||
ASSERT_FALSE(irrecv.decodeNikai(&irsend.capture, NIKAI_BITS, true));
|
||||
// And it should fail when we expect more bits.
|
||||
ASSERT_FALSE(irrecv.decodeNikai(&irsend.capture, NIKAI_BITS, false));
|
||||
|
||||
// Should pass if strict off if we ask for correct nr. of bits sent.
|
||||
ASSERT_TRUE(irrecv.decodeNikai(&irsend.capture, 16, false));
|
||||
EXPECT_EQ(NIKAI, irsend.capture.decode_type);
|
||||
EXPECT_EQ(16, irsend.capture.bits);
|
||||
EXPECT_EQ(0x0, irsend.capture.value);
|
||||
|
||||
// Should fail as we are expecting less bits than there are.
|
||||
ASSERT_FALSE(irrecv.decodeNikai(&irsend.capture, 12, false));
|
||||
}
|
||||
|
||||
// Decode (non-standard) 64-bit messages.
|
||||
// Decode unsupported Nikai messages.
|
||||
TEST(TestDecodeNikai, Decode64BitMessages) {
|
||||
IRsendTest irsend(4);
|
||||
IRrecv irrecv(4);
|
||||
irsend.begin();
|
||||
|
||||
irsend.reset();
|
||||
// Illegal size Nikai 64-bit message.
|
||||
irsend.sendNikai(0xFFFFFFFFFFFFFFFF, 64);
|
||||
irsend.makeDecodeResult();
|
||||
ASSERT_FALSE(irrecv.decodeNikai(&irsend.capture, NIKAI_BITS, true));
|
||||
// Should work with a 'normal' match (not strict)
|
||||
ASSERT_TRUE(irrecv.decodeNikai(&irsend.capture, 64, false));
|
||||
EXPECT_EQ(NIKAI, irsend.capture.decode_type);
|
||||
EXPECT_EQ(64, irsend.capture.bits);
|
||||
EXPECT_EQ(0xFFFFFFFFFFFFFFFF, irsend.capture.value);
|
||||
}
|
||||
|
||||
// Decode real example via Issue #309
|
||||
TEST(TestDecodeNikai, DecodeExamples) {
|
||||
IRsendTest irsend(4);
|
||||
IRrecv irrecv(4);
|
||||
irsend.begin();
|
||||
|
||||
irsend.reset();
|
||||
// Nikai TV Power Off from Issue #309
|
||||
uint16_t rawdata_off[100] = {4060, 3918,
|
||||
508, 2004, 508, 2002, 510, 2002, 508, 2004, 506, 1050, 508, 1048,
|
||||
510, 2004, 508, 1048, 508, 2002, 510, 1050, 508, 2004, 510, 1048,
|
||||
508, 1050, 508, 1048, 508, 1050, 508, 1050, 508, 2004, 508, 2002,
|
||||
510, 1048, 508, 2004, 508, 1050, 506, 2004, 508, 1048, 510, 2002,
|
||||
456, 8446,
|
||||
3956, 3998,
|
||||
508, 2004, 508, 2002, 508, 2004, 508, 1978, 532, 1050, 508, 1050,
|
||||
508, 2002, 508, 1050, 508, 2004, 508, 1050, 508, 2002, 510, 1050,
|
||||
508, 1050, 508, 1048, 508, 1050, 508, 1050, 508, 2002, 510, 2002,
|
||||
508, 1050, 508, 2002, 510, 1050, 508, 2002, 508};
|
||||
irsend.sendRaw(rawdata_off, 100, 38);
|
||||
irsend.makeDecodeResult();
|
||||
|
||||
ASSERT_TRUE(irrecv.decode(&irsend.capture));
|
||||
EXPECT_EQ(NIKAI, irsend.capture.decode_type);
|
||||
EXPECT_EQ(NIKAI_BITS, irsend.capture.bits);
|
||||
EXPECT_EQ(0xD5F2A, irsend.capture.value);
|
||||
|
||||
// Nikai TV Volume Up from Issue #309
|
||||
uint16_t rawdata_volup[52] = {3972, 4002,
|
||||
504, 1982, 526, 2010, 502, 2010, 502, 2010, 500, 1056, 502, 1056,
|
||||
502, 2010, 500, 1056, 502, 2010, 502, 2010, 500, 2010, 502, 2010,
|
||||
502, 1056, 502, 1056, 502, 1056, 500, 1056, 502, 2010, 502, 2010,
|
||||
500, 1056, 502, 2008, 502, 1054, 504, 1054, 504, 1054, 500, 1056,
|
||||
450};
|
||||
|
||||
irsend.reset();
|
||||
irsend.sendRaw(rawdata_volup, 52, 38);
|
||||
irsend.makeDecodeResult();
|
||||
|
||||
ASSERT_TRUE(irrecv.decode(&irsend.capture));
|
||||
EXPECT_EQ(NIKAI, irsend.capture.decode_type);
|
||||
EXPECT_EQ(NIKAI_BITS, irsend.capture.bits);
|
||||
EXPECT_EQ(0xD0F2F, irsend.capture.value);
|
||||
}
|
||||
|
||||
// Fail to decode a non-Nikai example via GlobalCache
|
||||
TEST(TestDecodeNikai, FailToDecodeNonNikaiExample) {
|
||||
IRsendTest irsend(4);
|
||||
IRrecv irrecv(4);
|
||||
irsend.begin();
|
||||
|
||||
irsend.reset();
|
||||
uint16_t gc_test[71] = {38000, 1, 1, 172, 172, 22, 64, 22, 64, 22, 64, 22, 21,
|
||||
22, 21, 22, 21, 22, 11, 22, 21, 22, 128, 22, 64, 22,
|
||||
64, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 22, 64,
|
||||
22, 21, 22, 21, 22, 64, 22, 64, 22, 21, 22, 21, 22,
|
||||
64, 22, 21, 22, 64, 22, 64, 22, 21, 22, 21, 22, 64,
|
||||
22, 64, 22, 21, 22, 1820};
|
||||
irsend.sendGC(gc_test, 71);
|
||||
irsend.makeDecodeResult();
|
||||
|
||||
ASSERT_FALSE(irrecv.decodeNikai(&irsend.capture));
|
||||
ASSERT_FALSE(irrecv.decodeNikai(&irsend.capture, NIKAI_BITS, false));
|
||||
}
|
||||
@@ -30,9 +30,10 @@ clean :
|
||||
|
||||
# All the IR protocol object files.
|
||||
PROTOCOLS = ir_NEC.o ir_Sony.o ir_Samsung.o ir_JVC.o ir_RCMM.o ir_RC5_RC6.o \
|
||||
ir_LG.o ir_Mitsubishi.o ir_Fujitsu.o ir_Sharp.o ir_Sanyo.o ir_Denon.o ir_Dish.o \
|
||||
ir_Panasonic.o ir_Whynter.o ir_Coolix.o ir_Aiwa.o ir_Sherwood.o \
|
||||
ir_Kelvinator.o ir_Daikin.o ir_Gree.o ir_Pronto.o ir_GlobalCache.o
|
||||
ir_LG.o ir_Mitsubishi.o ir_Fujitsu.o ir_Sharp.o ir_Sanyo.o \
|
||||
ir_Denon.o ir_Dish.o ir_Panasonic.o ir_Whynter.o ir_Coolix.o \
|
||||
ir_Aiwa.o ir_Sherwood.o ir_Kelvinator.o ir_Daikin.o ir_Gree.o \
|
||||
ir_Pronto.o ir_GlobalCache.o ir_Nikai.o
|
||||
# Common object files
|
||||
COMMON_OBJ = IRutils.o IRtimer.o IRsend.o IRrecv.o $(PROTOCOLS)
|
||||
|
||||
@@ -130,3 +131,6 @@ ir_Gree.o : $(USER_DIR)/ir_Gree.cpp $(GTEST_HEADERS)
|
||||
|
||||
ir_Pronto.o : $(USER_DIR)/ir_Pronto.cpp $(GTEST_HEADERS)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Pronto.cpp
|
||||
|
||||
ir_Nikai.o : $(USER_DIR)/ir_Nikai.cpp $(GTEST_HEADERS)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/ir_Nikai.cpp
|
||||
|
||||
@@ -44,6 +44,7 @@ std::string encoding(decode_results *results) {
|
||||
case PANASONIC: return "PANASONIC"; break;
|
||||
case DENON: return "DENON"; break;
|
||||
case COOLIX: return "COOLIX"; break;
|
||||
case NIKAI: return "NIKAI"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user